emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/help-mode.el,v


From: Martin Rudalics
Subject: [Emacs-diffs] Changes to emacs/lisp/help-mode.el,v
Date: Sat, 10 Nov 2007 09:54:07 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Martin Rudalics <m061211>       07/11/10 09:54:07

Index: help-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/help-mode.el,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- help-mode.el        9 Aug 2007 02:48:42 -0000       1.57
+++ help-mode.el        10 Nov 2007 09:54:07 -0000      1.58
@@ -221,13 +221,22 @@
   (use-local-map help-mode-map)
   (setq mode-name "Help")
   (setq major-mode 'help-mode)
+
   (view-mode)
-  (make-local-variable 'view-no-disable-on-exit)
-  (setq view-no-disable-on-exit t)
-  (setq view-exit-action (lambda (buffer)
-                          (or (window-minibuffer-p (selected-window))
-                              (one-window-p t)
-                              (delete-window))))
+  (set (make-local-variable 'view-no-disable-on-exit) t)
+  ;; With Emacs 22 `view-exit-action' could delete the selected window
+  ;; disregarding whether the help buffer was shown in that window at
+  ;; all.  Since `view-exit-action' is called with the help buffer as
+  ;; argument it seems more appropriate to have it work on the buffer
+  ;; only and leave it to `view-mode-exit' to delete any associated
+  ;; window(s).
+  (setq view-exit-action
+       (lambda (buffer)
+         ;; Use `with-current-buffer' to make sure that `bury-buffer'
+         ;; also removes BUFFER from the selected window.
+         (with-current-buffer buffer
+           (bury-buffer))))
+
   (run-mode-hooks 'help-mode-hook))
 
 ;;;###autoload
@@ -237,6 +246,12 @@
 
 ;;;###autoload
 (defun help-mode-finish ()
+  (if (eq help-window t)
+      ;; If `help-window' is t, `view-return-to-alist' is handled by
+      ;; `with-help-window'.  In this case set `help-window' to the
+      ;; selected window since now is the only moment where we can
+      ;; unambiguously identify it.
+      (setq help-window (selected-window))
   (let ((entry (assq (selected-window) view-return-to-alist)))
        (if entry
            ;; When entering Help mode from the Help window,
@@ -246,7 +261,8 @@
            nil
          (setq view-return-to-alist
                (cons (cons (selected-window) help-return-method)
-                     view-return-to-alist))))
+                   view-return-to-alist)))))
+
   (when (eq major-mode 'help-mode)
     ;; View mode's read-only status of existing *Help* buffer is lost
     ;; by with-output-to-temp-buffer.
@@ -321,6 +337,7 @@
 (defvar help-xref-following nil
   "Non-nil when following a help cross-reference.")
 
+;;;###autoload
 (defun help-buffer ()
   (buffer-name                         ;for with-output-to-temp-buffer
    (if help-xref-following




reply via email to

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