diff options
| author | Stefan Monnier | 2007-07-20 20:31:29 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-07-20 20:31:29 +0000 |
| commit | bb042dc6fab52bd691b520b03ee61be7718664c0 (patch) | |
| tree | a4db0abd86335bf81f54c2a68c671f892bc4aae8 | |
| parent | 765831a0749719d0e7e5b91cf1576689eb04cc36 (diff) | |
| download | emacs-bb042dc6fab52bd691b520b03ee61be7718664c0.tar.gz emacs-bb042dc6fab52bd691b520b03ee61be7718664c0.zip | |
(add-change-log-entry, add-log-current-defun, change-log-merge):
Use derived-mode-p rather than checking major-mode directly.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/add-log.el | 30 |
2 files changed, 19 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0404053f717..bf5b5da1be2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,13 +1,15 @@ | |||
| 1 | 2007-07-20 Dan Nicolaescu <dann@ics.uci.edu> | 1 | 2007-07-20 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 2 | ||
| 3 | * progmodes/compile.el (compilation-auto-jump-to-first-error): Add | 3 | * progmodes/compile.el (compilation-auto-jump-to-first-error): |
| 4 | group and version. | 4 | Add group and version. |
| 5 | 5 | ||
| 6 | 2007-07-20 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2007-07-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 7 | 7 | ||
| 8 | * add-log.el (add-log-file-name): Use file-relative-name. | 8 | * add-log.el (add-log-file-name): Use file-relative-name. |
| 9 | (add-change-log-entry): Delay reading add-log-(full-name|mailing-address) | 9 | (add-change-log-entry): Delay reading add-log-(full-name|mailing-address) |
| 10 | to after we've switched to the ChangeLog buffer so we get the right value. | 10 | to after we've switched to the ChangeLog buffer so we get the right value. |
| 11 | (add-change-log-entry, add-log-current-defun, change-log-merge): | ||
| 12 | Use derived-mode-p rather than checking major-mode directly. | ||
| 11 | 13 | ||
| 12 | * pcvs.el (cvs-mode-add-change-log-entry-other-window): Use a directory | 14 | * pcvs.el (cvs-mode-add-change-log-entry-other-window): Use a directory |
| 13 | name for buffer-file-name if it refers to a directory. | 15 | name for buffer-file-name if it refers to a directory. |
diff --git a/lisp/add-log.el b/lisp/add-log.el index 66c0b9c4ba3..63212a75dc8 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el | |||
| @@ -55,7 +55,7 @@ | |||
| 55 | ;; Many modes set this variable, so avoid warnings. | 55 | ;; Many modes set this variable, so avoid warnings. |
| 56 | ;;;###autoload | 56 | ;;;###autoload |
| 57 | (defcustom add-log-current-defun-function nil | 57 | (defcustom add-log-current-defun-function nil |
| 58 | "*If non-nil, function to guess name of surrounding function. | 58 | "If non-nil, function to guess name of surrounding function. |
| 59 | It is used by `add-log-current-defun' in preference to built-in rules. | 59 | It is used by `add-log-current-defun' in preference to built-in rules. |
| 60 | Returns function's name as a string, or nil if outside a function." | 60 | Returns function's name as a string, or nil if outside a function." |
| 61 | :type '(choice (const nil) function) | 61 | :type '(choice (const nil) function) |
| @@ -63,7 +63,7 @@ Returns function's name as a string, or nil if outside a function." | |||
| 63 | 63 | ||
| 64 | ;;;###autoload | 64 | ;;;###autoload |
| 65 | (defcustom add-log-full-name nil | 65 | (defcustom add-log-full-name nil |
| 66 | "*Full name of user, for inclusion in ChangeLog daily headers. | 66 | "Full name of user, for inclusion in ChangeLog daily headers. |
| 67 | This defaults to the value returned by the function `user-full-name'." | 67 | This defaults to the value returned by the function `user-full-name'." |
| 68 | :type '(choice (const :tag "Default" nil) | 68 | :type '(choice (const :tag "Default" nil) |
| 69 | string) | 69 | string) |
| @@ -148,7 +148,7 @@ use the file's name relative to the directory of the change log file." | |||
| 148 | 148 | ||
| 149 | 149 | ||
| 150 | (defcustom change-log-version-info-enabled nil | 150 | (defcustom change-log-version-info-enabled nil |
| 151 | "*If non-nil, enable recording version numbers with the changes." | 151 | "If non-nil, enable recording version numbers with the changes." |
| 152 | :version "21.1" | 152 | :version "21.1" |
| 153 | :type 'boolean | 153 | :type 'boolean |
| 154 | :group 'change-log) | 154 | :group 'change-log) |
| @@ -160,7 +160,7 @@ use the file's name relative to the directory of the change log file." | |||
| 160 | (concat "^(def[^ \t\n]+[ \t]+[^ \t\n][ \t]\"" re) | 160 | (concat "^(def[^ \t\n]+[ \t]+[^ \t\n][ \t]\"" re) |
| 161 | ;; Revision: pcl-cvs.el,v 1.72 1999/09/05 20:21:54 monnier Exp | 161 | ;; Revision: pcl-cvs.el,v 1.72 1999/09/05 20:21:54 monnier Exp |
| 162 | (concat "^;+ *Revision: +[^ \t\n]+[ \t]+" re))) | 162 | (concat "^;+ *Revision: +[^ \t\n]+[ \t]+" re))) |
| 163 | "*List of regexps to search for version number. | 163 | "List of regexps to search for version number. |
| 164 | The version number must be in group 1. | 164 | The version number must be in group 1. |
| 165 | Note: The search is conducted only within 10%, at the beginning of the file." | 165 | Note: The search is conducted only within 10%, at the beginning of the file." |
| 166 | :version "21.1" | 166 | :version "21.1" |
| @@ -510,7 +510,7 @@ non-nil, otherwise in local time." | |||
| 510 | (if (or other-window (window-dedicated-p (selected-window))) | 510 | (if (or other-window (window-dedicated-p (selected-window))) |
| 511 | (find-file-other-window file-name) | 511 | (find-file-other-window file-name) |
| 512 | (find-file file-name))) | 512 | (find-file file-name))) |
| 513 | (or (eq major-mode 'change-log-mode) | 513 | (or (derived-mode-p 'change-log-mode) |
| 514 | (change-log-mode)) | 514 | (change-log-mode)) |
| 515 | (undo-boundary) | 515 | (undo-boundary) |
| 516 | (goto-char (point-min)) | 516 | (goto-char (point-min)) |
| @@ -751,7 +751,7 @@ Prefix arg means justify as well." | |||
| 751 | 751 | ||
| 752 | ;;;###autoload | 752 | ;;;###autoload |
| 753 | (defvar add-log-tex-like-modes | 753 | (defvar add-log-tex-like-modes |
| 754 | '(TeX-mode plain-TeX-mode LaTeX-mode plain-tex-mode latex-mode) | 754 | '(TeX-mode plain-TeX-mode LaTeX-mode tex-mode) |
| 755 | "*Modes that look like TeX to `add-log-current-defun'.") | 755 | "*Modes that look like TeX to `add-log-current-defun'.") |
| 756 | 756 | ||
| 757 | ;;;###autoload | 757 | ;;;###autoload |
| @@ -773,7 +773,7 @@ Has a preference of looking backwards." | |||
| 773 | (let ((location (point))) | 773 | (let ((location (point))) |
| 774 | (cond (add-log-current-defun-function | 774 | (cond (add-log-current-defun-function |
| 775 | (funcall add-log-current-defun-function)) | 775 | (funcall add-log-current-defun-function)) |
| 776 | ((memq major-mode add-log-lisp-like-modes) | 776 | ((apply 'derived-mode-p add-log-lisp-like-modes) |
| 777 | ;; If we are now precisely at the beginning of a defun, | 777 | ;; If we are now precisely at the beginning of a defun, |
| 778 | ;; make sure beginning-of-defun finds that one | 778 | ;; make sure beginning-of-defun finds that one |
| 779 | ;; rather than the previous one. | 779 | ;; rather than the previous one. |
| @@ -797,7 +797,7 @@ Has a preference of looking backwards." | |||
| 797 | (buffer-substring-no-properties (point) | 797 | (buffer-substring-no-properties (point) |
| 798 | (progn (forward-sexp 1) | 798 | (progn (forward-sexp 1) |
| 799 | (point))))) | 799 | (point))))) |
| 800 | ((and (memq major-mode add-log-c-like-modes) | 800 | ((and (apply 'derived-mode-p add-log-c-like-modes) |
| 801 | (save-excursion | 801 | (save-excursion |
| 802 | (beginning-of-line) | 802 | (beginning-of-line) |
| 803 | ;; Use eq instead of = here to avoid | 803 | ;; Use eq instead of = here to avoid |
| @@ -815,7 +815,7 @@ Has a preference of looking backwards." | |||
| 815 | (buffer-substring-no-properties (point) | 815 | (buffer-substring-no-properties (point) |
| 816 | (progn (forward-sexp 1) | 816 | (progn (forward-sexp 1) |
| 817 | (point)))) | 817 | (point)))) |
| 818 | ((memq major-mode add-log-c-like-modes) | 818 | ((apply 'derived-mode-p add-log-c-like-modes) |
| 819 | ;; See whether the point is inside a defun. | 819 | ;; See whether the point is inside a defun. |
| 820 | (let (having-previous-defun | 820 | (let (having-previous-defun |
| 821 | having-next-defun | 821 | having-next-defun |
| @@ -957,7 +957,7 @@ Has a preference of looking backwards." | |||
| 957 | (setq end (point))) | 957 | (setq end (point))) |
| 958 | (buffer-substring-no-properties | 958 | (buffer-substring-no-properties |
| 959 | middle end))))))))) | 959 | middle end))))))))) |
| 960 | ((memq major-mode add-log-tex-like-modes) | 960 | ((apply 'derived-mode-p add-log-tex-like-modes) |
| 961 | (if (re-search-backward | 961 | (if (re-search-backward |
| 962 | "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)" | 962 | "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)" |
| 963 | nil t) | 963 | nil t) |
| @@ -966,17 +966,17 @@ Has a preference of looking backwards." | |||
| 966 | (buffer-substring-no-properties | 966 | (buffer-substring-no-properties |
| 967 | (1+ (point)) ; without initial backslash | 967 | (1+ (point)) ; without initial backslash |
| 968 | (line-end-position))))) | 968 | (line-end-position))))) |
| 969 | ((eq major-mode 'texinfo-mode) | 969 | ((derived-mode-p 'texinfo-mode) |
| 970 | (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t) | 970 | (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t) |
| 971 | (match-string-no-properties 1))) | 971 | (match-string-no-properties 1))) |
| 972 | ((memq major-mode '(perl-mode cperl-mode)) | 972 | ((derived-mode-p '(perl-mode cperl-mode)) |
| 973 | (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t) | 973 | (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t) |
| 974 | (match-string-no-properties 1))) | 974 | (match-string-no-properties 1))) |
| 975 | ;; Emacs's autoconf-mode installs its own | 975 | ;; Emacs's autoconf-mode installs its own |
| 976 | ;; `add-log-current-defun-function'. This applies to | 976 | ;; `add-log-current-defun-function'. This applies to |
| 977 | ;; a different mode apparently for editing .m4 | 977 | ;; a different mode apparently for editing .m4 |
| 978 | ;; autoconf source. | 978 | ;; autoconf source. |
| 979 | ((eq major-mode 'autoconf-mode) | 979 | ((derived-mode-p 'autoconf-mode) |
| 980 | (if (re-search-backward | 980 | (if (re-search-backward |
| 981 | "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t) | 981 | "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t) |
| 982 | (match-string-no-properties 3))) | 982 | (match-string-no-properties 3))) |
| @@ -1065,7 +1065,7 @@ or a buffer. | |||
| 1065 | Entries are inserted in chronological order. Both the current and | 1065 | Entries are inserted in chronological order. Both the current and |
| 1066 | old-style time formats for entries are supported." | 1066 | old-style time formats for entries are supported." |
| 1067 | (interactive "*fLog file name to merge: ") | 1067 | (interactive "*fLog file name to merge: ") |
| 1068 | (if (not (eq major-mode 'change-log-mode)) | 1068 | (if (not (derived-mode-p 'change-log-mode)) |
| 1069 | (error "Not in Change Log mode")) | 1069 | (error "Not in Change Log mode")) |
| 1070 | (let ((other-buf (if (bufferp other-log) other-log | 1070 | (let ((other-buf (if (bufferp other-log) other-log |
| 1071 | (find-file-noselect other-log))) | 1071 | (find-file-noselect other-log))) |
| @@ -1075,7 +1075,7 @@ old-style time formats for entries are supported." | |||
| 1075 | (goto-char (point-min)) | 1075 | (goto-char (point-min)) |
| 1076 | (set-buffer other-buf) | 1076 | (set-buffer other-buf) |
| 1077 | (goto-char (point-min)) | 1077 | (goto-char (point-min)) |
| 1078 | (if (not (eq major-mode 'change-log-mode)) | 1078 | (if (not (derived-mode-p 'change-log-mode)) |
| 1079 | (error "%s not found in Change Log mode" other-log)) | 1079 | (error "%s not found in Change Log mode" other-log)) |
| 1080 | ;; Loop through all the entries in OTHER-LOG. | 1080 | ;; Loop through all the entries in OTHER-LOG. |
| 1081 | (while (not (eobp)) | 1081 | (while (not (eobp)) |