emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 141b085: Treat list-buffers-directory as a string


From: Mark Oteiza
Subject: [Emacs-diffs] master 141b085: Treat list-buffers-directory as a string
Date: Thu, 2 Feb 2017 03:57:58 +0000 (UTC)

branch: master
commit 141b085674e2945cc0c42bbe35548c368d1b023e
Author: Mark Oteiza <address@hidden>
Commit: Mark Oteiza <address@hidden>

    Treat list-buffers-directory as a string
    
    Another step in the long history of list-buffers-directory.  A thread
    branch discussing the meaning/use of the variable starts here
    https://lists.gnu.org/archive/html/emacs-devel/2009-09/msg00684.html
    Also see (info "(elisp) Buffer File Name").
    * lisp/buff-menu.el: Relocate special case code into info.el.  Nix
    Info-* defvars.
    (Buffer-menu--pretty-file-name): Remove special case.  Use
    bound-and-true-p.
    (Buffer-menu-info-node-description): Remove.
    * lisp/ibuffer.el (ibuffer-buffer-file-name): Treat
    list-buffers-directory as a string.
    * lisp/info.el (Info-node-description): New function.
    (Info-select-node): Use it.
---
 lisp/buff-menu.el |   19 +------------------
 lisp/ibuffer.el   |   15 ++++++++-------
 lisp/info.el      |   11 +++++++++++
 3 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 77b325f..9f618bc 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -102,9 +102,6 @@ This is set by the prefix argument to `buffer-menu' and 
related
 commands.")
 (make-variable-buffer-local 'Buffer-menu-files-only)
 
-(defvar Info-current-file) ; from info.el
-(defvar Info-current-node) ; from info.el
-
 (defvar Buffer-menu-mode-map
   (let ((map (make-sparse-keymap))
        (menu-map (make-sparse-keymap)))
@@ -702,21 +699,7 @@ means list those buffers and no others."
 (defun Buffer-menu--pretty-file-name (file)
   (cond (file
         (abbreviate-file-name file))
-       ((and (boundp 'list-buffers-directory)
-             list-buffers-directory)
-        list-buffers-directory)
-       ((eq major-mode 'Info-mode)
-        (Buffer-menu-info-node-description Info-current-file))
+       ((bound-and-true-p list-buffers-directory))
        (t "")))
 
-(defun Buffer-menu-info-node-description (file)
-  (cond
-   ((equal file "dir") "*Info Directory*")
-   ((eq file 'apropos) "*Info Apropos*")
-   ((eq file 'history) "*Info History*")
-   ((eq file 'toc)     "*Info TOC*")
-   ((not (stringp file)) "") ; Avoid errors
-   (t
-    (concat "(" (file-name-nondirectory file) ") " Info-current-node))))
-
 ;;; buff-menu.el ends here
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index c6e5e47..71bf1d6 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1319,13 +1319,14 @@ a new window in the current frame, splitting 
vertically."
   (cl-assert (derived-mode-p 'ibuffer-mode)))
 
 (defun ibuffer-buffer-file-name ()
-  (or buffer-file-name
-      (let ((dirname (or (and (boundp 'dired-directory)
-                             (if (stringp dired-directory)
-                                 dired-directory
-                               (car dired-directory)))
-                        (bound-and-true-p list-buffers-directory))))
-       (and dirname (expand-file-name dirname)))))
+  (cond
+   ((buffer-file-name))
+   ((bound-and-true-p list-buffers-directory))
+   ((let ((dirname (and (boundp 'dired-directory)
+                        (if (stringp dired-directory)
+                            dired-directory
+                          (car dired-directory)))))
+       (and dirname (expand-file-name dirname))))))
 
 (define-ibuffer-op ibuffer-do-save ()
   "Save marked buffers as with `save-buffer'."
diff --git a/lisp/info.el b/lisp/info.el
index e32b6b3..0cfcec3 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1599,6 +1599,16 @@ escaped (\\\",\\\\)."
            parameter-alist))
     parameter-alist))
 
+(defun Info-node-description (file)
+  (cond
+   ((equal file "dir") "*Info Directory*")
+   ((eq file 'apropos) "*Info Apropos*")
+   ((eq file 'history) "*Info History*")
+   ((eq file 'toc)     "*Info TOC*")
+   ((not (stringp file)) "") ; Avoid errors
+   (t
+    (concat "(" (file-name-nondirectory file) ") " Info-current-node))))
+
 (defun Info-display-images-node ()
   "Display images in current node."
   (save-excursion
@@ -1693,6 +1703,7 @@ escaped (\\\",\\\\)."
          (setq Info-history-forward nil))
        (if (not (eq Info-fontify-maximum-menu-size nil))
             (Info-fontify-node))
+        (setq list-buffers-directory (Info-node-description Info-current-file))
        (Info-display-images-node)
        (Info-hide-cookies-node)
        (run-hooks 'Info-selection-hook)))))



reply via email to

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