Commit 386f506d authored by Sévère Durand's avatar Sévère Durand
Browse files

Partially applied patch from Protesilaos

* rlist.el (rlist-list-registers):
(rlist-verbose): Verbosity of the display of register contents.

(rlist-buffer-name): Customization option for the name of the buffer.

(rlist-register-regexp): Temporary change.

(rlist-delete-from-alist): Fix the previous bug of modifying the list
against the intention.
parent dd93d2a6
......@@ -32,9 +32,13 @@ add them at a later point.
Some great patches from [[][Protesilaos Stavrou]] are adapted. Thanks a lot!
The changes are as follows.
- Address common compiler warnings about packaging
- Declare rlist defgroup
- Implement face as a defface
- Expand defface definition and rename accordingly
- Address common compiler warnings about packaging.
- Declare rlist defgroup.
- Implement face as a defface.
- Expand defface definition and rename accordingly.
- Add the customization option which controls the verbosity of the
display of register contents.
- Add the customization option of the name of the buffer.
- Remove unnecessary autoloads.
And ideas and suggestions are always welcomed. :D
......@@ -25,7 +25,8 @@
;; interface.
;; It is recommended to bind the function `rlist-list-registers' to
;; the key originally bound to `list-registers', if any.
;; the key originally bound to `list-registers', if any. Personally I
;; bind it to "C-x v L".
;;; Code:
......@@ -35,13 +36,22 @@
"Interactively remove registers from the list."
:group 'register)
(defcustom rlist-expert nil
"Whether deleting registers requires confirmation."
:risky t
:group 'rlist
:type 'bool)
(defcustom rlist-verbose nil
"Whether registers should display their full value."
:group 'rlist
:type 'bool)
(defcustom rlist-buffer-name "*rlist*"
"Name of buffer showing the list of registers."
:group 'rlist
:type 'string)
(defface rlist-mark-delete
'((((class color) (min-colors 88) (background light))
:background "#ffccbb" :foreground "#840040")
......@@ -62,13 +72,13 @@ used as a `revert-buffer-function'."
(let ((list (copy-sequence register-alist)))
(setq list (sort list (lambda (a b) (< (car a) (car b)))))
(with-output-to-temp-buffer "*Output*"
(with-output-to-temp-buffer rlist-buffer-name
(dolist (elt list)
(when (get-register (car elt))
(describe-register-1 (car elt))
(describe-register-1 (car elt) rlist-verbose)
;; Only the following two lines differ from `list-registers'.
(select-window (get-buffer-window "*Output*"))
(select-window (get-buffer-window rlist-buffer-name))
......@@ -99,11 +109,9 @@ Press \\[rlist-unmark-all] to unmark all registers.
(cons ?n #'rlist-forward-register)
(cons ?p #'rlist-backward-register)))
(defvar rlist-register-regexp (rx-to-string `(seq "Register " (group not-newline)))
(defvar rlist-register-regexp (rx-to-string `(seq "Register " (group (1+ (not space))) space))
"The regular expression to match a register line.")
(defun rlist-internal-delete-registers (registers)
"The internal function to delete REGISTERS.
This is not inteded to be used interactively, but rather as the
......@@ -150,7 +158,6 @@ not active."
(rlist-read-register-for-mark arg))))
(rlist-internal-delete-registers list-of-registers-to-delete)))
(defun rlist-delete-from-alist (ls elements)
"Remove ELEMENTS from LS.
Elements of LS whose `car' equal an element of ELEMENTS are
......@@ -167,7 +174,7 @@ with ELEMENTS removed."
;; In our case, since both LS and ELEMENTS are sorted, we might have
;; a faster implementation which employs the sorted-ness of the
;; arguments, but I think it is pre-mature optimisation anyway.
(let* ((temp ls)
(let* ((temp (copy-tree ls))
(counter 0)
indices-list head)
(while (consp temp)
......@@ -190,13 +197,15 @@ with ELEMENTS removed."
(lambda (index)
((> index 0)
;; Using `setcdr' is more efficient but destructively
;; modifies the list. So we used `copy-tree' to prevent the
;; destructions.
(setcdr (nthcdr (1- index) temp)
(nthcdr (1+ index) temp)))
((setq temp (cdr temp)))))
(defun rlist-get-marked-registers ()
"Return the list of marked registers."
......@@ -349,7 +358,6 @@ The return value is a list of registers."
(rlist-register-at-point 200))))
(t (list (register-read-with-preview "Register: ")))))
(defun rlist-register-at-point (arg)
"Return the next/previous ARG register at point, if any."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment