aboutsummaryrefslogtreecommitdiffstats
path: root/admin/admin.el
diff options
context:
space:
mode:
Diffstat (limited to 'admin/admin.el')
-rw-r--r--admin/admin.el43
1 files changed, 34 insertions, 9 deletions
diff --git a/admin/admin.el b/admin/admin.el
index 862e5aed6c1..3e3fbba7202 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -129,8 +129,12 @@ Root must be the root of an Emacs source tree."
129 (rx (and "\"ProductVersion\"" (0+ space) ?, 129 (rx (and "\"ProductVersion\"" (0+ space) ?,
130 (0+ space) ?\" (submatch (1+ (in "0-9, "))) 130 (0+ space) ?\" (submatch (1+ (in "0-9, ")))
131 "\\0\""))) 131 "\\0\"")))
132 ;; Major version only.
132 (when (string-match "\\([0-9]\\{2,\\}\\)" version) 133 (when (string-match "\\([0-9]\\{2,\\}\\)" version)
133 (setq version (match-string 1 version)) 134 (setq version (match-string 1 version))
135 (set-version-in-file root "src/msdos.c" version
136 (rx (and "Vwindow_system_version" (1+ not-newline)
137 ?\( (submatch (1+ (in "0-9"))) ?\))))
134 (set-version-in-file root "etc/refcards/ru-refcard.tex" version 138 (set-version-in-file root "etc/refcards/ru-refcard.tex" version
135 "\\\\newcommand{\\\\versionemacs}\\[0\\]\ 139 "\\\\newcommand{\\\\versionemacs}\\[0\\]\
136{\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs") 140{\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs")
@@ -438,8 +442,12 @@ If optional OLD is non-nil, also include defvars."
438 )) 442 ))
439 "{}" "+")) 443 "{}" "+"))
440 444
441;; TODO if a defgroup with a version tag, apply to all customs in that 445(defvar cusver-new-version (format "%s.%s" emacs-major-version
442;; group (eg for new files). 446 (1+ emacs-minor-version))
447 "Version number that new defcustoms should have.")
448
449;; TODO do something about renamed variables with aliases to the old name?
450;; Scan old cus-start.el to find variables moved from C to lisp?
443(defun cusver-scan (file &optional old) 451(defun cusver-scan (file &optional old)
444 "Scan FILE for `defcustom' calls. 452 "Scan FILE for `defcustom' calls.
445Return a list with elements of the form (VAR . VER), 453Return a list with elements of the form (VAR . VER),
@@ -448,8 +456,8 @@ a :version tag having value VER (may be nil).
448If optional argument OLD is non-nil, also scan for defvars." 456If optional argument OLD is non-nil, also scan for defvars."
449 (let ((m (format "Scanning %s..." file)) 457 (let ((m (format "Scanning %s..." file))
450 (re (format "^[ \t]*\\((def%s\\)[ \t\n]" 458 (re (format "^[ \t]*\\((def%s\\)[ \t\n]"
451 (if old "\\(?:custom\\|var\\)" "custom"))) 459 (if old "\\(custom\\|var\\)" "\\(custom\\|group\\)")))
452 alist var ver form) 460 alist var ver form glist grp)
453 (message "%s" m) 461 (message "%s" m)
454 (with-temp-buffer 462 (with-temp-buffer
455 (insert-file-contents file) 463 (insert-file-contents file)
@@ -457,11 +465,23 @@ If optional argument OLD is non-nil, also scan for defvars."
457 (while (re-search-forward re nil t) 465 (while (re-search-forward re nil t)
458 (goto-char (match-beginning 1)) 466 (goto-char (match-beginning 1))
459 (if (and (setq form (ignore-errors (read (current-buffer)))) 467 (if (and (setq form (ignore-errors (read (current-buffer))))
460 (setq var (car-safe (cdr-safe form))) 468 (setq var (car-safe (cdr-safe form)))
461 ;; Exclude macros, eg (defcustom ,varname ...). 469 ;; Exclude macros, eg (defcustom ,varname ...).
462 (symbolp var)) 470 (symbolp var))
463 (setq ver (car (cdr-safe (memq :version form))) 471 (progn
464 alist (cons (cons var ver) alist)) 472 (setq ver (car (cdr-safe (memq :version form))))
473 (if (equal "group" (match-string 2))
474 ;; Group :version could be old.
475 (if (equal ver cusver-new-version)
476 (setq glist (cons (cons var ver) glist)))
477 ;; If it specifies a group and the whole group has a
478 ;; version. use that.
479 (unless ver
480 (setq grp (car (cdr-safe (memq :group form))))
481 (and grp
482 (setq grp (car (cdr-safe grp))) ; (quote foo) -> foo
483 (setq ver (assq grp glist))))
484 (setq alist (cons (cons var ver) alist))))
465 (if form (message "Malformed defcustom: `%s'" form))))) 485 (if form (message "Malformed defcustom: `%s'" form)))))
466 (message "%sdone" m) 486 (message "%sdone" m)
467 alist)) 487 alist))
@@ -486,7 +506,7 @@ If optional argument OLD is non-nil, also scan for defvars."
486;; TODO handle renamed things with aliases to the old names. 506;; TODO handle renamed things with aliases to the old names.
487;; What to do about new files? Does everything in there need a :version, 507;; What to do about new files? Does everything in there need a :version,
488;; or eg just the defgroup? 508;; or eg just the defgroup?
489(defun cusver-check (newdir olddir) 509(defun cusver-check (newdir olddir version)
490 "Check that defcustoms have :version tags where needed. 510 "Check that defcustoms have :version tags where needed.
491NEWDIR is the current lisp/ directory, OLDDIR is that from the previous 511NEWDIR is the current lisp/ directory, OLDDIR is that from the previous
492release. A defcustom that is only in NEWDIR should have a :version 512release. A defcustom that is only in NEWDIR should have a :version
@@ -495,11 +515,16 @@ just converting a defvar to a defcustom does not require a :version bump.
495 515
496Note that a :version tag should also be added if the value of a defcustom 516Note that a :version tag should also be added if the value of a defcustom
497changes (in a non-trivial way). This function does not check for that." 517changes (in a non-trivial way). This function does not check for that."
498 (interactive "DNew Lisp directory: \nDOld Lisp directory: ") 518 (interactive (list (read-directory-name "New Lisp directory: ")
519 (read-directory-name "Old Lisp directory: ")
520 (number-to-string
521 (read-number "New version number: "
522 (string-to-number cusver-new-version)))))
499 (or (file-directory-p (setq newdir (expand-file-name newdir))) 523 (or (file-directory-p (setq newdir (expand-file-name newdir)))
500 (error "Directory `%s' not found" newdir)) 524 (error "Directory `%s' not found" newdir))
501 (or (file-directory-p (setq olddir (expand-file-name olddir))) 525 (or (file-directory-p (setq olddir (expand-file-name olddir)))
502 (error "Directory `%s' not found" olddir)) 526 (error "Directory `%s' not found" olddir))
527 (setq cusver-new-version version)
503 (let* ((newfiles (progn (message "Finding new files with defcustoms...") 528 (let* ((newfiles (progn (message "Finding new files with defcustoms...")
504 (cusver-find-files newdir))) 529 (cusver-find-files newdir)))
505 (oldfiles (progn (message "Finding old files with defcustoms...") 530 (oldfiles (progn (message "Finding old files with defcustoms...")