From: Stefan Monnier Date: Sat, 12 Apr 2003 23:13:03 +0000 (+0000) Subject: (change-log-version-number-search): Fix old bug. X-Git-Tag: ttn-vms-21-2-B4~10525 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fc9b05545232b7448e8351d19107768d0c2a2523;p=emacs.git (change-log-version-number-search): Fix old bug. (add-change-log-entry): Avoid inserting the same funname again. (add-log-indent-text): New var. (add-log-indent): New fun. (change-log-mode): Use it. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4023d57b6ab..8dea5e62fb8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,34 @@ +2003-04-12 Stefan Monnier + + * add-log.el (change-log-version-number-search): Fix old bug. + (add-change-log-entry): Avoid inserting the same funname again. + (add-log-indent-text): New var. + (add-log-indent): New fun. + (change-log-mode): Use it. + + * net/browse-url.el: Don't autoload all these defcustoms. + (browse-url-default-macosx-browser): New fun. + (browse-url-browser-function): Use it for system-type = darwin. + (browse-url-usr1-signal): Remove. + (browse-url-mosaic): Use SIGUSR1 directly instead. + (browse-url-gnome-moz-program): New var. + (browse-url-gnome-moz, browse-url-default-browser): Use it. + + * emacs-lisp/bytecomp.el: Use push, with-current-buffer, dolist, ... + (byte-compile-const-variables): New var. + (byte-compile-close-variables): Reset it. + (byte-compile-file-form-defvar, byte-compile-defvar): Update it. + (byte-compile-const-symbol-p): Now arg `value' to check defconsts. + (byte-compile-variable-ref): Use it and improve warning message. + (byte-compile-check-lambda-list): Use byte-compile-const-symbol-p. + (byte-compile-lapcode): Remove unused vars. + (byte-compile-eval): Fix thinko in handling of old-autoloads. + (byte-recompile-directory): Use the expanded form for directory. + (byte-compile-track-mouse): Use modern backquote syntax. + (byte-compile-defvar): Detect and properly handle (defconst a). + (byte-compile-defalias-warn): Remove unused arg `alias'. + (byte-compile-defalias): Update call. + 2003-04-13 Masatake YAMATO * help.el (describe-minor-mode): New function implementation. diff --git a/lisp/add-log.el b/lisp/add-log.el index 86902d88432..a5792601f96 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el @@ -310,27 +310,26 @@ If nil, use local time.") This is the value returned by `vc-workfile-version' or, if that is nil, by matching `change-log-version-number-regexp-list'." (let* ((size (buffer-size)) - (end + (limit ;; The version number can be anywhere in the file, but ;; restrict search to the file beginning: 10% should be ;; enough to prevent some mishits. ;; ;; Apply percentage only if buffer size is bigger than ;; approx 100 lines. - (if (> size (* 100 80)) - (/ size 10) - size)) - version) + (if (> size (* 100 80)) (+ (point) (/ size 10))))) (or (and buffer-file-name (vc-workfile-version buffer-file-name)) (save-restriction (widen) - (let ((regexps change-log-version-number-regexp-list)) + (let ((regexps change-log-version-number-regexp-list) + version) (while regexps (save-excursion (goto-char (point-min)) - (when (re-search-forward (pop regexps) end t) + (when (re-search-forward (pop regexps) limit t) (setq version (match-string 1) - regexps nil))))))))) + regexps nil)))) + version))))) ;;;###autoload @@ -564,8 +563,13 @@ non-nil, otherwise in local time." (skip-syntax-backward " ") (skip-chars-backward "):") (if (and (looking-at "):") - (> fill-column (+ (current-column) (length defun) 4))) - (progn (delete-region (point) pos) (insert ", ")) + (let ((pos (save-excursion (backward-sexp 1) (point)))) + (when (equal (buffer-substring pos (point)) defun) + (delete-region pos (point))) + (> fill-column (+ (current-column) (length defun) 4)))) + (progn (skip-chars-backward ", ") + (delete-region (point) pos) + (unless (memq (char-before) '(?\()) (insert ", "))) (if (looking-at "):") (delete-region (+ 1 (point)) (line-end-position))) (goto-char pos) @@ -585,6 +589,26 @@ the change log file in another window." (add-change-log-entry whoami file-name t)) ;;;###autoload (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window) +(defvar add-log-indent-text 0) + +(defun add-log-indent () + (let* ((indent + (save-excursion + (beginning-of-line) + (skip-chars-forward " \t") + (cond + ((and (looking-at "\\(.*\\) [^ \n].*[^ \n] <.*>$") + ;; Matching the output of add-log-time-format is difficult, + ;; but I'll get it has at least two adjacent digits. + (string-match "[[:digit:]][[:digit:]]" (match-string 1))) + 0) + ((looking-at "[^*(]") + (+ (current-left-margin) add-log-indent-text)) + (t (current-left-margin))))) + (pos (save-excursion (indent-line-to indent) (point)))) + (if (> pos (point)) (goto-char pos)))) + + ;;;###autoload (define-derived-mode change-log-mode text-mode "Change Log" "Major mode for editing change logs; like Indented Text Mode. @@ -598,7 +622,8 @@ Runs `change-log-mode-hook'." tab-width 8) (set (make-local-variable 'fill-paragraph-function) 'change-log-fill-paragraph) - (set (make-local-variable 'indent-line-function) 'indent-to-left-margin) + (set (make-local-variable 'indent-line-function) 'add-log-indent) + (set (make-local-variable 'tab-always-indent) nil) ;; We really do want "^" in paragraph-start below: it is only the ;; lines that begin at column 0 (despite the left-margin of 8) that ;; we are looking for. Adding `* ' allows eliding the blank line