From: Xue Fuqiao Date: Fri, 27 Dec 2013 10:21:47 +0000 (+0800) Subject: * admin/admin.el: Minor cleanups. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~172 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fe6462ee7ce2ec04322674952ff3e97085a4db69;p=emacs.git * admin/admin.el: Minor cleanups. * admin/admin.el (manual-misc-manuals, make-manuals): (manual-pdf, cusver-find-files): (cusver-new-version, cusver-scan, cusver-goto-xref): (cusver-check): Doc fix. (manual-html-node, cusver-check): Use `user-error'. --- diff --git a/admin/ChangeLog b/admin/ChangeLog index ea47a6798b5..8c20535e8d2 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,11 @@ +2013-12-27 Xue Fuqiao + + * admin.el (manual-misc-manuals, make-manuals): + (manual-pdf, cusver-find-files): + (cusver-new-version, cusver-scan, cusver-goto-xref): + (cusver-check): Doc fix. + (manual-html-node, cusver-check): Use `user-error'. + 2013-12-24 Paul Eggert Automate the procedure for updating copyright year. diff --git a/admin/admin.el b/admin/admin.el index 5e5e57cb3ce..5989fb27144 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -108,7 +108,7 @@ Root must be the root of an Emacs source tree." ;; in two places those commas are followed by space, in two other ;; places they are not. (let* ((version-components (append (split-string version "\\.") - '("0" "0"))) + '("0" "0"))) (comma-version (concat (car version-components) "," (cadr version-components) "," @@ -198,7 +198,8 @@ Root must be the root of an Emacs source tree." ;;; Various bits of magic for generating the web manuals (defun manual-misc-manuals (root) - "Return doc/misc manuals as list of strings." + "Return doc/misc manuals as list of strings. +ROOT should be the root of an Emacs source tree." ;; Similar to `make -C doc/misc echo-info', but works if unconfigured, ;; and for INFO_TARGETS rather than INFO_INSTALL. (with-temp-buffer @@ -217,6 +218,7 @@ Root must be the root of an Emacs source tree." (defun make-manuals (root &optional type) "Generate the web manuals for the Emacs webpage. +ROOT should be the root of an Emacs source tree. Interactively with a prefix argument, prompt for TYPE. Optional argument TYPE is type of output (nil means all)." (interactive (let ((root (read-directory-name "Emacs root directory: " @@ -332,7 +334,7 @@ This function also edits the HTML files so that they validate as HTML 4.01 Transitional, and pulls in the gnu.org stylesheet using the @import directive." (unless (file-exists-p texi-file) - (error "Manual file %s not found" texi-file)) + (user-error "Manual file %s not found" texi-file)) (make-directory dir t) (call-process "makeinfo" nil nil nil "-D" "WWW_GNU_ORG" @@ -369,7 +371,7 @@ the @import directive." (save-buffer)))))) (defun manual-pdf (texi-file dest) - "Run texi2pdf on TEXI-FILE, emitting pdf output to DEST." + "Run texi2pdf on TEXI-FILE, emitting PDF output to DEST." (make-directory (or (file-name-directory dest) ".") t) (let ((default-directory (file-name-directory texi-file))) (call-process "texi2pdf" nil nil nil @@ -381,6 +383,7 @@ the @import directive." (make-directory (or (file-name-directory dest) ".") t) (let ((dvi-dest (concat (file-name-sans-extension dest) ".dvi")) (default-directory (file-name-directory texi-file))) + ;; FIXME: Use `texi2dvi --ps'? --xfq (call-process "texi2dvi" nil nil nil "-I" "../emacs" "-I" "../misc" texi-file "-o" dvi-dest) @@ -497,12 +500,12 @@ the @import directive." (forward-line 1)))) -;; Stuff to check new defcustoms got :version tags. +;; Stuff to check new `defcustom's got :version tags. ;; Adapted from check-declare.el. (defun cusver-find-files (root &optional old) - "Find .el files beneath directory ROOT that contain defcustoms. -If optional OLD is non-nil, also include defvars." + "Find .el files beneath directory ROOT that contain `defcustom's. +If optional OLD is non-nil, also include `defvar's." (process-lines find-program root "-name" "*.el" "-exec" grep-program @@ -514,14 +517,14 @@ If optional OLD is non-nil, also include defvars." (defvar cusver-new-version (format "%s.%s" emacs-major-version (1+ emacs-minor-version)) - "Version number that new defcustoms should have.") + "Version number that new `defcustom's should have.") (defun cusver-scan (file &optional old) "Scan FILE for `defcustom' calls. Return a list with elements of the form (VAR . VER), This means that FILE contains a defcustom for variable VAR, with a :version tag having value VER (may be nil). -If optional argument OLD is non-nil, also scan for defvars." +If optional argument OLD is non-nil, also scan for `defvar's." (let ((m (format "Scanning %s..." file)) (re (format "^[ \t]*\\((def%s\\)[ \t\n]" (if old "\\(custom\\|var\\)" "\\(custom\\|group\\)"))) @@ -530,7 +533,7 @@ If optional argument OLD is non-nil, also scan for defvars." (with-temp-buffer (insert-file-contents file) ;; FIXME we could theoretically be inside a string. - (while (re-search-forward re nil t) + (while (re-search-forward re nil :noerror) (goto-char (match-beginning 1)) (if (and (setq form (ignore-errors (read (current-buffer)))) (setq var (car-safe (cdr-safe form))) @@ -572,7 +575,7 @@ If optional argument OLD is non-nil, also scan for defvars." (define-button-type 'cusver-xref 'action #'cusver-goto-xref) (defun cusver-goto-xref (button) - "Jump to a lisp file for the BUTTON at point." + "Jump to a Lisp file for the BUTTON at point." (let ((file (button-get button 'file)) (var (button-get button 'var))) (if (not (file-readable-p file)) @@ -588,11 +591,13 @@ If optional argument OLD is non-nil, also scan for defvars." ;; TODO Check cus-start if something moved from C to Lisp. ;; TODO Handle renamed things with aliases to the old names. (defun cusver-check (newdir olddir version) - "Check that defcustoms have :version tags where needed. -NEWDIR is the current lisp/ directory, OLDDIR is that from the previous -release. A defcustom that is only in NEWDIR should have a :version -tag. We exclude cases where a defvar exists in OLDDIR, since -just converting a defvar to a defcustom does not require a :version bump. + "Check that `defcustom's have :version tags where needed. +NEWDIR is the current lisp/ directory, OLDDIR is that from the +previous release, VERSION is the new version number. A +`defcustom' that is only in NEWDIR should have a :version tag. +We exclude cases where a `defvar' exists in OLDDIR, since just +converting a `defvar' to a `defcustom' does not require +a :version bump. Note that a :version tag should also be added if the value of a defcustom changes (in a non-trivial way). This function does not check for that." @@ -602,20 +607,20 @@ changes (in a non-trivial way). This function does not check for that." (read-number "New version number: " (string-to-number cusver-new-version))))) (or (file-directory-p (setq newdir (expand-file-name newdir))) - (error "Directory `%s' not found" newdir)) + (user-error "Directory `%s' not found" newdir)) (or (file-directory-p (setq olddir (expand-file-name olddir))) - (error "Directory `%s' not found" olddir)) + (user-error "Directory `%s' not found" olddir)) (setq cusver-new-version version) - (let* ((newfiles (progn (message "Finding new files with defcustoms...") + (let* ((newfiles (progn (message "Finding new files with `defcustom's...") (cusver-find-files newdir))) - (oldfiles (progn (message "Finding old files with defcustoms...") + (oldfiles (progn (message "Finding old files with `defcustom's...") (cusver-find-files olddir t))) - (newcus (progn (message "Reading new defcustoms...") + (newcus (progn (message "Reading new `defcustom's...") (mapcar (lambda (file) (cons file (cusver-scan file))) newfiles))) oldcus result thisfile file) - (message "Reading old defcustoms...") + (message "Reading old `defcustom's...") (dolist (file oldfiles) (setq oldcus (append oldcus (cusver-scan file t)))) (setq oldcus (append oldcus (cusver-scan-cus-start @@ -640,7 +645,7 @@ changes (in a non-trivial way). This function does not check for that." (message "No missing :version tags") (pop-to-buffer "*cusver*") (erase-buffer) - (insert "These defcustoms might be missing :version tags:\n\n") + (insert "These `defcustom's might be missing :version tags:\n\n") (dolist (elem result) (let* ((str (file-relative-name (car elem) newdir)) (strlen (length str)))