[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
23/35: emacs: Generalize buffer reverting.
From: |
Alex Kost |
Subject: |
23/35: emacs: Generalize buffer reverting. |
Date: |
Fri, 11 Dec 2015 11:42:38 +0000 |
alezost pushed a commit to branch wip-refactor-emacs-ui
in repository guix.
commit faa0f725d9de26d68b5ec8a2a5a97c6b58db8c54
Author: Alex Kost <address@hidden>
Date: Sun Nov 22 14:37:45 2015 +0300
emacs: Generalize buffer reverting.
This is a partial revert of commit d2b299a91f3be283df1264afe62770ab2783ace9.
* emacs/guix-base.el (guix-revert-buffer): Make it more general by
removing the code specific to a particular search (a search for
packages/outputs by ID). Rename to...
(guix-buffer-revert): ... this.
---
emacs/guix-base.el | 30 ++++++------------------------
1 files changed, 6 insertions(+), 24 deletions(-)
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 7592988..9b90942 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -235,7 +235,7 @@ If MODES is nil, return list of all Guix 'list' and 'info'
buffers."
(defun guix-update-buffer (buffer)
"Update information in a 'list' or 'info' BUFFER."
(with-current-buffer buffer
- (guix-revert-buffer nil t)))
+ (guix-buffer-revert nil t)))
(defun guix-update-buffers-maybe-after-operation ()
"Update buffers after Guix operation if needed.
@@ -447,7 +447,7 @@ If non-nil, ask to confirm for reverting `%S' buffer."
,(concat "Major mode for displaying information about "
entry-str ".\n\n"
"\\{" mode-map-str "}")
- (setq-local revert-buffer-function 'guix-revert-buffer)
+ (setq-local revert-buffer-function 'guix-buffer-revert)
(setq-local guix-history-size
(guix-buffer-history-size
',buffer-type ',entry-type))
@@ -582,7 +582,7 @@ If NO-DISPLAY is non-nil, do not switch to the buffer."
buffer-type)
entry-type)))))
-(defun guix-revert-buffer (_ignore-auto noconfirm)
+(defun guix-buffer-revert (_ignore-auto noconfirm)
"Update information in the current buffer.
The function is suitable for `revert-buffer-function'.
See `revert-buffer' for the meaning of NOCONFIRM."
@@ -590,31 +590,13 @@ See `revert-buffer' for the meaning of NOCONFIRM."
(guix-buffer-revert-confirm? guix-buffer-type
guix-entry-type)
(y-or-n-p "Update current information? "))
- (let* ((search-type guix-search-type)
- (search-vals guix-search-vals)
- (params (guix-get-params-for-receiving guix-buffer-type
+ (let* ((params (guix-get-params-for-receiving guix-buffer-type
guix-entry-type))
(entries (guix-get-entries
guix-profile guix-entry-type
- guix-search-type guix-search-vals params))
- ;; If a REPL was restarted, package/output IDs are not actual
- ;; anymore, because 'object-address'-es died with the REPL, so if a
- ;; search by ID didn't give results, search again by name.
- (entries (if (and (null entries)
- (eq guix-search-type 'id)
- (or (eq guix-entry-type 'package)
- (eq guix-entry-type 'output)))
- (progn
- (setq search-type 'name
- search-vals
- (guix-package-entries->name-specifications
- guix-entries))
- (guix-get-entries
- guix-profile guix-entry-type
- search-type search-vals params))
- entries)))
+ guix-search-type guix-search-vals params)))
(guix-set-buffer guix-profile entries guix-buffer-type guix-entry-type
- search-type search-vals t t))))
+ guix-search-type guix-search-vals t t))))
(defvar guix-buffer-after-redisplay-hook nil
"Hook run by `guix-buffer-redisplay'.
- 12/35: emacs: list: Generalize 'sort-key' code., (continued)
- 12/35: emacs: list: Generalize 'sort-key' code., Alex Kost, 2015/12/11
- 15/35: emacs: list: Factorize "edit package" commands., Alex Kost, 2015/12/11
- 10/35: emacs: list: Generalize 'marks' code., Alex Kost, 2015/12/11
- 11/35: emacs: list: Generalize 'describe' code., Alex Kost, 2015/12/11
- 14/35: emacs: list: Split 'guix-list-format' variable., Alex Kost, 2015/12/11
- 20/35: emacs: Add wrappers for 'history-size' and 'revert-confirm'., Alex Kost, 2015/12/11
- 03/35: emacs: Add API for 'guix-entry'., Alex Kost, 2015/12/11
- 19/35: emacs: Split 'guix-param-titles' variable., Alex Kost, 2015/12/11
- 24/35: emacs: Improve messages for packages found by ID., Alex Kost, 2015/12/11
- 21/35: emacs: Split 'guix-root-map' keymap., Alex Kost, 2015/12/11
- 23/35: emacs: Generalize buffer reverting.,
Alex Kost <=
- 25/35: emacs: info: Buttonize package name heading., Alex Kost, 2015/12/11
- 22/35: emacs: Generalize buffer redisplaying., Alex Kost, 2015/12/11
- 27/35: emacs: info: Get rid of syntactic fontification., Alex Kost, 2015/12/11
- 18/35: emacs: info: Split 'guix-info-format' variable., Alex Kost, 2015/12/11
- 17/35: emacs: Factorize macros for defining interfaces., Alex Kost, 2015/12/11
- 29/35: emacs: Reorganize 'readers' code., Alex Kost, 2015/12/11
- 31/35: emacs: Add 'list-single' variables., Alex Kost, 2015/12/11
- 33/35: emacs: Return nil instead of "" in completing readers., Alex Kost, 2015/12/11
- 26/35: emacs: Generalize buffer naming., Alex Kost, 2015/12/11
- 32/35: emacs: Add 'guix-list-get-display-entries'., Alex Kost, 2015/12/11