lisp-mnt, checkdoc: Reduce run-time dependencies
* lisp/emacs-lisp/lisp-mnt.el: Don't require `mail-parse` at top-level. (lm-crack-address): Require it here instead. * lisp/emacs-lisp/checkdoc.el (dired): Don't load at run-time. (checkdoc-dired): Add corresponding `declare-function`.
This commit is contained in:
parent
6f3c62ff07
commit
9338fbbc28
2 changed files with 37 additions and 29 deletions
|
@ -166,7 +166,7 @@
|
|||
(require 'help-mode) ;; for help-xref-info-regexp
|
||||
(require 'thingatpt) ;; for handy thing-at-point-looking-at
|
||||
(require 'lisp-mode) ;; for lisp-mode-symbol-regexp
|
||||
(require 'dired) ;; for dired-get-filename and dired-map-over-marks
|
||||
(eval-when-compile (require 'dired)) ;; for dired-map-over-marks
|
||||
(require 'lisp-mnt)
|
||||
|
||||
(defvar compilation-error-regexp-alist)
|
||||
|
@ -1124,12 +1124,20 @@ Skip anything that doesn't have the Emacs Lisp library file
|
|||
extension (\".el\").
|
||||
When called from Lisp, FILES is a list of filenames."
|
||||
(interactive
|
||||
(list
|
||||
(delq nil
|
||||
(mapcar
|
||||
;; skip anything that doesn't look like an Emacs Lisp library
|
||||
(lambda (f) (if (equal (file-name-extension f) "el") f nil))
|
||||
(nreverse (dired-map-over-marks (dired-get-filename) nil)))))
|
||||
(progn
|
||||
;; These Dired functions must be defined since we're in a Dired buffer.
|
||||
(declare-function dired-get-filename "dired"
|
||||
(&optional localp no-error-if-not-filep bof))
|
||||
;; These functions are used by the expansion of `dired-map-over-marks'.
|
||||
(declare-function dired-move-to-filename "dired"
|
||||
(&optional raise-error eol))
|
||||
(declare-function dired-marker-regexp "dired" ())
|
||||
(list
|
||||
(delq nil
|
||||
(mapcar
|
||||
;; skip anything that doesn't look like an Emacs Lisp library
|
||||
(lambda (f) (if (equal (file-name-extension f) "el") f nil))
|
||||
(nreverse (dired-map-over-marks (dired-get-filename) nil))))))
|
||||
dired-mode)
|
||||
(if (null files)
|
||||
(error "No files to run checkdoc on")
|
||||
|
@ -1275,27 +1283,27 @@ TEXT, START, END and UNFIXABLE conform to
|
|||
(let ((map (make-sparse-keymap))
|
||||
(pmap (make-sparse-keymap)))
|
||||
;; Override some bindings
|
||||
(define-key map "\C-\M-x" 'checkdoc-eval-defun)
|
||||
(define-key map "\C-x`" 'checkdoc-continue)
|
||||
(define-key map "\C-\M-x" #'checkdoc-eval-defun)
|
||||
(define-key map "\C-x`" #'checkdoc-continue)
|
||||
(define-key map [menu-bar emacs-lisp eval-buffer]
|
||||
'checkdoc-eval-current-buffer)
|
||||
#'checkdoc-eval-current-buffer)
|
||||
;; Add some new bindings under C-c ?
|
||||
(define-key pmap "x" 'checkdoc-defun)
|
||||
(define-key pmap "X" 'checkdoc-ispell-defun)
|
||||
(define-key pmap "`" 'checkdoc-continue)
|
||||
(define-key pmap "~" 'checkdoc-ispell-continue)
|
||||
(define-key pmap "s" 'checkdoc-start)
|
||||
(define-key pmap "S" 'checkdoc-ispell-start)
|
||||
(define-key pmap "d" 'checkdoc)
|
||||
(define-key pmap "D" 'checkdoc-ispell)
|
||||
(define-key pmap "b" 'checkdoc-current-buffer)
|
||||
(define-key pmap "B" 'checkdoc-ispell-current-buffer)
|
||||
(define-key pmap "e" 'checkdoc-eval-current-buffer)
|
||||
(define-key pmap "m" 'checkdoc-message-text)
|
||||
(define-key pmap "M" 'checkdoc-ispell-message-text)
|
||||
(define-key pmap "c" 'checkdoc-comments)
|
||||
(define-key pmap "C" 'checkdoc-ispell-comments)
|
||||
(define-key pmap " " 'checkdoc-rogue-spaces)
|
||||
(define-key pmap "x" #'checkdoc-defun)
|
||||
(define-key pmap "X" #'checkdoc-ispell-defun)
|
||||
(define-key pmap "`" #'checkdoc-continue)
|
||||
(define-key pmap "~" #'checkdoc-ispell-continue)
|
||||
(define-key pmap "s" #'checkdoc-start)
|
||||
(define-key pmap "S" #'checkdoc-ispell-start)
|
||||
(define-key pmap "d" #'checkdoc)
|
||||
(define-key pmap "D" #'checkdoc-ispell)
|
||||
(define-key pmap "b" #'checkdoc-current-buffer)
|
||||
(define-key pmap "B" #'checkdoc-ispell-current-buffer)
|
||||
(define-key pmap "e" #'checkdoc-eval-current-buffer)
|
||||
(define-key pmap "m" #'checkdoc-message-text)
|
||||
(define-key pmap "M" #'checkdoc-ispell-message-text)
|
||||
(define-key pmap "c" #'checkdoc-comments)
|
||||
(define-key pmap "C" #'checkdoc-ispell-comments)
|
||||
(define-key pmap " " #'checkdoc-rogue-spaces)
|
||||
|
||||
;; bind our submap into map
|
||||
(define-key map "\C-c?" pmap)
|
||||
|
|
|
@ -111,8 +111,6 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(require 'mail-parse)
|
||||
|
||||
;;; Variables:
|
||||
|
||||
(defgroup lisp-mnt nil
|
||||
|
@ -361,6 +359,8 @@ Return argument is of the form (\"HOLDER\" \"YEAR1\" ... \"YEARN\")"
|
|||
(defun lm-crack-address (x)
|
||||
"Split up email address(es) X into full name and real email address.
|
||||
The value is a list of elements of the form (FULLNAME . ADDRESS)."
|
||||
(require 'mail-parse)
|
||||
(declare-function mail-header-parse-addresses-lax "mail-parse" (string))
|
||||
(mapcar (lambda (elem)
|
||||
(cons (cdr elem) (car elem)))
|
||||
(mail-header-parse-addresses-lax x)))
|
||||
|
@ -505,7 +505,7 @@ absent, return nil."
|
|||
(if (and page (string-match (rx bol "<" (+ nonl) ">" eol) page))
|
||||
(substring page 1 -1)
|
||||
page)))
|
||||
(defalias 'lm-homepage 'lm-website) ; for backwards-compatibility
|
||||
(defalias 'lm-homepage #'lm-website) ; for backwards-compatibility
|
||||
|
||||
;;; Verification and synopses
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue