[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20/35: emacs: Add wrappers for 'history-size' and 'revert-confirm'.
From: |
Alex Kost |
Subject: |
20/35: emacs: Add wrappers for 'history-size' and 'revert-confirm'. |
Date: |
Fri, 11 Dec 2015 11:42:37 +0000 |
alezost pushed a commit to branch wip-refactor-emacs-ui
in repository guix.
commit 8100e6ad7a3cc04bc3cc19569d45f0124e6e7b30
Author: Alex Kost <address@hidden>
Date: Sat Nov 21 12:07:17 2015 +0300
emacs: Add wrappers for 'history-size' and 'revert-confirm'.
* emacs/guix-base.el (guix-buffer-history-size): New procedure.
(guix-buffer-define-interface): Use it in the mode definition.
(guix-buffer-revert-confirm?): New procedure.
(guix-revert-buffer): Use it.
---
emacs/guix-base.el | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index b3e181b..3aaa266 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -275,6 +275,14 @@ This alist is filled by `guix-buffer-define-interface'
macro.")
param))
(guix-symbol-title param)))
+(defun guix-buffer-history-size (buffer-type entry-type)
+ "Return history size for BUFFER-TYPE/ENTRY-TYPE."
+ (guix-buffer-value buffer-type entry-type 'history-size))
+
+(defun guix-buffer-revert-confirm? (buffer-type entry-type)
+ "Return 'revert-confirm' value for BUFFER-TYPE/ENTRY-TYPE."
+ (guix-buffer-value buffer-type entry-type 'revert-confirm))
+
(defvar guix-root-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "l") 'guix-history-back)
@@ -431,17 +439,25 @@ If non-nil, ask to confirm for reverting `%S' buffer."
:type 'boolean
:group ',group)
+ (guix-alist-put!
+ '((history-size . ,history-size-var)
+ (revert-confirm . ,revert-confirm-var))
+ 'guix-buffer-data ',buffer-type ',entry-type)
+
(define-derived-mode ,mode ,parent-mode
,(concat "Guix-" Buffer-type-str)
,(concat "Major mode for displaying information about "
entry-str ".\n\n"
"\\{" mode-map-str "}")
(setq-local revert-buffer-function 'guix-revert-buffer)
- (setq-local guix-history-size ,history-size-var)
+ (setq-local guix-history-size
+ (guix-buffer-history-size
+ ',buffer-type ',entry-type))
(and (fboundp ',mode-init-fun) (,mode-init-fun)))))
- (guix-alist-put! ',titles-var 'guix-buffer
- ',buffer-type ',entry-type 'titles)))))
+ (guix-alist-put!
+ ',titles-var 'guix-buffer-data
+ ',buffer-type ',entry-type 'titles)))))
;;; Getting and displaying info about packages and generations
@@ -573,9 +589,8 @@ If NO-DISPLAY is non-nil, do not switch to the buffer."
The function is suitable for `revert-buffer-function'.
See `revert-buffer' for the meaning of NOCONFIRM."
(when (or noconfirm
- (symbol-value
- (guix-get-symbol "revert-no-confirm"
- guix-buffer-type guix-entry-type))
+ (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)
- 09/35: emacs: Add 'guix-alist-put'., (continued)
- 09/35: emacs: Add 'guix-alist-put'., Alex Kost, 2015/12/11
- 06/35: emacs: Rename internal procedures., Alex Kost, 2015/12/11
- 07/35: emacs: list: Configure format in one place., Alex Kost, 2015/12/11
- 13/35: emacs: list: Add 'guix-list-mode-initialize'., Alex Kost, 2015/12/11
- 08/35: emacs: Add 'guix-keyword-args-let'., Alex Kost, 2015/12/11
- 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 <=
- 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, 2015/12/11
- 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