aboutsummaryrefslogtreecommitdiffstats
path: root/admin/admin.el
diff options
context:
space:
mode:
authorXue Fuqiao2013-12-27 18:21:47 +0800
committerXue Fuqiao2013-12-27 18:21:47 +0800
commitfe6462ee7ce2ec04322674952ff3e97085a4db69 (patch)
tree50392157da6801fcf259a1357587820b754db0b6 /admin/admin.el
parent0f1d29342f29e666bb6abe4073a30b425a63d26c (diff)
downloademacs-fe6462ee7ce2ec04322674952ff3e97085a4db69.tar.gz
emacs-fe6462ee7ce2ec04322674952ff3e97085a4db69.zip
* 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'.
Diffstat (limited to 'admin/admin.el')
-rw-r--r--admin/admin.el51
1 files changed, 28 insertions, 23 deletions
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."
108 ;; in two places those commas are followed by space, in two other 108 ;; in two places those commas are followed by space, in two other
109 ;; places they are not. 109 ;; places they are not.
110 (let* ((version-components (append (split-string version "\\.") 110 (let* ((version-components (append (split-string version "\\.")
111 '("0" "0"))) 111 '("0" "0")))
112 (comma-version 112 (comma-version
113 (concat (car version-components) "," 113 (concat (car version-components) ","
114 (cadr version-components) "," 114 (cadr version-components) ","
@@ -198,7 +198,8 @@ Root must be the root of an Emacs source tree."
198;;; Various bits of magic for generating the web manuals 198;;; Various bits of magic for generating the web manuals
199 199
200(defun manual-misc-manuals (root) 200(defun manual-misc-manuals (root)
201 "Return doc/misc manuals as list of strings." 201 "Return doc/misc manuals as list of strings.
202ROOT should be the root of an Emacs source tree."
202 ;; Similar to `make -C doc/misc echo-info', but works if unconfigured, 203 ;; Similar to `make -C doc/misc echo-info', but works if unconfigured,
203 ;; and for INFO_TARGETS rather than INFO_INSTALL. 204 ;; and for INFO_TARGETS rather than INFO_INSTALL.
204 (with-temp-buffer 205 (with-temp-buffer
@@ -217,6 +218,7 @@ Root must be the root of an Emacs source tree."
217 218
218(defun make-manuals (root &optional type) 219(defun make-manuals (root &optional type)
219 "Generate the web manuals for the Emacs webpage. 220 "Generate the web manuals for the Emacs webpage.
221ROOT should be the root of an Emacs source tree.
220Interactively with a prefix argument, prompt for TYPE. 222Interactively with a prefix argument, prompt for TYPE.
221Optional argument TYPE is type of output (nil means all)." 223Optional argument TYPE is type of output (nil means all)."
222 (interactive (let ((root (read-directory-name "Emacs root directory: " 224 (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
332HTML 4.01 Transitional, and pulls in the gnu.org stylesheet using 334HTML 4.01 Transitional, and pulls in the gnu.org stylesheet using
333the @import directive." 335the @import directive."
334 (unless (file-exists-p texi-file) 336 (unless (file-exists-p texi-file)
335 (error "Manual file %s not found" texi-file)) 337 (user-error "Manual file %s not found" texi-file))
336 (make-directory dir t) 338 (make-directory dir t)
337 (call-process "makeinfo" nil nil nil 339 (call-process "makeinfo" nil nil nil
338 "-D" "WWW_GNU_ORG" 340 "-D" "WWW_GNU_ORG"
@@ -369,7 +371,7 @@ the @import directive."
369 (save-buffer)))))) 371 (save-buffer))))))
370 372
371(defun manual-pdf (texi-file dest) 373(defun manual-pdf (texi-file dest)
372 "Run texi2pdf on TEXI-FILE, emitting pdf output to DEST." 374 "Run texi2pdf on TEXI-FILE, emitting PDF output to DEST."
373 (make-directory (or (file-name-directory dest) ".") t) 375 (make-directory (or (file-name-directory dest) ".") t)
374 (let ((default-directory (file-name-directory texi-file))) 376 (let ((default-directory (file-name-directory texi-file)))
375 (call-process "texi2pdf" nil nil nil 377 (call-process "texi2pdf" nil nil nil
@@ -381,6 +383,7 @@ the @import directive."
381 (make-directory (or (file-name-directory dest) ".") t) 383 (make-directory (or (file-name-directory dest) ".") t)
382 (let ((dvi-dest (concat (file-name-sans-extension dest) ".dvi")) 384 (let ((dvi-dest (concat (file-name-sans-extension dest) ".dvi"))
383 (default-directory (file-name-directory texi-file))) 385 (default-directory (file-name-directory texi-file)))
386 ;; FIXME: Use `texi2dvi --ps'? --xfq
384 (call-process "texi2dvi" nil nil nil 387 (call-process "texi2dvi" nil nil nil
385 "-I" "../emacs" "-I" "../misc" 388 "-I" "../emacs" "-I" "../misc"
386 texi-file "-o" dvi-dest) 389 texi-file "-o" dvi-dest)
@@ -497,12 +500,12 @@ the @import directive."
497 (forward-line 1)))) 500 (forward-line 1))))
498 501
499 502
500;; Stuff to check new defcustoms got :version tags. 503;; Stuff to check new `defcustom's got :version tags.
501;; Adapted from check-declare.el. 504;; Adapted from check-declare.el.
502 505
503(defun cusver-find-files (root &optional old) 506(defun cusver-find-files (root &optional old)
504 "Find .el files beneath directory ROOT that contain defcustoms. 507 "Find .el files beneath directory ROOT that contain `defcustom's.
505If optional OLD is non-nil, also include defvars." 508If optional OLD is non-nil, also include `defvar's."
506 (process-lines find-program root 509 (process-lines find-program root
507 "-name" "*.el" 510 "-name" "*.el"
508 "-exec" grep-program 511 "-exec" grep-program
@@ -514,14 +517,14 @@ If optional OLD is non-nil, also include defvars."
514 517
515(defvar cusver-new-version (format "%s.%s" emacs-major-version 518(defvar cusver-new-version (format "%s.%s" emacs-major-version
516 (1+ emacs-minor-version)) 519 (1+ emacs-minor-version))
517 "Version number that new defcustoms should have.") 520 "Version number that new `defcustom's should have.")
518 521
519(defun cusver-scan (file &optional old) 522(defun cusver-scan (file &optional old)
520 "Scan FILE for `defcustom' calls. 523 "Scan FILE for `defcustom' calls.
521Return a list with elements of the form (VAR . VER), 524Return a list with elements of the form (VAR . VER),
522This means that FILE contains a defcustom for variable VAR, with 525This means that FILE contains a defcustom for variable VAR, with
523a :version tag having value VER (may be nil). 526a :version tag having value VER (may be nil).
524If optional argument OLD is non-nil, also scan for defvars." 527If optional argument OLD is non-nil, also scan for `defvar's."
525 (let ((m (format "Scanning %s..." file)) 528 (let ((m (format "Scanning %s..." file))
526 (re (format "^[ \t]*\\((def%s\\)[ \t\n]" 529 (re (format "^[ \t]*\\((def%s\\)[ \t\n]"
527 (if old "\\(custom\\|var\\)" "\\(custom\\|group\\)"))) 530 (if old "\\(custom\\|var\\)" "\\(custom\\|group\\)")))
@@ -530,7 +533,7 @@ If optional argument OLD is non-nil, also scan for defvars."
530 (with-temp-buffer 533 (with-temp-buffer
531 (insert-file-contents file) 534 (insert-file-contents file)
532 ;; FIXME we could theoretically be inside a string. 535 ;; FIXME we could theoretically be inside a string.
533 (while (re-search-forward re nil t) 536 (while (re-search-forward re nil :noerror)
534 (goto-char (match-beginning 1)) 537 (goto-char (match-beginning 1))
535 (if (and (setq form (ignore-errors (read (current-buffer)))) 538 (if (and (setq form (ignore-errors (read (current-buffer))))
536 (setq var (car-safe (cdr-safe form))) 539 (setq var (car-safe (cdr-safe form)))
@@ -572,7 +575,7 @@ If optional argument OLD is non-nil, also scan for defvars."
572(define-button-type 'cusver-xref 'action #'cusver-goto-xref) 575(define-button-type 'cusver-xref 'action #'cusver-goto-xref)
573 576
574(defun cusver-goto-xref (button) 577(defun cusver-goto-xref (button)
575 "Jump to a lisp file for the BUTTON at point." 578 "Jump to a Lisp file for the BUTTON at point."
576 (let ((file (button-get button 'file)) 579 (let ((file (button-get button 'file))
577 (var (button-get button 'var))) 580 (var (button-get button 'var)))
578 (if (not (file-readable-p file)) 581 (if (not (file-readable-p file))
@@ -588,11 +591,13 @@ If optional argument OLD is non-nil, also scan for defvars."
588;; TODO Check cus-start if something moved from C to Lisp. 591;; TODO Check cus-start if something moved from C to Lisp.
589;; TODO Handle renamed things with aliases to the old names. 592;; TODO Handle renamed things with aliases to the old names.
590(defun cusver-check (newdir olddir version) 593(defun cusver-check (newdir olddir version)
591 "Check that defcustoms have :version tags where needed. 594 "Check that `defcustom's have :version tags where needed.
592NEWDIR is the current lisp/ directory, OLDDIR is that from the previous 595NEWDIR is the current lisp/ directory, OLDDIR is that from the
593release. A defcustom that is only in NEWDIR should have a :version 596previous release, VERSION is the new version number. A
594tag. We exclude cases where a defvar exists in OLDDIR, since 597`defcustom' that is only in NEWDIR should have a :version tag.
595just converting a defvar to a defcustom does not require a :version bump. 598We exclude cases where a `defvar' exists in OLDDIR, since just
599converting a `defvar' to a `defcustom' does not require
600a :version bump.
596 601
597Note that a :version tag should also be added if the value of a defcustom 602Note that a :version tag should also be added if the value of a defcustom
598changes (in a non-trivial way). This function does not check for that." 603changes (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."
602 (read-number "New version number: " 607 (read-number "New version number: "
603 (string-to-number cusver-new-version))))) 608 (string-to-number cusver-new-version)))))
604 (or (file-directory-p (setq newdir (expand-file-name newdir))) 609 (or (file-directory-p (setq newdir (expand-file-name newdir)))
605 (error "Directory `%s' not found" newdir)) 610 (user-error "Directory `%s' not found" newdir))
606 (or (file-directory-p (setq olddir (expand-file-name olddir))) 611 (or (file-directory-p (setq olddir (expand-file-name olddir)))
607 (error "Directory `%s' not found" olddir)) 612 (user-error "Directory `%s' not found" olddir))
608 (setq cusver-new-version version) 613 (setq cusver-new-version version)
609 (let* ((newfiles (progn (message "Finding new files with defcustoms...") 614 (let* ((newfiles (progn (message "Finding new files with `defcustom's...")
610 (cusver-find-files newdir))) 615 (cusver-find-files newdir)))
611 (oldfiles (progn (message "Finding old files with defcustoms...") 616 (oldfiles (progn (message "Finding old files with `defcustom's...")
612 (cusver-find-files olddir t))) 617 (cusver-find-files olddir t)))
613 (newcus (progn (message "Reading new defcustoms...") 618 (newcus (progn (message "Reading new `defcustom's...")
614 (mapcar 619 (mapcar
615 (lambda (file) 620 (lambda (file)
616 (cons file (cusver-scan file))) newfiles))) 621 (cons file (cusver-scan file))) newfiles)))
617 oldcus result thisfile file) 622 oldcus result thisfile file)
618 (message "Reading old defcustoms...") 623 (message "Reading old `defcustom's...")
619 (dolist (file oldfiles) 624 (dolist (file oldfiles)
620 (setq oldcus (append oldcus (cusver-scan file t)))) 625 (setq oldcus (append oldcus (cusver-scan file t))))
621 (setq oldcus (append oldcus (cusver-scan-cus-start 626 (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."
640 (message "No missing :version tags") 645 (message "No missing :version tags")
641 (pop-to-buffer "*cusver*") 646 (pop-to-buffer "*cusver*")
642 (erase-buffer) 647 (erase-buffer)
643 (insert "These defcustoms might be missing :version tags:\n\n") 648 (insert "These `defcustom's might be missing :version tags:\n\n")
644 (dolist (elem result) 649 (dolist (elem result)
645 (let* ((str (file-relative-name (car elem) newdir)) 650 (let* ((str (file-relative-name (car elem) newdir))
646 (strlen (length str))) 651 (strlen (length str)))