diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2020-09-09 13:29:59 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2020-09-09 13:30:20 -0400 |
commit | 6e7736ac5f42e2f1b17aacdfb2a60d8bb951d038 (patch) | |
tree | 8d6086bd706f2c0cae44c3668c6167fc0a64bfea /lisp/cus-dep.el | |
parent | 9de9976de003b94d7496a55d4d643ac31514d520 (diff) | |
download | emacs-6e7736ac5f42e2f1b17aacdfb2a60d8bb951d038.tar.gz |
(define-minor-mode): Don't compute a default :group (bug#41145)
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Rely on the
`defcustom`s own defaulting for the :group.
* lisp/display-fill-column-indicator.el
(global-display-fill-column-indicator-mode): Remove now redundant :group.
* lisp/cus-dep.el (custom--get-def): New function.
(custom-make-dependencies): Use it.
Diffstat (limited to 'lisp/cus-dep.el')
-rw-r--r-- | lisp/cus-dep.el | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el index b1027ce34f9..9003b7fc1b5 100644 --- a/lisp/cus-dep.el +++ b/lisp/cus-dep.el @@ -51,6 +51,25 @@ ldefs-boot\\|cus-load\\|finder-inf\\|esh-groups\\|subdirs\\)\\.el$\\)" (defalias sym e)))) '(defcustom defface defgroup))) +(defun custom--get-def (expr) + (if (not (memq (car-safe expr) + '( define-minor-mode define-globalized-minor-mode))) + expr + ;; For define-minor-mode, we don't want to evaluate the whole + ;; expression, because it tends to define functions which aren't + ;; usable (because they call other functions that were skipped). + ;; Concretely it gave us an error + ;; "void-function bug-reference--run-auto-setup" + ;; when subsequently loading `cus-load.el'. + (let ((es (list (macroexpand-all expr))) + defs) + (while es + (let ((e (pop es))) + (pcase e + (`(progn . ,exps) (setq es (append exps es))) + (`(custom-declare-variable . ,_) (push e defs))))) + (macroexp-progn (nreverse defs))))) + (defun custom-make-dependencies () "Batch function to extract custom dependencies from .el files. Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" @@ -102,12 +121,16 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" "^(def\\(custom\\|face\\|group\\|ine\\(?:-globalized\\)?-minor-mode\\)" nil t) (beginning-of-line) (let ((type (match-string 1)) - (expr (read (current-buffer)))) + (expr (custom--get-def (read (current-buffer))))) (condition-case nil - (let ((custom-dont-initialize t)) + (let ((custom-dont-initialize t) + (sym (nth 1 expr))) + (put (if (eq (car-safe sym) 'quote) + (cadr sym) + sym) + 'custom-where name) ;; Eval to get the 'custom-group, -tag, ;; -version, group-documentation etc properties. - (put (nth 1 expr) 'custom-where name) (eval expr)) ;; Eval failed for some reason. Eg maybe the ;; defcustom uses something defined earlier @@ -148,7 +171,8 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" (when found (push (cons (symbol-name symbol) (with-output-to-string - (prin1 (sort found 'string<)))) alist)))))) + (prin1 (sort found #'string<)))) + alist)))))) (dolist (e (sort alist (lambda (e1 e2) (string< (car e1) (car e2))))) (insert "(put '" (car e) " 'custom-loads '" (cdr e) ")\n"))) (insert "\ |