emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110398: Handle group :version in cus


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110398: Handle group :version in cusver-check
Date: Sat, 06 Oct 2012 14:15:03 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110398
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Sat 2012-10-06 14:15:03 -0700
message:
  Handle group :version in cusver-check
  
  * admin/admin.el (cusver-new-version): New variable.
  (cusver-scan): Check if containing group has a :version.
  (cusver-check): Add VERSION argument.
modified:
  admin/ChangeLog
  admin/admin.el
=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog   2012-10-06 14:18:35 +0000
+++ b/admin/ChangeLog   2012-10-06 21:15:03 +0000
@@ -1,3 +1,9 @@
+2012-10-06  Glenn Morris  <address@hidden>
+
+       * admin.el (cusver-new-version): New variable.
+       (cusver-scan): Check if containing group has a :version.
+       (cusver-check): Add VERSION argument.
+
 2012-10-01  David Engster  <address@hidden>
 
        * grammars/bovine-grammar.el:

=== modified file 'admin/admin.el'
--- a/admin/admin.el    2012-09-27 06:45:38 +0000
+++ b/admin/admin.el    2012-10-06 21:15:03 +0000
@@ -442,8 +442,12 @@
                                     ))
                 "{}" "+"))
 
-;; TODO if a defgroup with a version tag, apply to all customs in that
-;; group (eg for new files).
+; FIXME Calculate default based on running emacs-version.
+(defvar cusver-new-version nil
+  "Version number that new defcustoms should have.")
+
+;; TODO do something about renamed variables with aliases to the old name?
+;; Scan old cus-start.el to find variables moved from C to lisp?
 (defun cusver-scan (file &optional old)
   "Scan FILE for `defcustom' calls.
 Return a list with elements of the form (VAR . VER),
@@ -452,8 +456,8 @@
 If optional argument OLD is non-nil, also scan for defvars."
   (let ((m (format "Scanning %s..." file))
        (re (format "^[ \t]*\\((def%s\\)[ \t\n]"
-                   (if old "\\(?:custom\\|var\\)" "custom")))
-        alist var ver form)
+                   (if old "\\(custom\\|var\\)" "\\(custom\\|group\\)")))
+        alist var ver form glist grp)
     (message "%s" m)
     (with-temp-buffer
       (insert-file-contents file)
@@ -461,11 +465,23 @@
       (while (re-search-forward re nil t)
         (goto-char (match-beginning 1))
         (if (and (setq form (ignore-errors (read (current-buffer))))
-                 (setq var (car-safe (cdr-safe form)))
+                (setq var (car-safe (cdr-safe form)))
                 ;; Exclude macros, eg (defcustom ,varname ...).
                 (symbolp var))
-            (setq ver (car (cdr-safe (memq :version form)))
-                  alist (cons (cons var ver) alist))
+           (progn
+             (setq ver (car (cdr-safe (memq :version form))))
+             (if (equal "group" (match-string 2))
+                 ;; Group :version could be old.
+                 (if (equal ver cusver-new-version)
+                     (setq glist (cons (cons var ver) glist)))
+               ;; If it specifies a group and the whole group has a
+               ;; version. use that.
+               (unless ver
+                 (setq grp (car (cdr-safe (memq :group form))))
+                 (and grp
+                      (setq grp (car (cdr-safe grp))) ; (quote foo) -> foo
+                      (setq ver (assq grp glist))))
+               (setq alist (cons (cons var ver) alist))))
           (if form (message "Malformed defcustom: `%s'" form)))))
     (message "%sdone" m)
     alist))
@@ -490,7 +506,7 @@
 ;; TODO handle renamed things with aliases to the old names.
 ;; What to do about new files?  Does everything in there need a :version,
 ;; or eg just the defgroup?
-(defun cusver-check (newdir olddir)
+(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
@@ -499,11 +515,12 @@
 
 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."
-  (interactive "DNew Lisp directory: \nDOld Lisp directory: ")
+  (interactive "DNew Lisp directory: \nDOld Lisp directory: \nsNew version 
number: ")
   (or (file-directory-p (setq newdir (expand-file-name newdir)))
       (error "Directory `%s' not found" newdir))
   (or (file-directory-p (setq olddir (expand-file-name olddir)))
       (error "Directory `%s' not found" olddir))
+  (setq cusver-new-version version)
   (let* ((newfiles (progn (message "Finding new files with defcustoms...")
                          (cusver-find-files newdir)))
         (oldfiles (progn (message "Finding old files with defcustoms...")


reply via email to

[Prev in Thread] Current Thread [Next in Thread]