aboutsummaryrefslogtreecommitdiffstats
path: root/admin/admin.el
diff options
context:
space:
mode:
authorGlenn Morris2012-10-09 00:00:23 -0700
committerGlenn Morris2012-10-09 00:00:23 -0700
commit2c35bdbb581c410b2e5562ee712d1cf170c82480 (patch)
treea6a8eb86fde16e6a9841f31d381d2e476d0234bf /admin/admin.el
parent10766e9eb2d56fe6f6d369b8127e3b8b4963547e (diff)
downloademacs-2c35bdbb581c410b2e5562ee712d1cf170c82480.tar.gz
emacs-2c35bdbb581c410b2e5562ee712d1cf170c82480.zip
Make cusver handle options moved from C to lisp
* admin/admin.el (cusver-scan-cus-start): New function. (cusver-check): Scan old cus-start.el.
Diffstat (limited to 'admin/admin.el')
-rw-r--r--admin/admin.el27
1 files changed, 20 insertions, 7 deletions
diff --git a/admin/admin.el b/admin/admin.el
index 3e3fbba7202..59d085b6405 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -446,8 +446,6 @@ If optional OLD is non-nil, also include defvars."
446 (1+ emacs-minor-version)) 446 (1+ emacs-minor-version))
447 "Version number that new defcustoms should have.") 447 "Version number that new defcustoms should have.")
448 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?
451(defun cusver-scan (file &optional old) 449(defun cusver-scan (file &optional old)
452 "Scan FILE for `defcustom' calls. 450 "Scan FILE for `defcustom' calls.
453Return a list with elements of the form (VAR . VER), 451Return a list with elements of the form (VAR . VER),
@@ -486,6 +484,21 @@ If optional argument OLD is non-nil, also scan for defvars."
486 (message "%sdone" m) 484 (message "%sdone" m)
487 alist)) 485 alist))
488 486
487(defun cusver-scan-cus-start (file)
488 "Scan cus-start.el and return an alist with elements (VAR . VER)."
489 (if (file-readable-p file)
490 (with-temp-buffer
491 (insert-file-contents file)
492 (when (search-forward "(let ((all '(" nil t)
493 (backward-char 1)
494 (let (var ver alist)
495 (dolist (elem (ignore-errors (read (current-buffer))))
496 (when (symbolp (setq var (car-safe elem)))
497 (or (stringp (setq ver (nth 3 elem)))
498 (setq ver nil))
499 (setq alist (cons (cons var ver) alist))))
500 alist)))))
501
489(define-button-type 'cusver-xref 'action #'cusver-goto-xref) 502(define-button-type 'cusver-xref 'action #'cusver-goto-xref)
490 503
491(defun cusver-goto-xref (button) 504(defun cusver-goto-xref (button)
@@ -501,11 +514,9 @@ If optional argument OLD is non-nil, also scan for defvars."
501 (pop-to-buffer (current-buffer)))))) 514 (pop-to-buffer (current-buffer))))))
502 515
503;; You should probably at least do a grep over the old directory 516;; You should probably at least do a grep over the old directory
504;; to check the results of this look sensible. Eg cus-start if 517;; to check the results of this look sensible.
505;; something moved from C to Lisp. 518;; TODO Check cus-start if something moved from C to Lisp.
506;; TODO handle renamed things with aliases to the old names. 519;; TODO Handle renamed things with aliases to the old names.
507;; What to do about new files? Does everything in there need a :version,
508;; or eg just the defgroup?
509(defun cusver-check (newdir olddir version) 520(defun cusver-check (newdir olddir version)
510 "Check that defcustoms have :version tags where needed. 521 "Check that defcustoms have :version tags where needed.
511NEWDIR is the current lisp/ directory, OLDDIR is that from the previous 522NEWDIR is the current lisp/ directory, OLDDIR is that from the previous
@@ -537,6 +548,8 @@ changes (in a non-trivial way). This function does not check for that."
537 (message "Reading old defcustoms...") 548 (message "Reading old defcustoms...")
538 (dolist (file oldfiles) 549 (dolist (file oldfiles)
539 (setq oldcus (append oldcus (cusver-scan file t)))) 550 (setq oldcus (append oldcus (cusver-scan file t))))
551 (setq oldcus (append oldcus (cusver-scan-cus-start
552 (expand-file-name "cus-start.el" olddir))))
540 ;; newcus has elements (FILE (VAR VER) ... ). 553 ;; newcus has elements (FILE (VAR VER) ... ).
541 ;; oldcus just (VAR . VER). 554 ;; oldcus just (VAR . VER).
542 (message "Checking for version tags...") 555 (message "Checking for version tags...")