changeset 3693:3b847cba6d71

[xemacs-hg @ 2006-11-22 02:20:20 by stephent] Update buffer-file-truename with buffer-file-name in info.el. Document invariant. <874pssmen5.fsf@uwakimon.sk.tsukuba.ac.jp>
author stephent
date Wed, 22 Nov 2006 02:20:34 +0000
parents e8f894dc0700
children a30f3a38c4ae
files lisp/ChangeLog lisp/info.el src/ChangeLog src/buffer.c
diffstat 4 files changed, 30 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Nov 21 22:51:08 2006 +0000
+++ b/lisp/ChangeLog	Wed Nov 22 02:20:34 2006 +0000
@@ -1,3 +1,11 @@
+2006-11-14  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* info.el (Info-find-file-node, Info-insert-dir)
+	(Info-read-subfile, Info-insert-file-contents): Maintain invariant
+	`(equal buffer-file-truename (file-truename buffer-file-name))'.
+	Thanks to Nelson Ferreira <nelson.ferreira@ieee.org> for report
+	and discussion.
+
 2006-11-15  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* mule/mule-charset.el:
--- a/lisp/info.el	Tue Nov 21 22:51:08 2006 +0000
+++ b/lisp/info.el	Wed Nov 22 02:20:34 2006 +0000
@@ -717,7 +717,8 @@
 		    ;; Nooooooooooo!  Info-index can extend across more
 		    ;; than one file (e.g. XEmacs, Lispref)
 		    ;; Info-index-alternatives nil
-		    buffer-file-name nil)
+		    buffer-file-name nil
+		    buffer-file-truename nil)
 	      (erase-buffer)
 	      (if (string= "dir" (file-name-nondirectory filename))
 		  (Info-insert-dir)
@@ -1052,7 +1053,8 @@
       (message "Composing main Info directory...done"))
     (setq Info-dir-contents (buffer-string)))
   (setq default-directory (file-name-as-directory Info-dir-contents-directory))
-  (setq buffer-file-name (caar Info-dir-file-attributes)))
+  (setq buffer-file-name (caar Info-dir-file-attributes)
+	buffer-file-truename (file-truename buffer-file-name)))
 
 (defmacro Info-directory-files (dir-file &optional all full nosort files-only)
   "Return a list of Info files living in the same directory as DIR-FILE.
@@ -1423,7 +1425,8 @@
 	    (throw 'foo t)))))
     (or (equal Info-current-subfile lastfilename)
 	(let ((buffer-read-only nil))
-	  (setq buffer-file-name nil)
+	  (setq buffer-file-name nil
+		buffer-file-truename nil)
 	  (widen)
 	  (erase-buffer)
 	  (Info-insert-file-contents (Info-suffixed-file
@@ -1531,7 +1534,8 @@
 	  (call-process shell-file-name nil t nil shell-command-switch command)
 	  (message "")
 	  (when visit
-	    (setq buffer-file-name file)
+	    (setq buffer-file-name file
+		  buffer-file-truename (file-truename buffer-file-name))
 	    (set-buffer-modified-p nil)
 	    (clear-visited-file-modtime)))
       (insert-file-contents file visit))))
--- a/src/ChangeLog	Tue Nov 21 22:51:08 2006 +0000
+++ b/src/ChangeLog	Wed Nov 22 02:20:34 2006 +0000
@@ -1,3 +1,10 @@
+2006-11-14  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* buffer.c (buffer-file-name): Document invariant.
+	(buffer-file-truename): Sync wording to buffer-file-name.
+	Thanks to Nelson Ferreira <nelson.ferreira@ieee.org> for report
+	and discussion.
+
 2006-11-20  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* mule-ccl.c (CCL_MAKE_CHAR):
--- a/src/buffer.c	Tue Nov 21 22:51:08 2006 +0000
+++ b/src/buffer.c	Wed Nov 22 02:20:34 2006 +0000
@@ -2635,6 +2635,8 @@
   DEFVAR_BUFFER_LOCAL ("buffer-file-name", filename /*
 Name of file visited in current buffer, or nil if not visiting a file.
 Each buffer has its own value of this variable.
+Code that changes this variable must maintain the invariant
+`(equal buffer-file-truename (file-truename buffer-file-name))'.
 */ );
 
 #if 0 /* FSFmacs */
@@ -2647,12 +2649,11 @@
 #endif /* FSFmacs */
 
   DEFVAR_BUFFER_LOCAL ("buffer-file-truename", file_truename /*
-The real name of the file visited in the current buffer,
-or nil if not visiting a file.  This is the result of passing
-buffer-file-name to the `file-truename' function.  Every buffer has
-its own value of this variable.  This variable is automatically
-maintained by the functions that change the file name associated
-with a buffer.
+The real name of the file visited in the current buffer, or nil if not
+visiting a file.  This is the result of passing `buffer-file-name' to the
+`file-truename' function.  Every buffer has its own value of this variable.
+Code that changes the file name associated with a buffer maintains the
+invariant `(equal buffer-file-truename (file-truename buffer-file-name))'.
 */ );
 
   DEFVAR_BUFFER_LOCAL ("buffer-auto-save-file-name", auto_save_file_name /*