From 2614c1af39e9a9746133a7e04e19f378ad593909 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 23 Mar 2014 10:35:56 +0200 Subject: [PATCH] * lisp/emacs-lisp/package.el (package-show-package-list): If the buffer is already displayed in another window, switch to that window. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/package.el | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b73bb1e67d5..feb78f59fc7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-03-23 Dmitry Gutov + + * emacs-lisp/package.el (package-show-package-list): If the buffer + is already displayed in another window, switch to that window. + 2014-03-21 Daniel Colascione * mail/emacsbug.el (report-emacs-bug): Include memory usage diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 480fddbd320..39cfd8e46ec 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2117,11 +2117,14 @@ When KEYWORDS are given, only packages with those KEYWORDS are shown." (interactive) (require 'finder-inf nil t) - (let ((buf (get-buffer-create "*Packages*"))) + (let* ((buf (get-buffer-create "*Packages*")) + (win (get-buffer-window buf))) (with-current-buffer buf (package-menu-mode) (package-menu--generate nil packages keywords)) - (switch-to-buffer buf))) + (if win + (select-window win) + (switch-to-buffer buf)))) ;; package-menu--generate rebinds "q" on the fly, so we have to ;; hard-code the binding in the doc-string here. -- 2.39.2