[MLton-commit] r5178

Vesa Karvonen vesak at mlton.org
Mon Feb 12 13:02:03 PST 2007


Workaround for Gnu Emacs vs XEmacs difference.  In Gnu Emacs
`buffer-file-truename' is abbreviated while in XEmacs it isn't.  We
want the unabbreviated name.

----------------------------------------------------------------------

U   mlton/trunk/ide/emacs/def-use-mode.el
U   mlton/trunk/ide/emacs/def-use-util.el

----------------------------------------------------------------------

Modified: mlton/trunk/ide/emacs/def-use-mode.el
===================================================================
--- mlton/trunk/ide/emacs/def-use-mode.el	2007-02-12 19:22:36 UTC (rev 5177)
+++ mlton/trunk/ide/emacs/def-use-mode.el	2007-02-12 21:02:02 UTC (rev 5178)
@@ -124,7 +124,7 @@
 (defun def-use-ref-at-point (point)
   "Returns a reference for the symbol at the specified point in the
 current buffer."
-  (let ((src buffer-file-truename))
+  (let ((src (def-use-buffer-file-truename)))
     (when src
       (def-use-ref src
         (def-use-point-to-pos
@@ -200,7 +200,7 @@
     (def-use-error "Referenced file %s can not be read" (def-use-ref-src ref)))
    (other-window
     (def-use-find-file (def-use-ref-src ref) t))
-   ((not (equal buffer-file-truename (def-use-ref-src ref)))
+   ((not (equal (def-use-buffer-file-truename) (def-use-ref-src ref)))
     (def-use-find-file (def-use-ref-src ref))))
   (def-use-goto-pos (def-use-ref-pos ref)))
 
@@ -398,7 +398,7 @@
                  (mapc (function
                         (lambda (pos)
                           (def-use-highlight-ref length pos 'def-use-use-face)))
-                       (gethash buffer-file-truename file-to-poss))))
+                       (gethash (def-use-buffer-file-truename) file-to-poss))))
               (buffer-list))
         (let* ((ref (def-use-sym-ref sym))
                (buffer (def-use-find-buffer-visiting-file (def-use-ref-src ref))))

Modified: mlton/trunk/ide/emacs/def-use-util.el
===================================================================
--- mlton/trunk/ide/emacs/def-use-util.el	2007-02-12 19:22:36 UTC (rev 5177)
+++ mlton/trunk/ide/emacs/def-use-util.el	2007-02-12 21:02:02 UTC (rev 5178)
@@ -14,6 +14,14 @@
       (error 'error (concat "Error: " (apply (function format) str objs) ".")))
   (defalias 'def-use-error (function error)))
 
+;; In Gnu Emacs, `buffer-file-truename' is abbreviated while in XEmacs
+;; it isn't.
+(defun def-use-buffer-file-truename ()
+  "Returns the true filename of the current buffer."
+  (let ((name (buffer-file-name)))
+    (when name
+      (def-use-file-truename name))))
+
 (defvar def-use-file-truename-table
   (make-hash-table :test 'equal :weakness 'key)
   "Weak hash table private to `def-use-file-truename'.")
@@ -33,7 +41,7 @@
   (let ((truename (def-use-file-truename file)))
     (loop for buffer in (buffer-list) do
       (if (with-current-buffer buffer
-            (string= buffer-file-truename truename))
+            (string= (def-use-buffer-file-truename) truename))
           (return buffer)))))
 
 (defun def-use-find-file (file &optional other-window)




More information about the MLton-commit mailing list