;;; lisp-mnt.el --- utility functions for Emacs Lisp maintainers
-;; Copyright (C) 1992, 1994, 1997, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994, 1997, 2000-2011 Free Software Foundation, Inc.
;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
;; Maintainer: FSF
(defmacro lm-with-file (file &rest body)
"Execute BODY in a buffer containing the contents of FILE.
If FILE is nil, execute BODY in the current buffer."
+ (declare (indent 1) (debug t))
(let ((filesym (make-symbol "file")))
`(let ((,filesym ,file))
(if ,filesym
(with-syntax-table emacs-lisp-mode-syntax-table
,@body))))))
-(put 'lm-with-file 'lisp-indent-function 1)
-(put 'lm-with-file 'edebug-form-spec t)
-
;; Fixme: Probably this should be amalgamated with copyright.el; also
;; we need a check for ranges in copyright years.
(match-string-no-properties 1)))))))
(defun lm-keywords (&optional file)
- "Return the keywords given in file FILE, or current buffer if FILE is nil."
+ "Return the keywords given in file FILE, or current buffer if FILE is nil.
+The return is a `downcase'-ed string, or nil if no keywords
+header. Multi-line keywords are joined up with a space between
+each line."
(lm-with-file file
- (let ((keywords (lm-header "keywords")))
- (and keywords (downcase keywords)))))
+ (let ((keywords (lm-header-multiline "keywords")))
+ (and keywords
+ (mapconcat 'downcase keywords " ")))))
(defun lm-keywords-list (&optional file)
"Return list of keywords given in file FILE."
(let ((keywords (lm-keywords file)))
(if keywords
- (split-string keywords ",?[ \t]"))))
+ (if (string-match-p "," keywords)
+ (split-string keywords ",[ \t\n]*" t)
+ (split-string keywords "[ \t\n]+" t)))))
(defvar finder-known-keywords)
(defun lm-keywords-finder-p (&optional file)
(let ((must-kill (and file (not (get-file-buffer file)))))
(when file (find-file file))
(prog1
- (if (interactive-p)
+ (if (called-interactively-p 'interactive)
(message "%s" (lm-summary))
(lm-summary))
(when must-kill (kill-buffer (current-buffer))))))))
(provide 'lisp-mnt)
-;; arch-tag: fa3c5ab4-a37b-4e46-b7cf-b6d78b90e69e
;;; lisp-mnt.el ends here