emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101159: * lisp/vc/add-log.el (add-lo


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101159: * lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Date: Sat, 21 Aug 2010 16:09:46 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101159
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sat 2010-08-21 16:09:46 +0200
message:
  * lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
modified:
  lisp/ChangeLog
  lisp/vc/add-log.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-08-21 04:46:23 +0000
+++ b/lisp/ChangeLog    2010-08-21 14:09:46 +0000
@@ -1,3 +1,7 @@
+2010-08-21  Stefan Monnier  <address@hidden>
+
+       * vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
+
 2010-08-21  Chong Yidong  <address@hidden>
 
        * mouse.el (mouse-save-then-kill): Don't save region to kill ring
@@ -10,19 +14,18 @@
 2010-08-21  Vinicius Jose Latorre  <address@hidden>
 
        * whitespace.el: Fix slow cursor movement.  Reported by Christoph
-       Groth <address@hidden> and Liu Xin <address@hidden>.  New version
-       13.0.
+       Groth <address@hidden> and Liu Xin <address@hidden>.
+       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  <address@hidden>
 
@@ -3227,7 +3230,8 @@
        * 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.
 
@@ -3277,8 +3281,8 @@
 
 2010-04-28  Chong Yidong  <address@hidden>
 
-       * 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  <address@hidden>
 
@@ -3453,8 +3457,7 @@
 
        * 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  <address@hidden>
@@ -4031,7 +4034,7 @@
 
        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.
 
@@ -5542,8 +5545,8 @@
 2010-01-21  Alan Mackenzie  <address@hidden>
 
        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.
 

=== modified file 'lisp/vc/add-log.el'
--- a/lisp/vc/add-log.el        2010-06-11 19:09:57 +0000
+++ b/lisp/vc/add-log.el        2010-08-21 14:09:46 +0000
@@ -755,7 +755,17 @@
     (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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]