]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 21 Aug 2010 14:09:46 +0000 (16:09 +0200)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 21 Aug 2010 14:09:46 +0000 (16:09 +0200)
lisp/ChangeLog
lisp/vc/add-log.el

index b717877dcf552b0cfff6dec3626e33788550200a..db5bc12462670e14b84f706c03fa2a3d2fa352fb 100644 (file)
@@ -1,3 +1,7 @@
+2010-08-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
+
 2010-08-21  Chong Yidong  <cyd@stupidchicken.com>
 
        * mouse.el (mouse-save-then-kill): Don't save region to kill ring
 2010-08-21  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
 
        * whitespace.el: Fix slow cursor movement.  Reported by Christoph
-       Groth <cwg@falma.de> and Liu Xin <x_liu@neusoft.com>.  New version
-       13.0.
+       Groth <cwg@falma.de> and Liu Xin <x_liu@neusoft.com>.
+       New version 13.0.
        (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp):
        Adjust initialization.
        (whitespace-bob-marker, whitespace-eob-marker)
        (whitespace-buffer-changed): New vars.
        (whitespace-cleanup, whitespace-color-on, whitespace-color-off)
        (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp)
-       (whitespace-post-command-hook, whitespace-display-char-on): Adjust
-       code.
+       (whitespace-post-command-hook, whitespace-display-char-on):
+       Adjust code.
        (whitespace-looking-back, whitespace-buffer-changed): New funs.
-       (whitespace-space-regexp, whitespace-tab-regexp): Eliminated
-       funs.
+       (whitespace-space-regexp, whitespace-tab-regexp): Eliminate funs.
 
 2010-08-19  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * minibuffer.el (tags-completion-at-point-function): New function.
        (completion-at-point-functions): Use it.
 
-       * cedet/semantic.el (semantic-completion-at-point-function): New function.
+       * cedet/semantic.el (semantic-completion-at-point-function):
+       New function.
        (semantic-mode): Use semantic-completion-at-point-function for
        completion-at-point-functions instead.
 
 
 2010-04-28  Chong Yidong  <cyd@stupidchicken.com>
 
-       * progmodes/bug-reference.el (bug-reference-url-format): Revert
-       2010-04-27 change due to security risk.
+       * progmodes/bug-reference.el (bug-reference-url-format):
+       Revert 2010-04-27 change due to security risk.
 
 2010-04-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 
        * ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o
        toggles the use of virtual buffers.
-       (ido-buffer-internal): Guard `ido-use-virtual-buffers' global
-       value.
+       (ido-buffer-internal): Guard `ido-use-virtual-buffers' global value.
        (ido-toggle-virtual-buffers): New function.
 
 2010-04-21  Juanma Barranquero  <lekktu@gmail.com>
 
        Enable recentf-mode if using virtual buffers.
        * ido.el (recentf-list): Declare for byte-compiler.
-       (ido-virtual-buffers): Move up to silence byte-compiler.  Add docstring.
+       (ido-virtual-buffers): Move up to silence byte-compiler. Add docstring.
        (ido-make-buffer-list): Simplify.
        (ido-add-virtual-buffers-to-list): Simplify.  Enable recentf-mode.
 
 2010-01-21  Alan Mackenzie  <acm@muc.de>
 
        Fix a situation where deletion of a cpp construct throws an error.
-       * progmodes/cc-engine.el (c-invalidate-state-cache): Before
-       invoking c-with-all-but-one-cpps-commented-out, check that the
+       * progmodes/cc-engine.el (c-invalidate-state-cache):
+       Before invoking c-with-all-but-one-cpps-commented-out, check that the
        special cpp construct is still in the buffer.
        (c-parse-state): Record the special cpp with markers, not numbers.
 
index cf391b2f9ac2354b5212de08fcccc6826b6e0b6e..23f1e33f181b60edbc00c3b59d45330a9a5b1161 100644 (file)
@@ -755,7 +755,17 @@ Optional arg BUFFER-FILE overrides `buffer-file-name'."
     (if add-log-file-name-function
        (funcall add-log-file-name-function buffer-file)
       (setq buffer-file
-            (file-relative-name buffer-file (file-name-directory log-file)))
+            (let* ((dir (file-name-directory log-file))
+                   (rel (file-relative-name buffer-file dir)))
+              ;; Sometimes with symlinks, the two buffers may have names that
+              ;; appear to belong to different directory trees.  So check the
+              ;; file-truenames, to see if we get a better result.
+              (if (not (string-match "\\`\\.\\./" rel))
+                  rel
+                (let ((new (file-relative-name (file-truename buffer-file)
+                                               (file-truename dir))))
+                  (if (< (length new) (length rel))
+                      new rel)))))
       ;; If we have a backup file, it's presumably because we're
       ;; comparing old and new versions (e.g. for deleted
       ;; functions) and we'll want to use the original name.