Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 102978. ------------------------------------------------------------ revno: 102978 author: Gnus developers committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2011-01-25 23:51:40 +0000 message: Merge changes made in Gnus trunk. mm-view.el (mm-display-shell-script-inline): Fix typo in docstring. (mm-display-javascript-inline): New function. mm-decode.el (mm-inline-media-tests): Add application/javascript viewing function. nnimap.el (nnimap-open-connection-1): Store the actual stream type used. (nnimap-login): Prefer plain LOGIN if it's enabled (since it requires fewer round trips than CRAM-MD5, and it's less likely to be buggy), and we're using an encrypted connection. proto-stream.el: Alter the interface functions to also return the actual stream type used: network or tls. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-01-25 10:36:00 +0000 +++ lisp/gnus/ChangeLog 2011-01-25 23:51:40 +0000 @@ -1,3 +1,22 @@ +2011-01-25 Lars Ingebrigtsen + + * nnimap.el (nnimap-open-connection-1): Store the actual stream type + used. + (nnimap-login): Prefer plain LOGIN if it's enabled (since it requires + fewer round trips than CRAM-MD5, and it's less likely to be buggy), and + we're using an encrypted connection. + + * proto-stream.el: Alter the interface functions to also return the + actual stream type used: network or tls. + +2011-01-25 Julien Danjou + + * mm-view.el (mm-display-shell-script-inline): Fix typo in docstring. + (mm-display-javascript-inline): New function. + + * mm-decode.el (mm-inline-media-tests): Add application/javascript + viewing function. + 2011-01-25 Katsumi Yamaoka * shr.el (shr-expand-newlines): Fix variable name. === modified file 'lisp/gnus/mm-decode.el' --- lisp/gnus/mm-decode.el 2011-01-25 04:08:28 +0000 +++ lisp/gnus/mm-decode.el 2011-01-25 23:51:40 +0000 @@ -239,6 +239,7 @@ ("application/x-shellscript" mm-display-shell-script-inline identity) ("application/x-sh" mm-display-shell-script-inline identity) ("text/x-sh" mm-display-shell-script-inline identity) + ("application/javascript" mm-display-javascript-inline identity) ("text/dns" mm-display-dns-inline identity) ("text/x-org" mm-display-org-inline identity) ("text/html" === modified file 'lisp/gnus/mm-view.el' --- lisp/gnus/mm-view.el 2011-01-25 04:08:28 +0000 +++ lisp/gnus/mm-view.el 2011-01-25 23:51:40 +0000 @@ -636,9 +636,13 @@ (mm-display-inline-fontify handle 'org-mode)) (defun mm-display-shell-script-inline (handle) - "Show an shell script from HANDLE inline." + "Show a shell script from HANDLE inline." (mm-display-inline-fontify handle 'shell-script-mode)) +(defun mm-display-javascript-inline (handle) + "Show JavsScript code from HANDLE inline." + (mm-display-inline-fontify handle 'javascript-mode)) + ;; id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) ;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } (defvar mm-pkcs7-signed-magic === modified file 'lisp/gnus/nnimap.el' --- lisp/gnus/nnimap.el 2011-01-25 04:08:28 +0000 +++ lisp/gnus/nnimap.el 2011-01-25 23:51:40 +0000 @@ -124,7 +124,7 @@ (defstruct nnimap group process commands capabilities select-result newlinep server - last-command-time greeting examined) + last-command-time greeting examined stream-type) (defvar nnimap-object nil) @@ -350,7 +350,7 @@ login-result credentials) (when nnimap-server-port (setq ports (append ports (list nnimap-server-port)))) - (destructuring-bind (stream greeting capabilities) + (destructuring-bind (stream greeting capabilities stream-type) (open-protocol-stream "*nnimap*" (current-buffer) nnimap-address (car (last ports)) :type nnimap-stream @@ -362,6 +362,7 @@ (when (gnus-string-match-p "STARTTLS" capabilities) "1 STARTTLS\r\n"))) (setf (nnimap-process nnimap-object) stream) + (setf (nnimap-stream-type nnimap-object) stream-type) (if (not stream) (progn (nnheader-report 'nnimap "Unable to contact %s:%s via %s" @@ -411,6 +412,12 @@ (defun nnimap-login (user password) (cond + ;; Prefer plain LOGIN if it's enabled (since it requires fewer + ;; round trips than CRAM-MD5, and it's less likely to be buggy), + ;; and we're using an encrypted connection. + ((and (not (nnimap-capability "LOGINDISABLED")) + (eq (nnimap-stream-type nnimap-object) 'tls)) + (nnimap-command "LOGIN %S %S" user password)) ((nnimap-capability "AUTH=CRAM-MD5") (erase-buffer) (let ((sequence (nnimap-send-command "AUTHENTICATE CRAM-MD5")) === modified file 'lisp/gnus/proto-stream.el' --- lisp/gnus/proto-stream.el 2011-01-25 04:08:28 +0000 +++ lisp/gnus/proto-stream.el 2011-01-25 23:51:40 +0000 @@ -105,13 +105,15 @@ (funcall (intern (format "proto-stream-open-%s" type) obarray) name buffer host service parameters))) (if (null open-result) - (list nil nil nil) - (destructuring-bind (stream greeting capabilities) open-result + (list nil nil nil type) + (let ((stream (car open-result))) (list (and stream (memq (process-status stream) '(open run)) stream) - greeting capabilities)))))) + (nth 1 open-result) + (nth 2 open-result) + (nth 3 open-result))))))) (defun proto-stream-open-network-only (name buffer host service parameters) (let ((start (with-current-buffer buffer (point))) @@ -119,7 +121,8 @@ (list stream (proto-stream-get-response stream start (proto-stream-eoc parameters)) - nil))) + nil + 'network))) (defun proto-stream-open-network (name buffer host service parameters) (let* ((start (with-current-buffer buffer (point))) @@ -130,7 +133,7 @@ (greeting (proto-stream-get-response stream start eoc)) success) (if (not capability-command) - (list stream greeting nil) + (list stream greeting nil 'network) (let* ((capabilities (proto-stream-command stream capability-command eoc)) (starttls-command @@ -148,7 +151,7 @@ (delete-process stream) nil) ;; Otherwise, just return this plain network connection. - (list stream greeting capabilities))) + (list stream greeting capabilities 'network))) ;; We have some kind of STARTTLS support, so we try to ;; upgrade the connection opportunistically. ((or (fboundp 'open-gnutls-stream) @@ -176,7 +179,7 @@ (progn (delete-process stream) nil) - (list stream greeting capabilities))) + (list stream greeting capabilities 'network))) ;; The server said it was OK to start doing STARTTLS negotiations. (if (fboundp 'open-gnutls-stream) (gnutls-negotiate stream nil) @@ -193,7 +196,7 @@ ;; Re-get the capabilities, since they may have changed ;; after switching to TLS. (list stream greeting - (proto-stream-command stream capability-command eoc)))) + (proto-stream-command stream capability-command eoc) 'tls))) ;; We don't have STARTTLS support available, but the caller ;; requested a STARTTLS connection, so we give up. ((eq (cadr (memq :type parameters)) 'starttls) @@ -201,7 +204,7 @@ nil) ;; Fall back on using a plain network stream. (t - (list stream greeting capabilities))))))) + (list stream greeting capabilities 'network))))))) (defun proto-stream-command (stream command eoc) (let ((start (with-current-buffer (process-buffer stream) (point-max)))) @@ -242,7 +245,7 @@ (when (re-search-forward (proto-stream-eoc parameters) nil t) (goto-char (match-beginning 0)) (delete-region (point-min) (line-beginning-position)))) - (proto-stream-capability-open start stream parameters))))) + (proto-stream-capability-open start stream parameters 'tls))))) (defun proto-stream-open-shell (name buffer host service parameters) (proto-stream-capability-open @@ -255,16 +258,17 @@ (format-spec-make ?s host ?p service)))) - parameters)) + parameters 'network)) -(defun proto-stream-capability-open (start stream parameters) +(defun proto-stream-capability-open (start stream parameters stream-type) (let ((capability-command (cadr (memq :capability-command parameters))) (greeting (proto-stream-get-response stream start (proto-stream-eoc parameters)))) (list stream greeting (and capability-command (proto-stream-command - stream capability-command (proto-stream-eoc parameters)))))) + stream capability-command (proto-stream-eoc parameters))) + stream-type))) (defun proto-stream-eoc (parameters) (or (cadr (memq :end-of-command parameters)) ------------------------------------------------------------ revno: 102977 committer: Glenn Morris branch nick: trunk timestamp: Tue 2011-01-25 09:41:28 -0800 message: Undo part of previous copyright.el change. * lisp/emacs-lisp/copyright.el (copyright-update-directory): Undo part of previous change - don't find files literally, we need comment-start-skip, etc. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-25 16:01:53 +0000 +++ lisp/ChangeLog 2011-01-25 17:41:28 +0000 @@ -15,7 +15,7 @@ Do not mess with the fill-prefix. Do not call copyright-update. (copyright-update-directory): Optionally, fix years rather than update. - Skip directories. Find files literally, with only safe local vars. + Skip directories. Find files with only safe local vars. 2011-01-25 Stefan Monnier === modified file 'lisp/emacs-lisp/copyright.el' --- lisp/emacs-lisp/copyright.el 2011-01-25 08:36:34 +0000 +++ lisp/emacs-lisp/copyright.el 2011-01-25 17:41:28 +0000 @@ -363,7 +363,7 @@ (dolist (file (directory-files directory t match nil)) (unless (file-directory-p file) (message "Updating file `%s'" file) - (find-file-literally file) + (find-file file) (let ((inhibit-read-only t) (enable-local-variables :safe) copyright-query) ------------------------------------------------------------ revno: 102976 committer: Sam Steingold branch nick: trunk timestamp: Tue 2011-01-25 11:01:53 -0500 message: * lisp/vc/vc-svn.el (vc-svn-diff): Use `diff-command' instead of the literal "diff" (important for windows-nt). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-25 08:36:34 +0000 +++ lisp/ChangeLog 2011-01-25 16:01:53 +0000 @@ -1,3 +1,8 @@ +2011-01-25 Sam Steingold + + * vc/vc-svn.el (vc-svn-diff): Use `diff-command' instead of the + literal "diff" (important for windows-nt). + 2011-01-25 Glenn Morris * emacs-lisp/copyright.el (copyright-at-end-flag) === modified file 'lisp/vc/vc-svn.el' --- lisp/vc/vc-svn.el 2011-01-25 04:08:28 +0000 +++ lisp/vc/vc-svn.el 2011-01-25 16:01:53 +0000 @@ -72,9 +72,9 @@ t ;`svn' doesn't support common args like -c or -b. "String or list of strings specifying extra switches for svn diff under VC. If nil, use the value of `vc-diff-switches' (or `diff-switches'), -together with \"-x --diff-cmd=diff\" (since svn diff does not -support the default \"-c\" value of `diff-switches'). If you -want to force an empty list of arguments, use t." +together with \"-x --diff-cmd=\"`diff-command' (since 'svn diff' +does not support the default \"-c\" value of `diff-switches'). +If you want to force an empty list of arguments, use t." :type '(choice (const :tag "Unspecified" nil) (const :tag "None" t) (string :tag "Argument String") @@ -523,7 +523,7 @@ (let* ((switches (if vc-svn-diff-switches (vc-switches 'SVN 'diff) - (list "--diff-cmd=diff" "-x" + (list (concat "--diff-cmd=" diff-command) "-x" (mapconcat 'identity (vc-switches nil 'diff) " ")))) (async (and (not vc-disable-async-diff) (vc-stay-local-p files 'SVN) ------------------------------------------------------------ revno: 102975 committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2011-01-25 10:36:00 +0000 message: shr.el (shr-expand-newlines): Fix variable name. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-01-25 08:42:32 +0000 +++ lisp/gnus/ChangeLog 2011-01-25 10:36:00 +0000 @@ -1,3 +1,7 @@ +2011-01-25 Katsumi Yamaoka + + * shr.el (shr-expand-newlines): Fix variable name. + 2011-01-25 Lars Ingebrigtsen * shr.el (shr-expand-newlines): Make nested boxes work. === modified file 'lisp/gnus/shr.el' --- lisp/gnus/shr.el 2011-01-25 08:42:32 +0000 +++ lisp/gnus/shr.el 2011-01-25 10:36:00 +0000 @@ -663,23 +663,23 @@ (goto-char (point-min)) (while (not (eobp)) (end-of-line) - (when (and (< (setq current-column (current-column)) width) - (< (setq current-column (shr-previous-newline-padding-width - current-column)) + (when (and (< (setq column (current-column)) width) + (< (setq column (shr-previous-newline-padding-width column)) width)) (let ((overlay (make-overlay (point) (1+ (point))))) (overlay-put overlay 'before-string (concat (mapconcat (lambda (overlay) - (let ((string (getf (overlay-properties overlay) 'before-string))) + (let ((string (getf (overlay-properties overlay) + 'before-string))) (if (not string) "" (overlay-put overlay 'before-string "") string))) (overlays-at (point)) "") - (propertize (make-string (- width current-column) ? ) + (propertize (make-string (- width column) ? ) 'face (list :background color)))))) (forward-line 1))))) ------------------------------------------------------------ revno: 102974 author: Lars Ingebrigtsen committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2011-01-25 08:42:32 +0000 message: shr.el (shr-expand-newlines): Make nested boxes work. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-01-25 04:08:28 +0000 +++ lisp/gnus/ChangeLog 2011-01-25 08:42:32 +0000 @@ -1,3 +1,7 @@ +2011-01-25 Lars Ingebrigtsen + + * shr.el (shr-expand-newlines): Make nested boxes work. + 2011-01-24 Lars Ingebrigtsen * shr.el (shr-expand-newlines): Proof of concept implemantation of boxy === modified file 'lisp/gnus/shr.el' --- lisp/gnus/shr.el 2011-01-25 04:08:28 +0000 +++ lisp/gnus/shr.el 2011-01-25 08:42:32 +0000 @@ -648,6 +648,15 @@ (defun shr-expand-newlines (start end color) (save-restriction + ;; Skip past all white space at the start and ends. + (goto-char start) + (skip-chars-forward " \t\n") + (beginning-of-line) + (setq start (point)) + (goto-char end) + (skip-chars-backward " \t\n") + (forward-line 1) + (setq end (point)) (narrow-to-region start end) (let ((width (shr-natural-width)) column) @@ -655,13 +664,36 @@ (while (not (eobp)) (end-of-line) (when (and (< (setq current-column (current-column)) width) - (not (overlays-at (point)))) + (< (setq current-column (shr-previous-newline-padding-width + current-column)) + width)) (let ((overlay (make-overlay (point) (1+ (point))))) (overlay-put overlay 'before-string - (propertize (make-string (- width current-column) ? ) - 'face (list :background color))))) + (concat + (mapconcat + (lambda (overlay) + (let ((string (getf (overlay-properties overlay) 'before-string))) + (if (not string) + "" + (overlay-put overlay 'before-string "") + string))) + (overlays-at (point)) + "") + (propertize (make-string (- width current-column) ? ) + 'face (list :background color)))))) (forward-line 1))))) +(defun shr-previous-newline-padding-width (width) + (let ((overlays (overlays-at (point))) + (previous-width 0)) + (if (null overlays) + width + (dolist (overlay overlays) + (setq previous-width + (+ previous-width + (length (getf (overlay-properties overlay) 'before-string))))) + (+ width previous-width)))) + (defun shr-put-color-1 (start end type color) (let* ((old-props (get-text-property start 'face)) (do-put (not (memq type old-props))) ------------------------------------------------------------ revno: 102973 committer: Glenn Morris branch nick: trunk timestamp: Tue 2011-01-25 00:36:34 -0800 message: copyright.el updates. * lisp/emacs-lisp/copyright.el (copyright-at-end-flag) (copyright-names-regexp): Add safety properties. (copyright-year-ranges): New option. (copyright-find-end): New function, split from copyright-update-year. (copyright-update-year): Use copyright-find-end. (copyright-fix-years): Optionally, convert years to ranges. Handle years continued over comment lines. Do not mess with the fill-prefix. Do not call copyright-update. (copyright-update-directory): Optionally, fix years rather than update. Skip directories. Find files literally, with only safe local vars. * etc/NEWS: Mention copyright-fix-years and ranges. diff: === modified file 'etc/NEWS' --- etc/NEWS 2011-01-25 04:08:28 +0000 +++ etc/NEWS 2011-01-25 08:36:34 +0000 @@ -607,6 +607,11 @@ **** Currently supported by Bzr. +** Miscellaneous + +--- +*** `copyright-fix-years' can optionally convert consecutive years to ranges. + * New Modes and Packages in Emacs 24.1 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-25 04:08:28 +0000 +++ lisp/ChangeLog 2011-01-25 08:36:34 +0000 @@ -1,3 +1,17 @@ +2011-01-25 Glenn Morris + + * emacs-lisp/copyright.el (copyright-at-end-flag) + (copyright-names-regexp): Add safety properties. + (copyright-year-ranges): New option. + (copyright-find-end): New function, split from copyright-update-year. + (copyright-update-year): Use copyright-find-end. + (copyright-fix-years): Optionally, convert years to ranges. + Handle years continued over comment lines. + Do not mess with the fill-prefix. + Do not call copyright-update. + (copyright-update-directory): Optionally, fix years rather than update. + Skip directories. Find files literally, with only safe local vars. + 2011-01-25 Stefan Monnier * files.el (file-name-non-special): Only change buffer-file-name after === modified file 'lisp/emacs-lisp/copyright.el' --- lisp/emacs-lisp/copyright.el 2011-01-25 04:08:28 +0000 +++ lisp/emacs-lisp/copyright.el 2011-01-25 08:36:34 +0000 @@ -1,7 +1,6 @@ ;;; copyright.el --- update the copyright notice in current buffer -;; Copyright (C) 1991-1995, 1998, 2001-2011 -;; Free Software Foundation, Inc. +;; Copyright (C) 1991-1995, 1998, 2001-2011 Free Software Foundation, Inc. ;; Author: Daniel Pfeiffer ;; Keywords: maint, tools @@ -47,6 +46,7 @@ :group 'copyright :type 'boolean :version "23.1") +;;;###autoload(put 'copyright-at-end-flag 'safe-local-variable 'booleanp) (defcustom copyright-regexp "\\(©\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\ @@ -66,6 +66,11 @@ :group 'copyright :type 'regexp) +;; The worst that can happen is a malicious regexp that overflows in +;; the regexp matcher, a minor nuisance. It's a pain to be always +;; prompted if you want to put this in a dir-locals.el. +;;;###autoload(put 'copyright-names-regexp 'safe-local-variable 'stringp) + (defcustom copyright-years-regexp "\\(\\s *\\)\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)" "Match additional copyright notice years. @@ -73,6 +78,19 @@ :group 'copyright :type 'regexp) +;; See "Copyright Notices" in maintain.info. +;; TODO? 'end only for ranges at the end, other for all ranges. +;; Minimum limit on the size of a range? +(defcustom copyright-year-ranges nil + "Non-nil if individual consecutive years should be replaced with a range. +For example: 2005, 2006, 2007, 2008 might be replaced with 2005-2008. +If you use ranges, you should add an explanatory note in a README file. +The function `copyright-fix-year' respects this variable." + :group 'copyright + :type 'boolean + :version "24.1") + +;;;###autoload(put 'copyright-year-ranges 'safe-local-variable 'booleanp) (defcustom copyright-query 'function "If non-nil, ask user before changing copyright. @@ -139,11 +157,10 @@ ;; such an error is very inconvenient for the user. (error (message "Can't update copyright: %s" err) nil))) -(defun copyright-update-year (replace noquery) - ;; This uses the match-data from copyright-find-copyright. - (goto-char (match-end 1)) - ;; If the years are continued onto multiple lines - ;; that are marked as comments, skip to the end of the years anyway. +(defun copyright-find-end () + "Possibly adjust the search performed by `copyright-find-copyright'. +If the years continue onto multiple lines that are marked as comments, +skips to the end of all the years." (while (save-excursion (and (eq (following-char) ?,) (progn (forward-char 1) t) @@ -158,8 +175,12 @@ (re-search-forward comment-start-skip) ;; (2) Need the extra \\( \\) so that the years are subexp 3, as ;; they are at note (1) above. - (re-search-forward (format "\\(%s\\)" copyright-years-regexp))) + (re-search-forward (format "\\(%s\\)" copyright-years-regexp)))) +(defun copyright-update-year (replace noquery) + ;; This uses the match-data from copyright-find-copyright/end. + (goto-char (match-end 1)) + (copyright-find-end) ;; Note that `current-time-string' isn't locale-sensitive. (setq copyright-current-year (substring (current-time-string) -4)) (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3)) @@ -217,6 +238,7 @@ (save-restriction ;; If names-regexp doesn't match, we should not mess with ;; the years _or_ the GPL version. + ;; TODO there may be multiple copyrights we should update. (when (copyright-find-copyright) (copyright-update-year arg noquery) (goto-char (copyright-start-point)) @@ -246,42 +268,78 @@ nil)) -;; FIXME should be within 50 years of present (cf calendar). +;; FIXME heuristic should be within 50 years of present (cf calendar). ;;;###autoload (defun copyright-fix-years () "Convert 2 digit years to 4 digit years. -Uses heuristic: year >= 50 means 19xx, < 50 means 20xx." +Uses heuristic: year >= 50 means 19xx, < 50 means 20xx. +If `copyright-year-ranges' (which see) is non-nil, also +independently replaces consecutive years with a range." (interactive) + ;; TODO there may be multiple copyrights we should fix. (if (copyright-find-copyright) - (let ((s (match-beginning 2)) - (e (copy-marker (1+ (match-end 2)))) + (let ((s (match-beginning 3)) (p (make-marker)) - last) + ;; Not line-beg-pos, so we don't mess up leading whitespace. + (copystart (match-beginning 0)) + e last sep year prev-year first-year range-start range-end) + ;; In case years are continued over multiple, commented lines. + (goto-char (match-end 1)) + (copyright-find-end) + (setq e (copy-marker (1+ (match-end 3)))) (goto-char s) (while (re-search-forward "[0-9]+" e t) (set-marker p (point)) (goto-char (match-beginning 0)) - (let ((sep (char-before)) - (year (string-to-number (match-string 0)))) - (when (and sep - (/= (char-syntax sep) ?\s) - (/= sep ?-)) - (insert " ")) - (when (< year 100) - (insert (if (>= year 50) "19" "20")))) + (setq year (string-to-number (match-string 0))) + (and (setq sep (char-before)) + (/= (char-syntax sep) ?\s) + (/= sep ?-) + (insert " ")) + (when (< year 100) + (insert (if (>= year 50) "19" "20")) + (setq year (+ year (if (>= year 50) 1900 2000)))) (goto-char p) - (setq last p)) + (when copyright-year-ranges + ;; If the previous thing was a range, don't try to tack more on. + ;; Ie not 2000-2005 -> 2000-2005-2007 + ;; TODO should merge into existing range if possible. + (if (eq sep ?-) + (setq prev-year nil + year nil) + (if (and prev-year (= year (1+ prev-year))) + (setq range-end (point)) + (when (and first-year prev-year + (> prev-year first-year)) + (goto-char range-end) + (delete-region range-start range-end) + (insert (format "-%d" prev-year)) + (goto-char p)) + (setq first-year year + range-start (point))))) + (setq prev-year year + last p)) (when last + (when (and copyright-year-ranges + first-year prev-year + (> prev-year first-year)) + (goto-char range-end) + (delete-region range-start range-end) + (insert (format "-%d" prev-year))) (goto-char last) ;; Don't mess up whitespace after the years. (skip-chars-backward " \t") - (save-restriction - (narrow-to-region (copyright-start-point) (point)) - (let ((fill-prefix " ")) - (fill-region s last)))) + (save-restriction + (narrow-to-region copystart (point)) + ;; This is clearly wrong, eg what about comment markers? + ;;; (let ((fill-prefix " ")) + ;; TODO do not break copyright owner over lines. + (fill-region (point-min) (point-max)))) (set-marker e nil) - (set-marker p nil) - (copyright-update nil t)) + (set-marker p nil)) + ;; Simply reformatting the years is not copyrightable, so it does + ;; not seem right to call this. Also it messes with ranges. +;;; (copyright-update nil t)) (message "No copyright message"))) ;;;###autoload @@ -296,17 +354,24 @@ (message "Copyright extends beyond `copyright-limit' and won't be updated automatically.")) comment-end \n) +;; TODO: recurse, exclude COPYING etc. ;;;###autoload -(defun copyright-update-directory (directory match) - "Update copyright notice for all files in DIRECTORY matching MATCH." +(defun copyright-update-directory (directory match &optional fix) + "Update copyright notice for all files in DIRECTORY matching MATCH. +If FIX is non-nil, run `copyright-fix-years' instead." (interactive "DDirectory: \nMFilenames matching (regexp): ") (dolist (file (directory-files directory t match nil)) - (message "Updating file `%s'" file) - (find-file file) - (let ((copyright-query nil)) - (copyright-update)) - (save-buffer) - (kill-buffer (current-buffer)))) + (unless (file-directory-p file) + (message "Updating file `%s'" file) + (find-file-literally file) + (let ((inhibit-read-only t) + (enable-local-variables :safe) + copyright-query) + (if fix + (copyright-fix-years) + (copyright-update))) + (save-buffer) + (kill-buffer (current-buffer))))) (provide 'copyright) ------------------------------------------------------------ revno: 102972 committer: Glenn Morris branch nick: trunk timestamp: Mon 2011-01-24 21:10:02 -0800 message: Make it easier to control which revisions bzrmerge might skip. * admin/bzrmerge.el (bzrmerge-skip-regexp): New variable. (bzrmerge-missing): Use it. diff: === modified file 'admin/ChangeLog' --- admin/ChangeLog 2011-01-25 04:08:28 +0000 +++ admin/ChangeLog 2011-01-25 05:10:02 +0000 @@ -1,3 +1,8 @@ +2011-01-25 Glenn Morris + + * bzrmerge.el (bzrmerge-skip-regexp): New variable. + (bzrmerge-missing): Use it. + 2011-01-19 Paul Eggert * make-tarball.txt: Suggest 'autoreconf -I m4 --force' === modified file 'admin/bzrmerge.el' --- admin/bzrmerge.el 2011-01-25 04:08:28 +0000 +++ admin/bzrmerge.el 2011-01-25 05:10:02 +0000 @@ -27,6 +27,11 @@ (eval-when-compile (require 'cl)) ; assert +(defvar bzrmerge-skip-regexp + "back[- ]?port\\|merge\\|sync\\|re-?generate\\|bump version" + "Regexp matching logs of revisions that might be skipped. +`bzrmerge-missing' will ask you if it should skip any matches.") + (defun bzrmerge-merges () "Return the list of already merged (not yet committed) revisions. The list returned is sorted by oldest-first." @@ -91,6 +96,7 @@ (defun bzrmerge-missing (from merges) "Return the list of revisions that need to be merged. MERGES is the revisions already merged but not yet committed. +Asks about skipping revisions with logs matching `bzrmerge-skip-regexp'. The result is of the form (TOMERGE . TOSKIP) where TOMERGE and TOSKIP are both lists of revnos, in oldest-first order." (with-current-buffer (get-buffer-create "*bzrmerge*") @@ -114,8 +120,7 @@ (setq revno (string-to-number revno))) (re-search-forward "^message:\n") (while (and (not skip) - (re-search-forward - "back[- ]?port\\|merge\\|sync\\|re-?generate\\|bump version" nil t)) + (re-search-forward bzrmerge-skip-regexp nil t)) (let ((str (buffer-substring (line-beginning-position) (line-end-position)))) (when (string-match "\\` *" str)