diff options
author | Miles Bader <miles@gnu.org> | 2004-11-04 08:55:40 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2004-11-04 08:55:40 +0000 |
commit | d1a3e560ff62e047d9fa8e8b3b1bc1e56e104c26 (patch) | |
tree | 935f61a936f33c7690a201b19b86e89c3d864b61 /lisp | |
parent | 32dc0e8f9bc2d460b3d964c21989de70282bab61 (diff) | |
parent | 0683d2414d4de8626f7c46f59937f9bef27302ce (diff) | |
download | emacs-d1a3e560ff62e047d9fa8e8b3b1bc1e56e104c26.tar.gz emacs-d1a3e560ff62e047d9fa8e8b3b1bc1e56e104c26.tar.bz2 emacs-d1a3e560ff62e047d9fa8e8b3b1bc1e56e104c26.zip |
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-69
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-643
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-649
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-650
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-651
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-655
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-656
Update from CVS: lisp/man.el (Man-xref-normal-file): Fix help-echo.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-657
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-658
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-659
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-660
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-661
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-667
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-61
- miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68
Update from CVS
Diffstat (limited to 'lisp')
110 files changed, 3106 insertions, 1901 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 260dfb22af5..3b3579e3908 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,421 @@ +2004-11-03 Daniel Pfeiffer <occitan@esperanto.org> + + * files.el (xml-based-modes): Delete var. + (magic-mode-alist): New more general var. + (set-auto-mode): Use it. + + * buff-menu.el (Buffer-menu-make-sort-button): Preserve point even + when clicking from another window. + +2004-11-03 Thien-Thi Nguyen <ttn@gnu.org> + + * vc-cvs.el (vc-cvs-local-month-numbers): Delete var. + (vc-cvs-annotate-time): Incorporate value of deleted var. + Remove special-case handling of beginning-of-buffer cruft. + Cache ending position (point) and return value in text property + `vc-cvs-annotate-time', and consult it on subsequent invocations. + + * vc-cvs.el (vc-cvs-annotate-command): + Delete extraneous lines from beginning of buffer. + * vc-mcvs.el (vc-mcvs-annotate-command): Likewise. + + * progmodes/grep.el (grep-default-command): Take empty string + for tag if all other methods yield nil. Shell-quote the tag. + + * vc.el (vc-annotate-display-autoscale): Add prefix-arg + spec in `interactive' form, and mention it in the docstring. + Also, make sure point is at bol after calling `annotate-time'. + +2004-11-02 Richard M. Stallman <rms@gnu.org> + + * emacs-lisp/elp.el (elp-instrument-function): + Use called-interactively-p. + + * emacs-lisp/easymenu.el (easy-menu-intern): + Don't downcase; rather, case-flip the first letter of each word. + + * emacs-lisp/easy-mmode.el (define-minor-mode): + Use called-interactively-p. + + * emacs-lisp/bytecomp.el (byte-compile-warning-types): + Add interactive-only. + (byte-compile-warnings): Add interactive-only as option. + (byte-compile-interactive-only-functions): New variable. + (byte-compile-form): Warn about calls to functions + in byte-compile-interactive-only-functions. + + * emacs-lisp/autoload.el (update-file-autoloads): + Don't use interactive-p; take new arg SAVE-AFTER. + + * emacs-lisp/advice.el (ad-make-advised-definition): + Use called-interactively-p. + +2004-11-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * files.el (find-file-existing): New function. + + * menu-bar.el (menu-bar-files-menu): Make "Open File..." call + find-file-existing. Add "New File..." that calls find-file. + + * diropen.pbm diropen.xpm: New files. + + * toolbar/tool-bar.el (tool-bar-setup): Tool bar item dired uses + icon diropen. New tool bar item find-file-existing uses icon open. + + * dired.el (dired-read-dir-and-switches): Call read-driectory-name + instead of read-file-name. + +2004-11-02 Ulf Jasper <ulf.jasper@web.de> + + * calendar/icalendar.el (icalendar-version): Increase to 0.08. + (icalendar--split-value): Change name of work buffer. + (icalendar--get-weekday-abbrev): Return nil on error. + (icalendar--date-to-isodate): New function. + (icalendar-convert-diary-to-ical) + (icalendar-extract-ical-from-buffer): Use only two args for + make-obsolete (XEmacs compatibility). + (icalendar-export-file, icalendar-import-file): Blank at end of + prompt. + (icalendar-export-region): Doc fix. + If error, return non-nil and write errors to a buffer. + Use correct weekday for weekly recurring events. + Check whether date has been parsed for ordinary events. + Make weekly events start in the year 2000. + DTEND is non-inclusive, shift end date by one day if + necessary (not for entries that have date and time). + Rename local let variables: oops -> found-error, datestring -> + startdatestring. + +2004-11-02 Kim F. Storm <storm@cua.dk> + + * files.el (set-auto-mode-0): Don't rely on dynamic binding of + keep-mode-if-same variable. Add it as optional arg instead. + (set-auto-mode): Call set-auto-mode-0 with keep-mode-if-same. + + * ehelp.el (electric-help-map): Reorder Q/q and R/r entries so + substitute-command-keys will select lower-case bindings like those + used in the static help texts. + + * descr-text.el (describe-text-properties): Don't err if called in + the *Help* buffer; output to *Help-2* buffer instead. + + * kmacro.el (group kmacro): Add :version. + (kmacro-keyboard-quit): New function to cleanup on C-g. + (kmacro-start-macro): Set defining-kbd-macro to append when + appending to last macro. + + * simple.el (keyboard-quit): Call kmacro-keyboard-quit. + +2004-11-02 Nick Roberts <nickrob@snap.net.nz> + + * progmodes/gdb-ui.el (gdb-enable-debug-log) + (gdb-use-inferior-io-buffer, gdb-use-colon-colon-notation) + (gud-gdba-command-name, gdb-show-main, gdb-many-windows): + Add :version keyword. + +2004-11-02 Pavel Kobiakov <pk_at_work@yahoo.com> + + * progmodes/flymake.el (flymake-err-line-patterns): Use + `flymake-reformat-err-line-patterns-from-compile-el' to convert + `compilation-error-regexp-alist-alist' to internal Flymake format. + + * progmodes/flymake.el: eliminated byte-compiler warnings. + +2004-11-01 Jay Belanger <belanger@truman.edu> + + * calc/calc-frac.el (calc-over-notation): Replaced + `completing-read' with `interactive "s"'. + +2004-11-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * mouse.el (mouse-yank-at-click, mouse-yank-secondary): + Revert change from 2004-10-16. '*' checks the current buffer, but the + mouse click may be in another buffer. + +2004-11-01 John Paul Wallington <jpw@gnu.org> + + * files.el (large-file-warning-threshold): Add :version keyword. + (kill-some-buffers): Doc fix. + + * thumbs.el (group thumbs): Add :version keyword. + + * textmodes/bibtex.el (bibtex-make-field): Fix typo. + +2004-11-01 Richard M. Stallman <rms@gnu.org> + + * textmodes/ispell.el (ispell-word): Don't use interactive-p. + + * textmodes/flyspell.el (flyspell-word): Don't use interactive-p. + + * allout.el (allout group): Add :version. + (allout-init): Don't use interactive-p. + (allout-ascend-to-depth, allout-ascend, allout-end-of-level) + (allout-forward-current-level, allout-backward-current-level): + Don't use interactive-p. + + * textmodes/bibtex.el (bibtex-make-field): Don't use interactive-p. + (bibtex-find-text): Likewise. + + * progmodes/vhdl-mode.el (vhdl-fill-region) + (vhdl-beginning-of-statement): Don't use interactive-p. + + * progmodes/idlwave.el (idlwave-update-routine-info): + Don't use interactive-p. + + * progmodes/idlw-shell.el (idlwave-shell-send-char): + Don't use interactive-p. + + * progmodes/cperl-mode.el (cperl-switch-to-doc-buffer): + Don't use interactive-p. + + * progmodes/ada-xref.el (ada-make-body-gnatstub): + Don't use interactive-p. + + * play/fortune.el (fortune-to-signature): Don't use interactive-p. + (fortune-in-buffer): Doc fix. + + * play/5x5.el (5x5-new-game): Set up the buffer even if not interactive. + + * net/eudc.el (eudc-display-records): Use with-output-to-temp-buffer; + don't select the temporary buffer. + (eudc-get-email): New optional arg ERROR; don't use interactive-p. + (eudc-get-phone): Likewise. + +2004-11-01 Kim F. Storm <storm@cua.dk> + + * man.el (Man-xref-normal-file): Fix help-echo. + +2004-10-31 Stefan Monnier <monnier@iro.umontreal.ca> + + * reveal.el (reveal-last-tick): New var. + (reveal-post-command): Use it to avoid closing overlays when we're + appending text to them. + +2004-10-31 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> + + * textmodes/bibtex.el: Require button. + (bibtex-autokey-transcriptions): Translate TeX `\ ' to space. + (bibtex-reference-keys): Distinguish between header keys and + crossref keys. + (bibtex-beginning-of-field): New function. + (bibtex-url-map): Remove. + (bibtex-font-lock-keywords): Use bibtex-font-lock-crossref. + (bibtex-font-lock-url-regexp): Assume that field names begin at + the beginning of a line. + (bibtex-font-lock-url): Simplify. Do not use bibtex-enclosing-field. + Remove field delimiters. Use bibtex-beginning-of-field. + Bugfix, point can be inside a field with a url. + (bibtex-font-lock-crossref, bibtex-button-action, bibtex-button): + New functions. + (bibtex-mark-active, bibtex-run-with-idle-timer): Remove. + (bibtex-key-in-head): Simplify. + (bibtex-current-line): Use bolp. + (bibtex-parse-keys): Remove unused arg `add'. + Use bibtex-type-in-head and bibtex-key-in-head. + (bibtex-parse-entry, bibtex-autofill-entry): + Use bibtex-type-in-head and bibtex-key-in-head. + (bibtex-autokey-get-field): Do not alter case of replacement text. + (bibtex-autokey-get-names): Do all processing of name list. + (bibtex-autokey-get-year): New function. + (bibtex-autokey-get-title): Do all processing of title words. + (bibtex-generate-autokey): Simplify. + (bibtex-string-files-init): Use default-directory. + Allow for absolute file names in bibtex-string-files. + (bibtex-files, bibtex-file-path): New variables. + (bibtex-files-expand): New function. + (bibtex-find-entry-globally): New command. + (bibtex-summary-function): New variable. + (bibtex-summary): Default value of bibtex-summary-function. + (bibtex-find-crossref): New optional args pnt and split. + (bibtex-complete-key-cleanup): Call bibtex-summary-function. + (bibtex-copy-summary-as-kill): New command bound to C-cC-t. + (bibtex-validate): Fix docstring. Check only abbreviated month fields. + Fix handling of required and alternative fields. + Identify duplicate keys even if bibtex-maintain-sorted-entries is nil. + Use cons and display-buffer. + (bibtex-validate-globally): New command. + (bibtex-clean-entry): Use bibtex-files-expand. Do not call + bibtex-parse-keys and bibtex-parse-strings for updating + bibtex-reference-keys and bibtex-strings. + (bibtex-realign): Remove blank lines past the last entry. + (bibtex-reformat): Use bibtex-entry-format as default. + (bibtex-choose-completion-string): Remove. + (bibtex-complete): Do not use bibtex-choose-completion-string. + (bibtex-url): Simplify. + +2004-10-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * x-dnd.el (x-dnd-test-function, x-dnd-protocol-alist) + (x-dnd-types-alist, x-dnd-open-file-other-window) + (x-dnd-known-types): Add :version. + +2004-10-31 John Paul Wallington <jpw@gnu.org> + + * ibuffer.el (group ibuffer): Add :version keyword. + +2004-10-31 Kim F. Storm <storm@cua.dk> + + * ido.el (group ido): Add :version keyword. + (ido-mode): Remove :version keyword. + + * emulation/cua-base.el (group cua): Add :version keyword. + (cua-mode): Remove :version keyword. + +2004-10-30 Luc Teirlinck <teirllm@auburn.edu> + + * autorevert.el (auto-revert-tail-mode-text): Add :version keyword. + + * help-at-pt.el (help-at-pt-timer): Move defvar up to avoid + compiler warning. + (help-at-pt-timer-delay): Add :initialize keyword. Simplify :set + function. + (help-at-pt-display-when-idle): Remove autoload. + +2004-10-30 Stefan Monnier <monnier@iro.umontreal.ca> + + * makefile.w32-in (custom-deps, autoloads): Fix *-hooks -> *-hook. + +2004-10-30 Juri Linkov <juri@jurta.org> + + * help.el (function-called-at-point): + * help-fns.el (variable-at-point): Read -> intern. + +2004-10-30 Simon Josefsson <jas@extundo.com> + + * progmodes/autoconf.el (autoconf-font-lock-keywords): + Recognize AS_* too. + +2004-10-29 Simon Josefsson <jas@extundo.com> + + * subr.el (read-passwd): Move back from password.el. + + * password.el: Remove, not ready yet. + +2004-10-29 Andreas Schwab <schwab@suse.de> + + * speedbar.el (speedbar-frame-parameters): Improve customize type. + +2004-10-29 Sam Steingold <sds@gnu.org> + + * mouse.el (mouse-show-mark): Replace the last occurrence of + x-lost-selection-hooks with x-lost-selection-functions. + +2004-10-28 Stefan Monnier <monnier@iro.umontreal.ca> + + * mouse.el (mouse-show-mark): Adjust to new name and don't assume + x-lost-selection-functions is bound. + + * mouse-sel.el (mouse-sel-mode): + * emacs-lisp/lselect.el: Adjust to new names for + x-(lost|sent)-selection-functions. + + * subr.el (x-lost-selection-hooks, x-sent-selection-hooks): + New obsolete aliases of x-lost-selection-functions and + x-sent-selection-functions. + +2004-10-28 Kim F. Storm <storm@cua.dk> + + * imenu.el (imenu-scanning-message): Remove. + (imenu-progress-message): Make it a no-op. + +2004-10-28 John Paul Wallington <jpw@gnu.org> + + * files.el (set-auto-mode): Call `throw' correctly. + +2004-10-28 Juri Linkov <juri@jurta.org> + + * info.el (Info-file-list-for-emacs): Add ("Info" . "info") + to search `Info-...' commands in `info' manual. + (Info-goto-emacs-command-node, Info-goto-emacs-key-command-node): + Add 'info-file "emacs" property. + (Info-find-emacs-command-nodes): Fix index line number regexp. + Set real line number (instead of fake 0) in first element of the + returned list. + (Info-goto-emacs-command-node): Use line number of first element + to set point in the first found Info node. + + * progmodes/grep.el (grep-regexp-alist): Move match highlighting + code to `grep-mode-font-lock-keywords'. + (grep-mode-font-lock-keywords): Delete grep markers instead + of making them invisible. + +2004-10-28 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * mail/emacsbug.el (report-emacs-bug): Insert x-server-vendor + and x-server-version in bug report. + +2004-10-28 Daniel Pfeiffer <occitan@esperanto.org> + + * files.el (set-auto-mode-0): New function. + (set-auto-mode): Use it to handle aliased modes and to + be consistent between C-x C-f and C-x C-w. + +2004-10-28 Kenichi Handa <handa@m17n.org> + + * international/utf-8.el (utf-translate-cjk-charsets): + Add katakana-jisx0201. + + * international/subst-jis.el: Add data for JISX0201. + +2004-10-27 Stefan Monnier <monnier@iro.umontreal.ca> + + * obsolete/hilit19.el (hilit-mode): New function. + Move all the toplevel side-effecting stuff into it, so that loading + hilit19 doesn't mess everything up any more. + +2004-10-27 Richard M. Stallman <rms@gnu.org> + + * add-log.el (add-change-log-entry): Set up mailing address + and full name later, and don't alter add-log-mailing-address + or add-log-full-name. + + * elide-head.el (elide-head): Change error to message. + (elide-head-show): Likewise. + + * apropos.el (apropos-macrop): Doc fix. + + * mouse.el (mouse-show-mark): Do most processing the same + regardless of transient-mark-mode. + + * shadowfile.el (shadow-copy-files): Use interactive-p + only to control whether to print a message. + + * tar-mode.el (tar-mode): Use write-contents-functions, + not write-contents-hooks. + + * eshell/em-unix.el (eshell-du-sum-directory): Don't use + directory-sep-char. + +2004-10-27 Richard M. Stallman <rms@gnu.org> + + * strokes.el (strokes-unload-hook): Fix previous change. + + * type-break.el (type-break-run-at-time): Always use run-at-time; + forget the alternatives. + (type-break-cancel-function-timers): Always use cancel-function-timers; + forget the alternatives. + + * pcomplete.el (pcomplete-entries): Don't use directory-sep-char. + +2004-10-27 Kenichi Handa <handa@m17n.org> + + * international/subst-jis.el: Use utf-translate-cjk-substitutable-p. + + * international/subst-gb2312.el: Likewise. + + * international/subst-big5.el: Likewise. + + * international/subst-ksc.el: Likewise. + + * international/utf-8.el (utf-translate-cjk-unicode-range-string): + New variable. + (utf-translate-cjk-set-unicode-range): New function. + (utf-translate-cjk-unicode-range): Make it customizable. + (utf-8-post-read-conversion): + Use utf-translate-cjk-unicode-range-string. + (ccl-decode-mule-utf-8): Check utf-subst-table-for-decode for more + Unicode ranges. + 2004-10-26 Daniel Pfeiffer <occitan@esperanto.org> * files.el (auto-mode-alist): Add pod, js, xbm and xpm and group @@ -46,8 +464,8 @@ 2004-10-26 Pavel Kobiakov <pk_at_work@yahoo.com> - * progmodes/flymake.el (flymake-split-string): Use - `flymake-split-string-remove-empty-edges' in any case. + * progmodes/flymake.el (flymake-split-string): + Use `flymake-split-string-remove-empty-edges' in any case. 2004-10-26 Masatake YAMATO <jet@gyve.org> @@ -55,6 +473,11 @@ Use `compilation-error-regexp-alist-alist' instead of `compilation-error-regexp-alist'. +2004-10-25 Stefan Monnier <monnier@iro.umontreal.ca> + + * textmodes/tex-mode.el (tex-font-lock-keywords-1): Fix up the spurious + verbatim face on the \ of \end{verbatim}. + 2004-10-25 Jay Belanger <belanger@truman.edu> * calc/calc-incom.el (calc-digit-dots): Inhibit read-only before @@ -980,7 +1403,7 @@ 2004-09-17 Jay Belanger <belanger@truman.edu> - * calc/calc.el (calc-mode-var-list): Fixed the value of + * calc/calc.el (calc-mode-var-list): Fix the value of `calc-matrix-brackets'. 2004-09-17 Romain Francoise <romain@orebokech.com> diff --git a/lisp/add-log.el b/lisp/add-log.el index 26faea2ddc3..ae135b2bfb3 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el @@ -471,20 +471,6 @@ Today's date is calculated according to `change-log-time-zone-rule' if non-nil, otherwise in local time." (interactive (list current-prefix-arg (prompt-for-change-log-name))) - (or add-log-full-name - (setq add-log-full-name (user-full-name))) - (or add-log-mailing-address - (setq add-log-mailing-address user-mail-address)) - (if whoami - (progn - (setq add-log-full-name (read-input "Full name: " add-log-full-name)) - ;; Note that some sites have room and phone number fields in - ;; full name which look silly when inserted. Rather than do - ;; anything about that here, let user give prefix argument so that - ;; s/he can edit the full name field in prompter if s/he wants. - (setq add-log-mailing-address - (read-input "Mailing address: " add-log-mailing-address)))) - (let* ((defun (add-log-current-defun)) (version (and change-log-version-info-enabled (change-log-version-number-search))) @@ -495,7 +481,19 @@ non-nil, otherwise in local time." (file-name (expand-file-name (find-change-log file-name buffer-file))) ;; Set ITEM to the file name to use in the new item. (item (add-log-file-name buffer-file file-name)) - bound) + bound + (full-name (or add-log-full-name (user-full-name))) + (mailing-address (or add-log-mailing-address user-mail-address))) + + (if whoami + (progn + (setq full-name (read-input "Full name: " full-name)) + ;; Note that some sites have room and phone number fields in + ;; full name which look silly when inserted. Rather than do + ;; anything about that here, let user give prefix argument so that + ;; s/he can edit the full name field in prompter if s/he wants. + (setq mailing-address + (read-input "Mailing address: " mailing-address)))) (unless (equal file-name buffer-file-name) (if (or other-window (window-dedicated-p (selected-window))) @@ -515,11 +513,11 @@ non-nil, otherwise in local time." ;; Advance into first entry if it is usable; else make new one. (let ((new-entries (mapcar (lambda (addr) (concat (funcall add-log-time-format) - " " add-log-full-name + " " full-name " <" addr ">")) - (if (consp add-log-mailing-address) - add-log-mailing-address - (list add-log-mailing-address))))) + (if (consp mailing-address) + mailing-address + (list mailing-address))))) (if (and (not add-log-always-start-new-record) (let ((hit nil)) (dolist (entry new-entries hit) diff --git a/lisp/allout.el b/lisp/allout.el index dd4495cfa84..fa88588ec36 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -68,7 +68,8 @@ (defgroup allout nil "Extensive outline mode for use alone and with other modes." :prefix "allout-" - :group 'editing) + :group 'editing + :version "21.4") ;;;_ + Layout, Mode, and Topic Header Configuration @@ -954,20 +955,16 @@ the following two lines in your Emacs init file: \(require 'allout) \(allout-init t)" - (interactive) - (if (interactive-p) - (progn - (setq mode - (completing-read - (concat "Select outline auto setup mode " - "(empty for report, ? for options) ") - '(("nil")("full")("activate")("deactivate") - ("ask") ("report") ("")) - nil - t)) - (if (string= mode "") - (setq mode 'report) - (setq mode (intern-soft mode))))) + (interactive + (let ((m (completing-read + (concat "Select outline auto setup mode " + "(empty for report, ? for options) ") + '(("nil")("full")("activate")("deactivate") + ("ask") ("report") ("")) + nil + t))) + (if (string= m "") 'report + (intern-soft m)))) (let ;; convenience aliases, for consistent ref to respective vars: ((hook 'allout-find-file-hook) @@ -1902,16 +1899,12 @@ If already there, move cursor to bullet for hot-spot operation. (if (= (allout-recent-depth) depth) (progn (goto-char allout-recent-prefix-beginning) depth) - (goto-char last-good) - nil)) - (if (interactive-p) (allout-end-of-prefix)))) + (goto-char last-good))))) ;;;_ > allout-ascend () (defun allout-ascend () "Ascend one level, returning t if successful, nil if not." - (prog1 - (if (allout-beginning-of-level) - (allout-previous-heading)) - (if (interactive-p) (allout-end-of-prefix)))) + (if (allout-beginning-of-level) + (allout-previous-heading))) ;;;_ > allout-descend-to-depth (depth) (defun allout-descend-to-depth (depth) "Descend to depth DEPTH within current topic. @@ -1931,13 +1924,13 @@ Returning depth if successful, nil if not." nil)) ) ;;;_ > allout-up-current-level (arg &optional dont-complain) -(defun allout-up-current-level (arg &optional dont-complain) +(defun allout-up-current-level (arg &optional dont-complain interactive) "Move out ARG levels from current visible topic. Positions on heading line of containing topic. Error if unable to ascend that far, or nil if unable to ascend but optional arg DONT-COMPLAIN is non-nil." - (interactive "p") + (interactive "p\np") (allout-back-to-current-heading) (let ((present-level (allout-recent-depth)) (last-good (point)) @@ -1958,12 +1951,12 @@ DONT-COMPLAIN is non-nil." (if (or failed (> arg 0)) (progn (goto-char last-good) - (if (interactive-p) (allout-end-of-prefix)) + (if interactive (allout-end-of-prefix)) (if (not dont-complain) (error "Can't ascend past outermost level") - (if (interactive-p) (allout-end-of-prefix)) + (if interactive (allout-end-of-prefix)) nil)) - (if (interactive-p) (allout-end-of-prefix)) + (if interactive (allout-end-of-prefix)) allout-recent-prefix-beginning))) ;;;_ - Linear @@ -2029,7 +2022,7 @@ Presumes point is at the start of a topic prefix." (let ((depth (allout-depth))) (while (allout-previous-sibling depth nil)) (prog1 (allout-recent-depth) - (if (interactive-p) (allout-end-of-prefix))))) + (allout-end-of-prefix)))) ;;;_ > allout-next-visible-heading (arg) (defun allout-next-visible-heading (arg) "Move to the next ARG'th visible heading line, backward if arg is negative. @@ -2067,13 +2060,13 @@ matches)." (interactive "p") (allout-next-visible-heading (- arg))) ;;;_ > allout-forward-current-level (arg) -(defun allout-forward-current-level (arg) +(defun allout-forward-current-level (arg &optional interactive) "Position point at the next heading of the same level. Takes optional repeat-count, goes backward if count is negative. Returns resulting position, else nil if none found." - (interactive "p") + (interactive "p\np") (let ((start-depth (allout-current-depth)) (start-point (point)) (start-arg arg) @@ -2101,7 +2094,7 @@ Returns resulting position, else nil if none found." (= (allout-recent-depth) start-depth))) allout-recent-prefix-beginning (goto-char last-good) - (if (not (interactive-p)) + (if (not interactive) nil (allout-end-of-prefix) (error "Hit %s level %d topic, traversed %d of %d requested" @@ -2110,10 +2103,10 @@ Returns resulting position, else nil if none found." (- (abs start-arg) arg) (abs start-arg)))))) ;;;_ > allout-backward-current-level (arg) -(defun allout-backward-current-level (arg) +(defun allout-backward-current-level (arg &optional interactive) "Inverse of `allout-forward-current-level'." - (interactive "p") - (if (interactive-p) + (interactive "p\np") + (if interactive (let ((current-prefix-arg (* -1 arg))) (call-interactively 'allout-forward-current-level)) (allout-forward-current-level (* -1 arg)))) diff --git a/lisp/apropos.el b/lisp/apropos.el index e5904e73b71..8bfaa3ad592 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -875,7 +875,7 @@ If non-nil TEXT is a string that will be printed as a heading." (defun apropos-macrop (symbol) - "T if SYMBOL is a Lisp macro." + "Return t if SYMBOL is a Lisp macro." (and (fboundp symbol) (consp (setq symbol (symbol-function symbol))) diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 5f6d26bfabb..1900d43d9e5 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -172,7 +172,8 @@ When non-nil, a message is generated whenever a file is reverted." \(When the string is not empty, make sure that it has a leading space.)" :group 'auto-revert - :type 'string) + :type 'string + :version "21.4") (defcustom auto-revert-mode-hook nil "Functions to run when Auto-Revert Mode is activated." diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index da21f5336d8..e980055d422 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -627,8 +627,9 @@ For more information, see the function `buffer-menu'." (define-key map [header-line mouse-2] `(lambda (e) (interactive "e") - (if e (set-buffer (window-buffer (posn-window (event-end e))))) - (Buffer-menu-sort ,column))) + (save-window-excursion + (if e (mouse-select-window e)) + (Buffer-menu-sort ,column)))) map))) (defun list-buffers-noselect (&optional files-only) diff --git a/lisp/calc/calc-frac.el b/lisp/calc/calc-frac.el index 3aa3bbdae41..48201a7dc8a 100644 --- a/lisp/calc/calc-frac.el +++ b/lisp/calc/calc-frac.el @@ -54,12 +54,7 @@ (defun calc-over-notation (fmt) - (interactive - (list - (completing-read "Fraction separator: " (mapcar (lambda (s) - (cons s 0)) - '(":" "::" "/" "//" ":/")) - nil t))) + (interactive "sFraction separator: ") (calc-wrapper (if (string-match "\\`\\([^ 0-9][^ 0-9]?\\)[0-9]*\\'" fmt) (let ((n nil)) diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 5f581e1d74a..dc3bf016053 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -31,16 +31,7 @@ ;;; History: -;; 0.07: Renamed commands! -;; icalendar-extract-ical-from-buffer -> icalendar-import-buffer -;; icalendar-convert-diary-to-ical -> icalendar-export-file -;; Naming scheme: icalendar-.* = user command; icalendar--.* = -;; internal. -;; Added icalendar-export-region. -;; The import and export commands do not clear their target file, -;; but append their results to the target file. -;; I18n-problems fixed -- use calendar-(month|day)-name-array. -;; Fixed problems with export of multi-line diary entries. +;; 0.07 onwards: see lisp/ChangeLog ;; 0.06: Bugfixes regarding icalendar-import-format-*. ;; Fix in icalendar-convert-diary-to-ical -- thanks to Philipp @@ -99,7 +90,7 @@ ;;; Code: -(defconst icalendar-version 0.07 +(defconst icalendar-version 0.08 "Version number of icalendar.el.") ;; ====================================================================== @@ -333,7 +324,7 @@ children." param-name param-value) (when value-string (save-current-buffer - (set-buffer (get-buffer-create " *ical-temp*")) + (set-buffer (get-buffer-create " *icalendar-work*")) (set-buffer-modified-p nil) (erase-buffer) (insert value-string) @@ -529,7 +520,17 @@ Note that this silently ignores seconds." (setq num (1+ num)))) calendar-day-name-array)) ;; Error: - "??")) + nil)) + +(defun icalendar--date-to-isodate (date &optional day-shift) + "Convert DATE to iso-style date. +DATE must be a list of the form (month day year). +If DAY-SHIFT is non-nil, the result is shifted by DAY-SHIFT days." + (let ((mdy (calendar-gregorian-from-absolute + (+ (calendar-absolute-from-gregorian date) + (or day-shift 0))))) + (format "%04d%02d%02d" (nth 2 mdy) (nth 0 mdy) (nth 1 mdy)))) + (defun icalendar--datestring-to-isodate (datestring &optional day-shift) "Convert diary-style DATESTRING to iso-style date. @@ -587,7 +588,7 @@ takes care of european-style." (if (> day 0) (let ((mdy (calendar-gregorian-from-absolute (+ (calendar-absolute-from-gregorian (list month day - year)) + year)) (or day-shift 0))))) (format "%04d%02d%02d" (nth 2 mdy) (nth 0 mdy) (nth 1 mdy))) nil))) @@ -625,22 +626,24 @@ would be \"pm\"." "Export diary file to iCalendar format. All diary entries in the file DIARY-FILENAME are converted to iCalendar format. The result is appended to the file ICAL-FILENAME." - (interactive "FExport diary data from file: + (interactive "FExport diary data from file: Finto iCalendar file: ") (save-current-buffer (set-buffer (find-file diary-filename)) (icalendar-export-region (point-min) (point-max) ical-filename))) (defalias 'icalendar-convert-diary-to-ical 'icalendar-export-file) -(make-obsolete 'icalendar-convert-diary-to-ical 'icalendar-export-file - "icalendar 0.07") +(make-obsolete 'icalendar-convert-diary-to-ical 'icalendar-export-file) ;; User function (defun icalendar-export-region (min max ical-filename) "Export region in diary file to iCalendar format. All diary entries in the region from MIN to MAX in the current buffer are converted to iCalendar format. The result is appended to the file -ICAL-FILENAME." +ICAL-FILENAME. + +Returns non-nil if an error occurred. In this case an error message is +written to the buffer ` *icalendar-errors*'." (interactive "r FExport diary data into iCalendar file: ") (let ((result "") @@ -649,9 +652,14 @@ FExport diary data into iCalendar file: ") (entry-rest "") (header "") (contents) - (oops nil) + (found-error nil) (nonmarker (concat "^" (regexp-quote diary-nonmarking-symbol) "?"))) + ;; prepare buffer with error messages + (save-current-buffer + (set-buffer (get-buffer-create " *icalendar-errors*")) + (erase-buffer)) + ;; here we go (save-excursion (goto-char min) (while (re-search-forward @@ -664,330 +672,366 @@ FExport diary data into iCalendar file: ") (car (current-time)) (cadr (current-time)) (car (cddr (current-time))))) - (setq oops nil) - (cond - ;; anniversaries - ((string-match - (concat nonmarker - "%%(diary-anniversary \\([^)]+\\))\\s-*\\(.*\\)") - entry-main) - (icalendar--dmsg "diary-anniversary %s" entry-main) - (let* ((datetime (substring entry-main (match-beginning 1) - (match-end 1))) - (summary (icalendar--convert-string-for-export - (substring entry-main (match-beginning 2) - (match-end 2)))) - (startisostring (icalendar--datestring-to-isodate - datetime)) - (endisostring (icalendar--datestring-to-isodate - datetime 1))) - (setq contents - (concat "\nDTSTART;VALUE=DATE:" startisostring - "\nDTEND;VALUE=DATE:" endisostring - "\nSUMMARY:" summary - "\nRRULE:FREQ=YEARLY;INTERVAL=1" - ;; the following is redundant, - ;; but korganizer seems to expect this... ;( - ;; and evolution doesn't understand it... :( - ;; so... who is wrong?! - ";BYMONTH=" (substring startisostring 4 6) - ";BYMONTHDAY=" (substring startisostring 6 8) - ))) - (unless (string= entry-rest "") - (setq contents (concat contents "\nDESCRIPTION:" - (icalendar--convert-string-for-export - entry-rest))))) - ;; cyclic events - ;; %%(diary-cyclic ) - ((string-match - (concat nonmarker - "%%(diary-cyclic \\([^ ]+\\) +" - "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*\\(.*\\)") - entry-main) - (icalendar--dmsg "diary-cyclic %s" entry-main) - (let* ((frequency (substring entry-main (match-beginning 1) - (match-end 1))) - (datetime (substring entry-main (match-beginning 2) - (match-end 2))) - (summary (icalendar--convert-string-for-export - (substring entry-main (match-beginning 3) - (match-end 3)))) - (startisostring (icalendar--datestring-to-isodate - datetime)) - (endisostring (icalendar--datestring-to-isodate - datetime 1))) - (setq contents - (concat "\nDTSTART;VALUE=DATE:" startisostring - "\nDTEND;VALUE=DATE:" endisostring - "\nSUMMARY:" summary - "\nRRULE:FREQ=DAILY;INTERVAL=" frequency - ;; strange: korganizer does not expect - ;; BYSOMETHING here... - ))) - (unless (string= entry-rest "") - (setq contents (concat contents "\nDESCRIPTION:" - (icalendar--convert-string-for-export - entry-rest))))) - ;; diary-date -- FIXME - ((string-match - (concat nonmarker - "%%(diary-date \\([^)]+\\))\\s-*\\(.*\\)") - entry-main) - (icalendar--dmsg "diary-date %s" entry-main) - (setq oops t)) - ;; float events -- FIXME - ((string-match - (concat nonmarker - "%%(diary-float \\([^)]+\\))\\s-*\\(.*\\)") - entry-main) - (icalendar--dmsg "diary-float %s" entry-main) - (setq oops t)) - ;; block events - ((string-match - (concat nonmarker - "%%(diary-block \\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\) +" - "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*\\(.*\\)") - entry-main) - (icalendar--dmsg "diary-block %s" entry-main) - (let* ((startstring (substring entry-main (match-beginning 1) - (match-end 1))) - (endstring (substring entry-main (match-beginning 2) - (match-end 2))) - (summary (icalendar--convert-string-for-export - (substring entry-main (match-beginning 3) - (match-end 3)))) - (startisostring (icalendar--datestring-to-isodate - startstring)) - (endisostring (icalendar--datestring-to-isodate - endstring 1))) - (setq contents - (concat "\nDTSTART;VALUE=DATE:" startisostring - "\nDTEND;VALUE=DATE:" endisostring - "\nSUMMARY:" summary - )) - (unless (string= entry-rest "") - (setq contents (concat contents "\nDESCRIPTION:" - (icalendar--convert-string-for-export - entry-rest)))))) - ;; other sexp diary entries -- FIXME - ((string-match - (concat nonmarker - "%%(\\([^)]+\\))\\s-*\\(.*\\)") - entry-main) - (icalendar--dmsg "diary-sexp %s" entry-main) - (setq oops t)) - ;; weekly by day - ;; Monday 8:30 Team meeting - ((and (string-match - (concat nonmarker - "\\([a-z]+\\)\\s-+" - "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" - "\\(-0?" - "\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" - "\\)?" - "\\s-*\\(.*\\)$") - entry-main) - (icalendar--get-weekday-abbrev - (substring entry-main (match-beginning 1) (match-end 1)))) - (icalendar--dmsg "weekly %s" entry-main) - (let* ((day (icalendar--get-weekday-abbrev - (substring entry-main (match-beginning 1) - (match-end 1)))) - (starttimestring (icalendar--diarytime-to-isotime - (if (match-beginning 3) - (substring entry-main - (match-beginning 3) - (match-end 3)) - nil) - (if (match-beginning 4) - (substring entry-main - (match-beginning 4) - (match-end 4)) - nil))) - (endtimestring (icalendar--diarytime-to-isotime - (if (match-beginning 6) - (substring entry-main - (match-beginning 6) - (match-end 6)) - nil) - (if (match-beginning 7) - (substring entry-main - (match-beginning 7) - (match-end 7)) - nil))) - (summary (icalendar--convert-string-for-export - (substring entry-main (match-beginning 8) - (match-end 8))))) - (when starttimestring - (unless endtimestring - (let ((time (read (icalendar--rris "^T0?" "" - starttimestring)))) - (setq endtimestring (format "T%06d" (+ 10000 time)))))) - (setq contents - (concat "\nDTSTART" - (if starttimestring "" ";VALUE=DATE") - ":19000101" ;; FIXME? Probability that this - ;; is the right day is 1/7 - (or starttimestring "") - "\nDTEND" - (if endtimestring "" ";VALUE=DATE") - ":19000101" ;; FIXME? - (or endtimestring "") - "\nSUMMARY:" summary - "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=" day - ))) - (unless (string= entry-rest "") - (setq contents (concat contents "\nDESCRIPTION:" - (icalendar--convert-string-for-export - entry-rest))))) - ;; yearly by day - ;; 1 May Tag der Arbeit - ((string-match - (concat nonmarker - (if european-calendar-style - "0?\\([1-9]+[0-9]?\\)\\s-+\\([a-z]+\\)\\s-+" - "\\([a-z]+\\)\\s-+0?\\([1-9]+[0-9]?\\)\\s-+") - "\\*?\\s-*" - "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" - "\\(" - "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" - "\\)?" - "\\s-*\\([^0-9]+.*\\)$" ; must not match years - ) - entry-main) - (icalendar--dmsg "yearly %s" entry-main) - (let* ((daypos (if european-calendar-style 1 2)) - (monpos (if european-calendar-style 2 1)) - (day (read (substring entry-main (match-beginning daypos) - (match-end daypos)))) - (month (icalendar--get-month-number - (substring entry-main (match-beginning monpos) - (match-end monpos)))) - (starttimestring (icalendar--diarytime-to-isotime - (if (match-beginning 4) - (substring entry-main - (match-beginning 4) - (match-end 4)) - nil) - (if (match-beginning 5) - (substring entry-main - (match-beginning 5) - (match-end 5)) - nil))) - (endtimestring (icalendar--diarytime-to-isotime - (if (match-beginning 7) - (substring entry-main - (match-beginning 7) - (match-end 7)) - nil) - (if (match-beginning 8) - (substring entry-main - (match-beginning 8) - (match-end 8)) - nil))) - (summary (icalendar--convert-string-for-export - (substring entry-main (match-beginning 9) - (match-end 9))))) - (when starttimestring - (unless endtimestring - (let ((time (read (icalendar--rris "^T0?" "" - starttimestring)))) - (setq endtimestring (format "T%06d" (+ 10000 time)))))) - (setq contents - (concat "\nDTSTART" - (if starttimestring "" ";VALUE=DATE") - (format ":1900%02d%02d" month day) - (or starttimestring "") - "\nDTEND" - (if endtimestring "" ";VALUE=DATE") - (format ":1900%02d%02d" month day) - (or endtimestring "") - "\nSUMMARY:" summary - "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=" - (format "%2d" month) - ";BYMONTHDAY=" - (format "%2d" day) - ))) - (unless (string= entry-rest "") - (setq contents (concat contents "\nDESCRIPTION:" - (icalendar--convert-string-for-export - entry-rest))))) - ;; "ordinary" events, start and end time given - ;; 1 Feb 2003 Hs Hochzeitsfeier, Dreieich - ((string-match - (concat nonmarker - "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)\\s-+" - "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" - "\\(" - "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" - "\\)?" - "\\s-*\\(.*\\)") - entry-main) - (icalendar--dmsg "ordinary %s" entry-main) - (let* ((datestring (icalendar--datestring-to-isodate - (substring entry-main (match-beginning 1) - (match-end 1)))) - (starttimestring (icalendar--diarytime-to-isotime - (if (match-beginning 3) - (substring entry-main - (match-beginning 3) - (match-end 3)) - nil) - (if (match-beginning 4) - (substring entry-main - (match-beginning 4) - (match-end 4)) - nil))) - (endtimestring (icalendar--diarytime-to-isotime - (if (match-beginning 6) - (substring entry-main - (match-beginning 6) - (match-end 6)) - nil) - (if (match-beginning 7) - (substring entry-main - (match-beginning 7) - (match-end 7)) - nil))) - (summary (icalendar--convert-string-for-export - (substring entry-main (match-beginning 8) - (match-end 8))))) - (when starttimestring - (unless endtimestring - (let ((time (read (icalendar--rris "^T0?" "" - starttimestring)))) - (setq endtimestring (format "T%06d" (+ 10000 time)))))) - (setq contents (format - "\nDTSTART%s:%s%s\nDTEND%s:%s%s\nSUMMARY:%s" - (if starttimestring "" ";VALUE=DATE") - datestring - (or starttimestring "") - (if endtimestring "" - ";VALUE=DATE") - datestring - (or endtimestring "") - summary)) - (unless (string= entry-rest "") - (setq contents (concat contents "\nDESCRIPTION:" - (icalendar--convert-string-for-export - entry-rest)))))) - ;; everything else - (t - ;; Oops! what's that? - (setq oops t))) - (if oops - (message "Cannot export entry on line %d" - (count-lines (point-min) (point))) - (setq result (concat result header contents "\nEND:VEVENT")))) + (condition-case error-val + (progn + (cond + ;; anniversaries + ((string-match + (concat nonmarker + "%%(diary-anniversary \\([^)]+\\))\\s-*\\(.*\\)") + entry-main) + (icalendar--dmsg "diary-anniversary %s" entry-main) + (let* ((datetime (substring entry-main (match-beginning 1) + (match-end 1))) + (summary (icalendar--convert-string-for-export + (substring entry-main (match-beginning 2) + (match-end 2)))) + (startisostring (icalendar--datestring-to-isodate + datetime)) + (endisostring (icalendar--datestring-to-isodate + datetime 1))) + (setq contents + (concat "\nDTSTART;VALUE=DATE:" startisostring + "\nDTEND;VALUE=DATE:" endisostring + "\nSUMMARY:" summary + "\nRRULE:FREQ=YEARLY;INTERVAL=1" + ;; the following is redundant, + ;; but korganizer seems to expect this... ;( + ;; and evolution doesn't understand it... :( + ;; so... who is wrong?! + ";BYMONTH=" (substring startisostring 4 6) + ";BYMONTHDAY=" (substring startisostring 6 8) + ))) + (unless (string= entry-rest "") + (setq contents (concat contents "\nDESCRIPTION:" + (icalendar--convert-string-for-export + entry-rest))))) + ;; cyclic events + ;; %%(diary-cyclic ) + ((string-match + (concat nonmarker + "%%(diary-cyclic \\([^ ]+\\) +" + "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*\\(.*\\)") + entry-main) + (icalendar--dmsg "diary-cyclic %s" entry-main) + (let* ((frequency (substring entry-main (match-beginning 1) + (match-end 1))) + (datetime (substring entry-main (match-beginning 2) + (match-end 2))) + (summary (icalendar--convert-string-for-export + (substring entry-main (match-beginning 3) + (match-end 3)))) + (startisostring (icalendar--datestring-to-isodate + datetime)) + (endisostring (icalendar--datestring-to-isodate + datetime 1))) + (setq contents + (concat "\nDTSTART;VALUE=DATE:" startisostring + "\nDTEND;VALUE=DATE:" endisostring + "\nSUMMARY:" summary + "\nRRULE:FREQ=DAILY;INTERVAL=" frequency + ;; strange: korganizer does not expect + ;; BYSOMETHING here... + ))) + (unless (string= entry-rest "") + (setq contents (concat contents "\nDESCRIPTION:" + (icalendar--convert-string-for-export + entry-rest))))) + ;; diary-date -- FIXME + ((string-match + (concat nonmarker + "%%(diary-date \\([^)]+\\))\\s-*\\(.*\\)") + entry-main) + (icalendar--dmsg "diary-date %s" entry-main) + (error "`diary-date' is not supported yet")) + ;; float events -- FIXME + ((string-match + (concat nonmarker + "%%(diary-float \\([^)]+\\))\\s-*\\(.*\\)") + entry-main) + (icalendar--dmsg "diary-float %s" entry-main) + (error "`diary-float' is not supported yet")) + ;; block events + ((string-match + (concat nonmarker + "%%(diary-block \\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\) +" + "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*\\(.*\\)") + entry-main) + (icalendar--dmsg "diary-block %s" entry-main) + (let* ((startstring (substring entry-main (match-beginning 1) + (match-end 1))) + (endstring (substring entry-main (match-beginning 2) + (match-end 2))) + (summary (icalendar--convert-string-for-export + (substring entry-main (match-beginning 3) + (match-end 3)))) + (startisostring (icalendar--datestring-to-isodate + startstring)) + (endisostring (icalendar--datestring-to-isodate + endstring 1))) + (setq contents + (concat "\nDTSTART;VALUE=DATE:" startisostring + "\nDTEND;VALUE=DATE:" endisostring + "\nSUMMARY:" summary + )) + (unless (string= entry-rest "") + (setq contents (concat contents "\nDESCRIPTION:" + (icalendar--convert-string-for-export + entry-rest)))))) + ;; other sexp diary entries -- FIXME + ((string-match + (concat nonmarker + "%%(\\([^)]+\\))\\s-*\\(.*\\)") + entry-main) + (icalendar--dmsg "diary-sexp %s" entry-main) + (error "sexp-entries are not supported yet")) + ;; weekly by day + ;; Monday 8:30 Team meeting + ((and (string-match + (concat nonmarker + "\\([a-z]+\\)\\s-+" + "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" + "\\(-0?" + "\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" + "\\)?" + "\\s-*\\(.*\\)$") + entry-main) + (icalendar--get-weekday-abbrev + (substring entry-main (match-beginning 1) (match-end 1)))) + (icalendar--dmsg "weekly %s" entry-main) + (let* ((day (icalendar--get-weekday-abbrev + (substring entry-main (match-beginning 1) + (match-end 1)))) + (starttimestring (icalendar--diarytime-to-isotime + (if (match-beginning 3) + (substring entry-main + (match-beginning 3) + (match-end 3)) + nil) + (if (match-beginning 4) + (substring entry-main + (match-beginning 4) + (match-end 4)) + nil))) + (endtimestring (icalendar--diarytime-to-isotime + (if (match-beginning 6) + (substring entry-main + (match-beginning 6) + (match-end 6)) + nil) + (if (match-beginning 7) + (substring entry-main + (match-beginning 7) + (match-end 7)) + nil))) + (summary (icalendar--convert-string-for-export + (substring entry-main (match-beginning 8) + (match-end 8))))) + (when starttimestring + (unless endtimestring + (let ((time (read (icalendar--rris "^T0?" "" + starttimestring)))) + (setq endtimestring (format "T%06d" (+ 10000 time)))))) + (setq contents + (concat "\nDTSTART;" + (if starttimestring + "VALUE=DATE-TIME:" + "VALUE=DATE:") + ;; find the correct week day, + ;; 1st january 2000 was a saturday + (format + "200001%02d" + (+ (icalendar--get-weekday-number day) 2)) + (or starttimestring "") + "\nDTEND;" + (if endtimestring + "VALUE=DATE-TIME:" + "VALUE=DATE:") + (format + "200001%02d" + ;; end is non-inclusive! + (+ (icalendar--get-weekday-number day) + (if endtimestring 2 3))) + (or endtimestring "") + "\nSUMMARY:" summary + "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=" day + ))) + (unless (string= entry-rest "") + (setq contents (concat contents "\nDESCRIPTION:" + (icalendar--convert-string-for-export + entry-rest))))) + ;; yearly by day + ;; 1 May Tag der Arbeit + ((string-match + (concat nonmarker + (if european-calendar-style + "0?\\([1-9]+[0-9]?\\)\\s-+\\([a-z]+\\)\\s-+" + "\\([a-z]+\\)\\s-+0?\\([1-9]+[0-9]?\\)\\s-+") + "\\*?\\s-*" + "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" + "\\(" + "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" + "\\)?" + "\\s-*\\([^0-9]+.*\\)$" ; must not match years + ) + entry-main) + (icalendar--dmsg "yearly %s" entry-main) + (let* ((daypos (if european-calendar-style 1 2)) + (monpos (if european-calendar-style 2 1)) + (day (read (substring entry-main (match-beginning daypos) + (match-end daypos)))) + (month (icalendar--get-month-number + (substring entry-main (match-beginning monpos) + (match-end monpos)))) + (starttimestring (icalendar--diarytime-to-isotime + (if (match-beginning 4) + (substring entry-main + (match-beginning 4) + (match-end 4)) + nil) + (if (match-beginning 5) + (substring entry-main + (match-beginning 5) + (match-end 5)) + nil))) + (endtimestring (icalendar--diarytime-to-isotime + (if (match-beginning 7) + (substring entry-main + (match-beginning 7) + (match-end 7)) + nil) + (if (match-beginning 8) + (substring entry-main + (match-beginning 8) + (match-end 8)) + nil))) + (summary (icalendar--convert-string-for-export + (substring entry-main (match-beginning 9) + (match-end 9))))) + (when starttimestring + (unless endtimestring + (let ((time (read (icalendar--rris "^T0?" "" + starttimestring)))) + (setq endtimestring (format "T%06d" (+ 10000 time)))))) + (setq contents + (concat "\nDTSTART;" + (if starttimestring "VALUE=DATE-TIME:" + "VALUE=DATE:") + (format "1900%02d%02d" month day) + (or starttimestring "") + "\nDTEND;" + (if endtimestring "VALUE=DATE-TIME:" + "VALUE=DATE:") + ;; end is not included! shift by one day + (icalendar--date-to-isodate + (list month day 1900) (if endtimestring 0 1)) + (or endtimestring "") + "\nSUMMARY:" + summary + "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=" + (format "%2d" month) + ";BYMONTHDAY=" + (format "%2d" day) + ))) + (unless (string= entry-rest "") + (setq contents (concat contents "\nDESCRIPTION:" + (icalendar--convert-string-for-export + entry-rest))))) + ;; "ordinary" events, start and end time given + ;; 1 Feb 2003 Hs Hochzeitsfeier, Dreieich + ((string-match + (concat nonmarker + "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)\\s-+" + "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" + "\\(" + "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" + "\\)?" + "\\s-*\\(.*\\)") + entry-main) + (icalendar--dmsg "ordinary %s" entry-main) + (let* ((startdatestring (icalendar--datestring-to-isodate + (substring entry-main + (match-beginning 1) + (match-end 1)))) + (starttimestring (icalendar--diarytime-to-isotime + (if (match-beginning 3) + (substring entry-main + (match-beginning 3) + (match-end 3)) + nil) + (if (match-beginning 4) + (substring entry-main + (match-beginning 4) + (match-end 4)) + nil))) + (endtimestring (icalendar--diarytime-to-isotime + (if (match-beginning 6) + (substring entry-main + (match-beginning 6) + (match-end 6)) + nil) + (if (match-beginning 7) + (substring entry-main + (match-beginning 7) + (match-end 7)) + nil))) + (summary (icalendar--convert-string-for-export + (substring entry-main (match-beginning 8) + (match-end 8))))) + (unless startdatestring + (error "Could not parse date")) + (when starttimestring + (unless endtimestring + (let ((time (read (icalendar--rris "^T0?" "" + starttimestring)))) + (setq endtimestring (format "T%06d" (+ 10000 time)))))) + (setq contents (concat + "\nDTSTART;" + (if starttimestring "VALUE=DATE-TIME:" + "VALUE=DATE:") + startdatestring + (or starttimestring "") + "\nDTEND;" + (if endtimestring "VALUE=DATE-TIME:" + "VALUE=DATE:") + (icalendar--datestring-to-isodate + (substring entry-main + (match-beginning 1) + (match-end 1)) + (if endtimestring 0 1)) + (or endtimestring "") + "\nSUMMARY:" + summary)) + ;; could not parse the date + (unless (string= entry-rest "") + (setq contents (concat contents "\nDESCRIPTION:" + (icalendar--convert-string-for-export + entry-rest)))))) + ;; everything else + (t + ;; Oops! what's that? + (error "Could not parse entry"))) + (setq result (concat result header contents "\nEND:VEVENT"))) + ;; handle errors + (error + (setq found-error t) + (save-current-buffer + (set-buffer (get-buffer-create " *icalendar-errors*")) + (insert (format "Error in line %d -- %s: `%s'\n" + (count-lines (point-min) (point)) + (cadr error-val) + entry-main)))))) + ;; we're done, insert everything into the file (let ((coding-system-for-write 'utf8)) (set-buffer (find-file ical-filename)) (goto-char (point-max)) (insert "BEGIN:VCALENDAR") - (insert "\nPRODID:-//Emacs//NONSGML icalendar.el//EN") + (insert "\nPRODID:-//Emacs//NONSGML icalendar.el//EN") (insert "\nVERSION:2.0") (insert result) - (insert "\nEND:VCALENDAR\n"))))) + (insert "\nEND:VCALENDAR\n"))) + found-error)) ;; ====================================================================== ;; Import -- convert icalendar to emacs-diary @@ -1001,7 +1045,7 @@ Argument ICAL-FILENAME output iCalendar file. Argument DIARY-FILENAME input `diary-file'. Optional argument NON-MARKING determines whether events are created as non-marking or not." - (interactive "fImport iCalendar data from file: + (interactive "fImport iCalendar data from file: Finto diary file: p") ;; clean up the diary file @@ -1062,9 +1106,7 @@ reading, parsing, or converting iCalendar data!" "Current buffer does not contain icalendar contents!")))) (defalias 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer) - -(make-obsolete 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer - "icalendar 0.07") +(make-obsolete 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer) ;; ====================================================================== ;; private area @@ -1184,7 +1226,7 @@ written into the buffer ` *icalendar-errors*'." (setq diary-string (format "%s %s%s%s" (aref calendar-day-name-array - weekday) + weekday) start-t (if end-t "-" "") (or end-t ""))) ;; FIXME!!!! diff --git a/lisp/comint.el b/lisp/comint.el index 16fd9782116..352ed876ee0 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -788,7 +788,7 @@ buffer. The hook `comint-exec-hook' is run after each exec." (defun comint-insert-input (&optional event) "In a Comint buffer, set the current input to the previous input at point." - (interactive "@") + (interactive "e") (if event (mouse-set-point event)) (let ((pos (point))) (if (not (eq (get-char-property pos 'field) 'input)) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 9e0efc5d3d0..89fcb633133 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -896,15 +896,14 @@ then prompt for the MODE to customize." (let ((name (format "*Customize Group: %s*" (custom-unlispify-tag-name group)))) (if (get-buffer name) - (let ((window (selected-window)) + (let ( ;; Copied from `custom-buffer-create-other-window'. (pop-up-windows t) (special-display-buffer-names nil) (special-display-regexps nil) (same-window-buffer-names nil) (same-window-regexps nil)) - (pop-to-buffer name) - (select-window window)) + (pop-to-buffer name)) (custom-buffer-create-other-window (list (list group 'custom-group)) name @@ -1240,21 +1239,20 @@ that option." ;;;###autoload (defun custom-buffer-create-other-window (options &optional name description) - "Create a buffer containing OPTIONS. + "Create a buffer containing OPTIONS, and display it in another window. +The result includes selecting that window. Optional NAME is the name of the buffer. OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where SYMBOL is a customization option, and WIDGET is a widget for editing that option." (unless name (setq name "*Customization*")) - (let ((window (selected-window)) - (pop-up-windows t) + (let ((pop-up-windows t) (special-display-buffer-names nil) (special-display-regexps nil) (same-window-buffer-names nil) (same-window-regexps nil)) (pop-to-buffer (custom-get-fresh-buffer name)) - (custom-buffer-create-internal options description) - (select-window window))) + (custom-buffer-create-internal options description))) (defcustom custom-reset-button-menu nil "If non-nil, only show a single reset button in customize buffers. diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 8f915d52d3a..2693575f4e2 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el @@ -176,11 +176,12 @@ otherwise." (describe-text-properties-1 pos output-buffer) (if (not (or (text-properties-at pos) (overlays-at pos))) (message "This is plain text.") - (let ((buffer (current-buffer))) - (when (eq buffer (get-buffer "*Help*")) - (error "Can't do self inspection")) + (let ((buffer (current-buffer)) + (target-buffer "*Help*")) + (when (eq buffer (get-buffer target-buffer)) + (setq target-buffer "*Help-2*")) (save-excursion - (with-output-to-temp-buffer "*Help*" + (with-output-to-temp-buffer target-buffer (set-buffer standard-output) (setq output-buffer (current-buffer)) (widget-insert "Text content at position " (format "%d" pos) ":\n\n") diff --git a/lisp/dired.el b/lisp/dired.el index 96b2905337e..c0fc33729c2 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -546,7 +546,7 @@ Optional third argument FILTER, if non-nil, is a function to select (if current-prefix-arg (read-string "Dired listing switches: " dired-listing-switches)) - (read-file-name (format "Dired %s(directory): " str) + (read-directory-name (format "Dired %s(directory): " str) nil default-directory nil)))) ;;;###autoload (define-key ctl-x-map "d" 'dired) diff --git a/lisp/ehelp.el b/lisp/ehelp.el index e80c129d3ea..82a8e10301e 100644 --- a/lisp/ehelp.el +++ b/lisp/ehelp.el @@ -85,11 +85,11 @@ (define-key map "<" 'beginning-of-buffer) (define-key map ">" 'end-of-buffer) ;(define-key map "\C-g" 'electric-help-exit) - (define-key map "q" 'electric-help-exit) (define-key map "Q" 'electric-help-exit) + (define-key map "q" 'electric-help-exit) ;;a better key than this? - (define-key map "r" 'electric-help-retain) (define-key map "R" 'electric-help-retain) + (define-key map "r" 'electric-help-retain) (define-key map "\ex" 'electric-help-execute-extended) (define-key map "\C-x" 'electric-help-ctrl-x-prefix) diff --git a/lisp/elide-head.el b/lisp/elide-head.el index 8fc8e12a3fb..fed6ecee7af 100644 --- a/lisp/elide-head.el +++ b/lisp/elide-head.el @@ -98,7 +98,7 @@ This is suitable as an entry on `find-file-hook' or appropriate mode hooks." (if rest (setq rest (cdr rest)))) (if (not (and beg end)) (if (interactive-p) - (error "No header found")) + (message "No header found")) (goto-char beg) (end-of-line) (if (overlayp elide-head-overlay) @@ -115,7 +115,7 @@ This is suitable as an entry on `find-file-hook' or appropriate mode hooks." (overlay-buffer elide-head-overlay)) (delete-overlay elide-head-overlay) (if (interactive-p) - (error "No header hidden")))) + (message "No header hidden")))) (provide 'elide-head) diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 7686722c5be..cfaac96bbb1 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el @@ -3106,7 +3106,7 @@ in any of these classes." (not advised-interactive-form)) ;; Check whether we were called interactively ;; in order to do proper prompting: - `(if (interactive-p) + `(if (called-interactively-p) (call-interactively ',origname) ,(ad-make-mapped-call orig-arglist advised-arglist diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 5a5eb55a2a2..196786e9179 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -360,11 +360,14 @@ are used." (message "Generating autoloads for %s...done" file))) ;;;###autoload -(defun update-file-autoloads (file) +(defun update-file-autoloads (file &optional save-after) "Update the autoloads for FILE in `generated-autoload-file' \(which FILE might bind in its local variables). -Return FILE if there was no autoload cookie in it." - (interactive "fUpdate autoloads for file: ") +If SAVE-AFTER is non-nil (which is always, when called interactively), +save the buffer too. + +Return FILE if there was no autoload cookie in it, else nil." + (interactive "fUpdate autoloads for file: \np") (let ((load-name (let ((name (file-name-nondirectory file))) (if (string-match "\\.elc?\\(\\.\\|$\\)" name) (substring name 0 (match-beginning 0)) @@ -464,7 +467,7 @@ Autoload section for %s is up to date." (or existing-buffer (kill-buffer (current-buffer)))))))) (generate-file-autoloads file)))) - (and (interactive-p) + (and save-after (buffer-modified-p) (save-buffer)) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 846f3efd2ee..da1e5fba8b2 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -98,6 +98,9 @@ ;; `obsolete' (obsolete variables and functions) ;; `noruntime' (calls to functions only defined ;; within `eval-when-compile') +;; `cl-warnings' (calls to CL functions) +;; `interactive-only' (calls to commands that are +;; not good to call from Lisp) ;; byte-compile-compatibility Whether the compiler should ;; generate .elc files which can be loaded into ;; generic emacs 18. @@ -325,7 +328,8 @@ If it is 'byte, then only byte-level optimizations will be logged." :type 'boolean) (defconst byte-compile-warning-types - '(redefine callargs free-vars unresolved obsolete noruntime cl-functions) + '(redefine callargs free-vars unresolved + obsolete noruntime cl-functions interactive-only) "The list of warning types used when `byte-compile-warnings' is t.") (defcustom byte-compile-warnings t "*List of warnings that the byte-compiler should issue (t for all). @@ -341,13 +345,21 @@ Elements of the list may be be: noruntime functions that may not be defined at runtime (typically defined only under `eval-when-compile'). cl-functions calls to runtime functions from the CL package (as - distinguished from macros and aliases)." + distinguished from macros and aliases). + interactive-only + commands that normally shouldn't be called from Lisp code." :group 'bytecomp :type `(choice (const :tag "All" t) (set :menu-tag "Some" (const free-vars) (const unresolved) (const callargs) (const redefine) - (const obsolete) (const noruntime) (const cl-functions)))) + (const obsolete) (const noruntime) + (const cl-functions) (const interactive-only)))) + +(defvar byte-compile-interactive-only-functions + '(beginning-of-buffer end-of-buffer replace-string replace-regexp + insert-file) + "List of commands that are not meant to be called from Lisp.") (defvar byte-compile-not-obsolete-var nil "If non-nil, this is a variable that shouldn't be reported as obsolete.") @@ -2710,6 +2722,10 @@ If FORM is a lambda or a macro, byte-compile it as a function." (byte-compile-set-symbol-position fn) (when (byte-compile-const-symbol-p fn) (byte-compile-warn "`%s' called as a function" fn)) + (and (memq 'interactive-only byte-compile-warnings) + (memq (car form) byte-compile-interactive-only-functions) + (byte-compile-warn "`%s' used from Lisp code\n\ +That command is designed for interactive use only" fn)) (if (and handler (or (not (byte-compile-version-cond byte-compile-compatibility)) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 2439fdd4de6..b6b91710ed4 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -209,7 +209,7 @@ With zero or negative ARG turn mode off. ,@body ;; The on/off hooks are here for backward compatibility only. (run-hooks ',hook (if ,mode ',hook-on ',hook-off)) - (if (interactive-p) + (if (called-interactively-p) (progn ,(if globalp `(customize-mark-as-set ',mode)) (unless (current-message) diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index dbd7194f50a..e039b80aee5 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el @@ -42,7 +42,25 @@ menus, turn this variable off, otherwise it is probably better to keep it on." :version "20.3") (defsubst easy-menu-intern (s) - (if (stringp s) (intern (downcase s)) s)) + (if (stringp s) + (let ((copy (copy-sequence s)) + (pos 0) + found) + ;; For each letter that starts a word, flip its case. + ;; This way, the usual convention for menu strings (capitalized) + ;; corresponds to the usual convention for menu item event types + ;; (all lower case). It's a 1-1 mapping so causes no conflicts. + (while (setq found (string-match "\\<\\sw" copy pos)) + (setq pos (match-end 0)) + (unless (= (upcase (aref copy found)) + (downcase (aref copy found))) + (aset copy found + (if (= (upcase (aref copy found)) + (aref copy found)) + (downcase (aref copy found)) + (upcase (aref copy found)))))) + (intern copy)) + s)) ;;;###autoload (put 'easy-menu-define 'lisp-indent-function 'defun) diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el index 17991067fab..d701db9e9b6 100644 --- a/lisp/emacs-lisp/elp.el +++ b/lisp/emacs-lisp/elp.el @@ -257,7 +257,7 @@ FUNSYM must be a symbol of a defined function." (setq newguts (append newguts `((elp-wrapper (quote ,funsym) ,(when (commandp funsym) - '(interactive-p)) + '(called-interactively-p)) args)))) ;; to record profiling times, we set the symbol's function ;; definition so that it runs the elp-wrapper function with the diff --git a/lisp/emacs-lisp/lselect.el b/lisp/emacs-lisp/lselect.el index b292eefbaec..42dad0c48d8 100644 --- a/lisp/emacs-lisp/lselect.el +++ b/lisp/emacs-lisp/lselect.el @@ -1,6 +1,6 @@ ;;; lselect.el --- Lucid interface to X Selections -;; Copyright (C) 1990, 1993 Free Software Foundation, Inc. +;; Copyright (C) 1990, 1993, 2004 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: emulations @@ -146,7 +146,7 @@ secondary selection instead of the primary selection." (x-disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY))) (defun x-dehilight-selection (selection) - "for use as a value of x-lost-selection-hooks." + "for use as a value of `x-lost-selection-functions'." (cond ((eq selection 'PRIMARY) (if primary-selection-extent (let ((inhibit-quit t)) @@ -160,23 +160,23 @@ secondary selection instead of the primary selection." (setq secondary-selection-extent nil))))) nil) -(setq x-lost-selection-hooks 'x-dehilight-selection) +(setq x-lost-selection-functions 'x-dehilight-selection) (defun x-notice-selection-requests (selection type successful) - "for possible use as the value of x-sent-selection-hooks." + "for possible use as the value of `x-sent-selection-functions'." (if (not successful) (message "Selection request failed to convert %s to %s" selection type) (message "Sent selection %s as %s" selection type))) (defun x-notice-selection-failures (selection type successful) - "for possible use as the value of x-sent-selection-hooks." + "for possible use as the value of `x-sent-selection-functions'." (or successful (message "Selection request failed to convert %s to %s" selection type))) -;(setq x-sent-selection-hooks 'x-notice-selection-requests) -;(setq x-sent-selection-hooks 'x-notice-selection-failures) +;(setq x-sent-selection-functions 'x-notice-selection-requests) +;(setq x-sent-selection-functions 'x-notice-selection-failures) ;; Random utility functions @@ -232,5 +232,5 @@ the kill ring or the Clipboard." (provide 'lselect) -;;; arch-tag: 92fa54d4-c5d1-4e9b-ad58-cf1e13930556 +;; arch-tag: 92fa54d4-c5d1-4e9b-ad58-cf1e13930556 ;;; lselect.el ends here diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index fb3c537936f..523a07d26de 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el @@ -1,6 +1,7 @@ ;;; cua-base.el --- emulate CUA key bindings -;; Copyright (C) 1997,98,99,200,01,02,03,04 Free Software Foundation, Inc. +;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +;; Free Software Foundation, Inc. ;; Author: Kim F. Storm <storm@cua.dk> ;; Keywords: keyboard emulation convenience cua @@ -266,6 +267,7 @@ :group 'editing-basics :group 'convenience :group 'emulations + :version "21.4" :link '(emacs-commentary-link :tag "Commentary" "cua-base.el") :link '(emacs-library-link :tag "Lisp File" "cua-base.el")) @@ -1337,7 +1339,6 @@ paste (in addition to the normal emacs bindings)." :set-after '(cua-enable-modeline-indications cua-use-hyper-key) :require 'cua-base :link '(emacs-commentary-link "cua-base.el") - :version "21.4" (setq mark-even-if-inactive t) (setq highlight-nonselected-windows nil) (make-variable-buffer-local 'cua--explicit-region-start) diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index ce30cec6604..d932916d8c9 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -799,7 +799,7 @@ external command." (size 0.0)) (while entries (unless (string-match "\\`\\.\\.?\\'" (caar entries)) - (let* ((entry (concat path (char-to-string directory-sep-char) + (let* ((entry (concat path "/" (caar entries))) (symlink (and (stringp (cadr (car entries))) (cadr (car entries))))) diff --git a/lisp/fast-lock.el b/lisp/fast-lock.el index 6812361a28b..4a409bd77aa 100644 --- a/lisp/fast-lock.el +++ b/lisp/fast-lock.el @@ -26,7 +26,7 @@ ;;; Commentary: -;; Lazy Lock mode is a Font Lock support mode. +;; Fast Lock mode is a Font Lock support mode. ;; It makes visiting a file in Font Lock mode faster by restoring its face text ;; properties from automatically saved associated Font Lock cache files. ;; diff --git a/lisp/files.el b/lisp/files.el index c9fb3514b57..523a5a12f7b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -977,6 +977,14 @@ expand wildcards (if any) and visit multiple files." (mapcar 'switch-to-buffer (cdr value))) (switch-to-buffer-other-frame value)))) +(defun find-file-existing (filename &optional wildcards) + "Edit the existing file FILENAME. +Like \\[find-file] but only allow files that exists." + (interactive (find-file-read-args "Find existing file: " t)) + (unless (file-exists-p filename) (error "%s does not exist" filename)) + (find-file filename wildcards) + (current-buffer)) + (defun find-file-read-only (filename &optional wildcards) "Edit file FILENAME but don't allow changes. Like \\[find-file] but marks buffer as read-only. @@ -1225,6 +1233,7 @@ suppresses this warning." When nil, never request confirmation." :group 'files :group 'find-file + :version "21.4" :type '(choice integer (const :tag "Never request confirmation" nil))) (defun find-file-noselect (filename &optional nowarn rawfile wildcards) @@ -1645,7 +1654,9 @@ in that case, this function acts as if `enable-local-variables' were t." (mapc (lambda (elt) (cons (purecopy (car elt)) (cdr elt))) - '(("\\.te?xt\\'" . text-mode) + '(;; do this first, so that .html.pl is Polish html, not Perl + ("\\.s?html?\\(\\.[a-zA-Z_]+\\)?\\'" . html-mode) + ("\\.te?xt\\'" . text-mode) ("\\.[tT]e[xX]\\'" . tex-mode) ("\\.ins\\'" . tex-mode) ;Installation files for TeX packages. ("\\.ltx\\'" . latex-mode) @@ -1661,7 +1672,6 @@ in that case, this function acts as if `enable-local-variables' were t." ("\\.ad[abs]\\'" . ada-mode) ("\\.ad[bs].dg\\'" . ada-mode) ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode) - ("\\.s?html?\\'" . html-mode) ("\\.mk\\'" . makefile-mode) ("\\([Mm]\\|GNUm\\)akep*file\\'" . makefile-mode) ("\\.am\\'" . makefile-mode) ;For Automake. @@ -1689,7 +1699,8 @@ in that case, this function acts as if `enable-local-variables' were t." ("\\.bib\\'" . bibtex-mode) ("\\.sql\\'" . sql-mode) ("\\.m[4c]\\'" . m4-mode) - ("\\.m[fp]\\'" . metapost-mode) + ("\\.mf\\'" . metafont-mode) + ("\\.mp\\'" . metapost-mode) ("\\.vhdl?\\'" . vhdl-mode) ("\\.article\\'" . text-mode) ("\\.letter\\'" . text-mode) @@ -1834,20 +1845,27 @@ be interpreted by the interpreter matched by the second group of the regular expression. The mode is then determined as the mode associated with that interpreter in `interpreter-mode-alist'.") -(defvar xml-based-modes '(html-mode) - "Modes that override an XML declaration. -When `set-auto-mode' sees an <?xml or <!DOCTYPE declaration, that -buffer will be in some XML mode. If `auto-mode-alist' associates -the file with one of the modes in this list, that mode will be -used. Else `xml-mode' or `sgml-mode' is used.") - -(defun set-auto-mode (&optional just-from-file-name) +(defvar magic-mode-alist + '(;; The < comes before the groups (but the first) to reduce backtracking. + ;; Is there a nicer way of getting . including \n? + ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff. + ("\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\)?\\s *\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*[Hh][Tt][Mm][Ll]" . html-mode) + ;; These two must come after html, because they are more general: + ("<\\?xml " . xml-mode) + ("\\s *<\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*!DOCTYPE " . sgml-mode) + ("%![^V]" . ps-mode)) + "Alist of buffer beginnings vs corresponding major mode functions. +Each element looks like (REGEXP . FUNCTION). FUNCTION will be +called, unless it is nil.") + +(defun set-auto-mode (&optional keep-mode-if-same) "Select major mode appropriate for current buffer. + This checks for a -*- mode tag in the buffer's text, checks the interpreter that runs this file against `interpreter-mode-alist', -looks for an <?xml or <!DOCTYPE declaration (see -`xml-based-modes'), or compares the filename against the entries -in `auto-mode-alist'. +compares the buffer beginning against `magic-mode-alist', +or compares the filename against the entries in +`auto-mode-alist'. It does not check for the `mode:' local variable in the Local Variables section of the file; for that, use `hack-local-variables'. @@ -1855,88 +1873,103 @@ Local Variables section of the file; for that, use `hack-local-variables'. If `enable-local-variables' is nil, this function does not check for a -*- mode tag. -If the optional argument JUST-FROM-FILE-NAME is non-nil, -then we do not set anything but the major mode, -and we don't even do that unless it would come from the file name." +If the optional argument KEEP-MODE-IF-SAME is non-nil, then we +only set the major mode, if that would change it." ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- (let (end done mode modes xml) - (unless just-from-file-name - ;; Find a -*- mode tag - (save-excursion - (goto-char (point-min)) - (skip-chars-forward " \t\n") - ;; While we're at this point, check xml for later. - (setq xml (looking-at "<\\?xml \\|<!DOCTYPE")) - (and enable-local-variables - (setq end (set-auto-mode-1)) - (if (save-excursion (search-forward ":" end t)) - ;; Find all specifications for the `mode:' variable - ;; and execute them left to right. - (while (let ((case-fold-search t)) - (or (and (looking-at "mode:") - (goto-char (match-end 0))) - (re-search-forward "[ \t;]mode:" end t))) - (skip-chars-forward " \t") - (let ((beg (point))) - (if (search-forward ";" end t) - (forward-char -1) - (goto-char end)) - (skip-chars-backward " \t") - (push (intern (concat (downcase (buffer-substring beg (point))) "-mode")) - modes))) - ;; Simple -*-MODE-*- case. - (push (intern (concat (downcase (buffer-substring (point) end)) - "-mode")) - modes)))) - ;; If we found modes to use, invoke them now, outside the save-excursion. - (if modes + ;; Find a -*- mode tag + (save-excursion + (goto-char (point-min)) + (skip-chars-forward " \t\n") + ;; While we're at this point, check xml for later. + (setq xml (looking-at "<\\?xml \\|<!DOCTYPE")) + (and enable-local-variables + (setq end (set-auto-mode-1)) + (if (save-excursion (search-forward ":" end t)) + ;; Find all specifications for the `mode:' variable + ;; and execute them left to right. + (while (let ((case-fold-search t)) + (or (and (looking-at "mode:") + (goto-char (match-end 0))) + (re-search-forward "[ \t;]mode:" end t))) + (skip-chars-forward " \t") + (let ((beg (point))) + (if (search-forward ";" end t) + (forward-char -1) + (goto-char end)) + (skip-chars-backward " \t") + (push (intern (concat (downcase (buffer-substring beg (point))) "-mode")) + modes))) + ;; Simple -*-MODE-*- case. + (push (intern (concat (downcase (buffer-substring (point) end)) + "-mode")) + modes)))) + ;; If we found modes to use, invoke them now, outside the save-excursion. + (if modes + (catch 'nop (dolist (mode (nreverse modes)) (if (not (functionp mode)) (message "Ignoring unknown mode `%s'" mode) (setq done t) - (funcall mode))) - ;; If we didn't, look for an interpreter specified in the first line. - ;; As a special case, allow for things like "#!/bin/env perl", which - ;; finds the interpreter anywhere in $PATH. - (setq mode (save-excursion - (goto-char (point-min)) - (if (looking-at auto-mode-interpreter-regexp) - (match-string 2) - "")) - ;; Map interpreter name to a mode, signalling we're done at the - ;; same time. - done (assoc (file-name-nondirectory mode) - interpreter-mode-alist)) - ;; If we found an interpreter mode to use, invoke it now. - (if done (funcall (cdr done))))) - (if (and (not done) buffer-file-name) - (let ((name buffer-file-name)) - ;; Remove backup-suffixes from file name. - (setq name (file-name-sans-versions name)) - (while (not done) - ;; Find first matching alist entry. - (let ((case-fold-search - (memq system-type '(vax-vms windows-nt cygwin)))) - (if (and (setq mode (assoc-default name auto-mode-alist + (or (set-auto-mode-0 mode keep-mode-if-same) + (throw 'nop nil))))) + ;; If we didn't, look for an interpreter specified in the first line. + ;; As a special case, allow for things like "#!/bin/env perl", which + ;; finds the interpreter anywhere in $PATH. + (setq mode (save-excursion + (goto-char (point-min)) + (if (looking-at auto-mode-interpreter-regexp) + (match-string 2) + "")) + ;; Map interpreter name to a mode, signalling we're done at the + ;; same time. + done (assoc (file-name-nondirectory mode) + interpreter-mode-alist))) + ;; If we found an interpreter mode to use, invoke it now. + (if done + (set-auto-mode-0 (cdr done) keep-mode-if-same) + (if (setq done (save-excursion + (goto-char (point-min)) + (assoc-default nil magic-mode-alist + (lambda (re dummy) + (looking-at re))))) + (set-auto-mode-0 done keep-mode-if-same) + (if buffer-file-name + (let ((name buffer-file-name)) + ;; Remove backup-suffixes from file name. + (setq name (file-name-sans-versions name)) + (while name + ;; Find first matching alist entry. + (let ((case-fold-search + (memq system-type '(vax-vms windows-nt cygwin)))) + (if (and (setq mode (assoc-default name auto-mode-alist 'string-match)) - (consp mode) - (cadr mode)) - (setq mode (car mode) - name (substring name 0 (match-beginning 0))) - (setq done t))) - (if mode - ;; When JUST-FROM-FILE-NAME is set, we are working on behalf - ;; of set-visited-file-name. In that case, if the major mode - ;; specified is the same one we already have, don't actually - ;; reset it. We don't want to lose minor modes such as Font - ;; Lock. - (unless (and just-from-file-name (eq mode major-mode)) - (if (if xml (memq mode xml-based-modes) t) - (funcall mode) - (xml-mode))))))) - (and (not done) - xml - (xml-mode)))) + (consp mode) + (cadr mode)) + (setq mode (car mode) + name (substring name 0 (match-beginning 0))) + (setq name))) + (when mode + (set-auto-mode-0 mode keep-mode-if-same))))))))) + + +;; When `keep-mode-if-same' is set, we are working on behalf of +;; set-visited-file-name. In that case, if the major mode specified is the +;; same one we already have, don't actually reset it. We don't want to lose +;; minor modes such as Font Lock. +(defun set-auto-mode-0 (mode &optional keep-mode-if-same) + "Apply MODE and return it. +If optional arg KEEP-MODE-IF-SAME is non-nil, MODE is chased of +any aliases and compared to current major mode. If they are the +same, do nothing and return nil." + (when keep-mode-if-same + (while (symbolp (symbol-function mode)) + (setq mode (symbol-function mode))) + (if (eq mode major-mode) + (setq mode nil))) + (when mode + (funcall mode) + mode)) (defun set-auto-mode-1 () @@ -3797,7 +3830,7 @@ This command is used in the special Dired buffer created by (defun kill-some-buffers (&optional list) "Kill some buffers. Asks the user whether to kill each one of them. -Non-interactively, if optional argument LIST is non-`nil', it +Non-interactively, if optional argument LIST is non-nil, it specifies the list of buffers to kill, asking for approval for each one." (interactive) (if (null list) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 02d8fe24007..0b93724e9e5 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,158 @@ +2004-11-04 Katsumi Yamaoka <yamaoka@jpl.org> + + * gnus-art. (gnus-article-edit-article): Don't associate the + article buffer with a draft file. This is a temporary measure + against the 2004-08-22 change to gnus-article-edit-mode. + +2004-11-02 Katsumi Yamaoka <yamaoka@jpl.org> + + * html2text.el (html2text-get-attr): Remove unused argument `tag'. + (html2text-format-tags): Remove unused variable `attr'. + + * mm-util.el (mm-enrich-utf-8-by-mule-ucs): Fix cleaning of + after-load-alist. + + * mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 + entry. From Ilya N. Golubev <gin@mo.msk.ru>. + (mm-enrich-utf-8-by-mule-ucs): New function run when Mule-UCS is + loaded under XEmacs. + (): Don't make duplicated entries in mm-mime-mule-charset-alist. + + * mm-util.el (mm-coding-system-p): Return a coding-system. + (mm-mime-mule-charset-alist): Use shift_jis instead of + iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new + entries for the mime charsets iso-2022-jp-3 and shift_jis. + (mm-coding-system-priorities): Use shift_jis and iso-8859-1 + instead of japanese-shift-jis and iso-latin-1 respectively in + order to share the default value with both Emacs and XEmacs-mule. + (mm-mule-charset-to-mime-charset): Make + mm-coding-system-priorities effective. + (mm-sort-coding-systems-predicate): Canonicalize coding-systems + while predicating of candidates upon the priorities. + +2004-11-01 Reiner Steib <Reiner.Steib@gmx.de> + + * gnus-msg.el (gnus-summary-resend-default-address): Add :version. + + * tls.el (tls-process-connection-type, tls-success) + (tls-certtool-program): Add :version. + + * starttls.el (starttls-gnutls-program, starttls-use-gnutls) + (starttls-extra-arguments, starttls-process-connection-type) + (starttls-connect, starttls-failure, starttls-success): + + * spam-stat.el (spam-stat): Add :version. + + * sieve.el (sieve): Add :version. + + * sha1.el (sha1): Added :version. + (sha1-use-external): Removed redundant version. + + * nnmail.el (nnmail-split-fancy-with-parent-ignore-groups) + (nnmail-cache-ignore-groups, nnmail-spool-hook) + (nnmail-split-fancy-match-partial-words) + (nnmail-split-lowercase-expanded): + + * nndiary.el (nndiary): Add :version. + + * mml2015.el (mml2015-unabbrev-trust-alist): Add :version. + + * mml-sec.el (mml-default-sign-method) + (mml-default-encrypt-method, mml-signencrypt-style-alist): Add + :version. + + * mm-uu.el (mm-uu-diff-groups-regexp): Add :version. + + * mm-url.el (mm-url-use-external, mm-url-program) + (mm-url-arguments): Add :version. + + * mm-decode.el (mm-inline-text-html-with-w3m-keymap) + (mm-attachment-file-modes, mm-decrypt-option) + (mm-w3m-safe-url-regexp): Add :version. + + * message.el (message-cite-prefix-regexp) + (message-sendmail-envelope-from, message-minibuffer-local-map) + (message-user-fqdn, message-completion-alist): Add :version. + + * gnus-win.el (gnus-configure-windows-hook) + (gnus-use-frames-on-any-display): Add :version. + + * gnus-art.el (gnus-article-address-banner-alist) + (gnus-treat-unsplit-urls, gnus-treat-unfold-headers) + (gnus-treat-from-picon, gnus-treat-mail-picon) + (gnus-treat-x-pgp-sig): Add :version. + + * gnus-sum.el (gnus-spam-mark, gnus-recent-mark) + (gnus-undownloaded-mark, gnus-summary-article-move-hook) + (gnus-summary-article-delete-hook) + (gnus-summary-display-while-building): Add :version. + + * gnus-start.el (gnus-subscribe-newsgroup-hooks) + (gnus-get-top-new-news-hook):Add :version. + + * gnus-srvr.el (gnus-server-agent-face, gnus-server-opened-face) + (gnus-server-closed-face, gnus-server-denied-face): Add :version. + + * gnus-registry.el (gnus-registry): Add :version. + + * gnus-spec.el (gnus-use-correct-string-widths) + (gnus-make-format-preserve-properties): Add :version. + + * gnus.el (gnus-group-charter-alist) + (gnus-group-fetch-control-use-browse-url) + (gnus-install-group-spam-parameters): Add :version. + + * gnus-diary.el (gnus-diary): Add :version. + + * gnus-delay.el (gnus-delay): Add :version. + + * gnus-cite.el (gnus-cite-unsightly-citation-regexp) + (gnus-cite-ignore-quoted-from, gnus-cite-attribution-face) + (gnus-cite-blank-line-after-header, gnus-article-boring-faces): + Add :version. + + * gnus-agent.el (gnus-agent-max-fetch-size) + (gnus-agent-enable-expiration, gnus-agent-queue-mail) + (gnus-agent-prompt-send-queue): Add :version. + + * deuglify.el (gnus-outlook-deuglify): Add :version. + + * html2text.el: Beautify code. Improve doc strings. Some checkdoc + cleanup. + (html2text-get-attr, html2text-fix-paragraph): Simplify code. + (html2text-format-tag-list): Added "strong" and "em". From + "Alfred M. Szmidt" <ams@kemisten.nu> (tiny change). + +2004-10-29 Katsumi Yamaoka <yamaoka@jpl.org> + + * gnus-msg.el (gnus-configure-posting-styles): Work with empty + signature file. Suggested by Manoj Srivastava + <srivasta@golden-gryphon.com>. + + * mm-util.el (mm-coding-system-priorities): Prefer iso-8859-1 than + iso-2022-jp even in the Japanese language environment. Suggested + by Jason Rumney <jasonr@gnu.org>. + +2004-10-28 Katsumi Yamaoka <yamaoka@jpl.org> + + * gnus-sum.el (gnus-update-summary-mark-positions): Allow users to + use the same characters as the dummy marks; make it free from + getting affected by the language environment. + (gnus-summary-read-group-1): Update mark positions only when the + format spec is updated. + + * gnus-spec.el (gnus-update-format-specifications): Return a list + of updated types. + +2004-10-26 Katsumi Yamaoka <yamaoka@jpl.org> + + * nnspool.el (nnspool-spool-directory): Use news-path if the + news-directory variable is not bound. + + * gnus-group.el (gnus-group-line-format-alist): Convert the value + of gnus-tmp-news-method into string if it may be passed to + gnus-correct-length which takes only a string argument. + 2004-10-25 Reiner Steib <Reiner.Steib@gmx.de> * html2text.el (html2text-buffer-head): Removed. Use `goto-char' diff --git a/lisp/gnus/deuglify.el b/lisp/gnus/deuglify.el index 07e630d793b..4fe1001a050 100644 --- a/lisp/gnus/deuglify.el +++ b/lisp/gnus/deuglify.el @@ -230,7 +230,8 @@ ;;; User Customizable Variables: (defgroup gnus-outlook-deuglify nil - "Deuglify articles generated by broken user agents like MS Outlook (Express).") + "Deuglify articles generated by broken user agents like MS Outlook (Express)." + :version "21.4") ;;;###autoload (defcustom gnus-outlook-deuglify-unwrap-min 45 diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index c62460946ab..23fcbbde5df 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -160,6 +160,7 @@ read articles as they would just be downloaded again." "Chunk size for `gnus-agent-fetch-session'. The function will split its article fetches into chunks smaller than this limit." + :version "21.4" :group 'gnus-agent :type 'integer) @@ -170,6 +171,7 @@ contents from a group's local storage. This value may be overridden to disable expiration in specific categories, topics, and groups. Of course, you could change gnus-agent-enable-expiration to DISABLE then enable expiration per categories, topics, and groups." + :version "21.4" :group 'gnus-agent :type '(radio (const :format "Enable " ENABLE) (const :format "Disable " DISABLE))) @@ -195,6 +197,7 @@ See Info node `(gnus)Server Buffer'." "Whether and when outgoing mail should be queued by the agent. When `always', always queue outgoing mail. When nil, never queue. Otherwise, queue if and only if unplugged." + :version "21.4" :group 'gnus-agent :type '(radio (const :format "Always" always) (const :format "Never" nil) @@ -203,6 +206,7 @@ queue. Otherwise, queue if and only if unplugged." (defcustom gnus-agent-prompt-send-queue nil "If non-nil, `gnus-group-send-queue' will prompt if called when unplugged." + :version "21.4" :group 'gnus-agent :type 'boolean) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 7a365d81a2c..c0266300983 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -318,6 +318,7 @@ advertisements. For example: (symbol :tag "Item in `gnus-article-banner-alist'" none) regexp (const :tag "None" nil)))) + :version "21.4" :group 'gnus-article-washing) (defcustom gnus-emphasis-alist @@ -920,6 +921,7 @@ See Info node `(gnus)Customizing Articles' for details." "Remove newlines from within URLs. Valid values are nil, t, `head', `last', an integer or a predicate. See Info node `(gnus)Customizing Articles' for details." + :version "21.4" :group 'gnus-article-treat :link '(custom-manual "(gnus)Customizing Articles") :type gnus-article-treat-custom) @@ -1124,6 +1126,7 @@ See Info node `(gnus)Customizing Articles' for details." "Unfold folded header lines. Valid values are nil, t, `head', `last', an integer or a predicate. See Info node `(gnus)Customizing Articles' for details." + :version "21.4" :group 'gnus-article-treat :link '(custom-manual "(gnus)Customizing Articles") :type gnus-article-treat-custom) @@ -1238,6 +1241,7 @@ See Info node `(gnus)Customizing Articles' and Info node Valid values are nil, t, `head', `last', an integer or a predicate. See Info node `(gnus)Customizing Articles' and Info node `(gnus)Picons' for details." + :version "21.4" :group 'gnus-article-treat :group 'gnus-picon :link '(custom-manual "(gnus)Customizing Articles") @@ -1253,6 +1257,7 @@ See Info node `(gnus)Customizing Articles' and Info node Valid values are nil, t, `head', `last', an integer or a predicate. See Info node `(gnus)Customizing Articles' and Info node `(gnus)Picons' for details." + :version "21.4" :group 'gnus-article-treat :group 'gnus-picon :link '(custom-manual "(gnus)Customizing Articles") @@ -1338,6 +1343,7 @@ See Info node `(gnus)Customizing Articles' for details." To automatically treat X-PGP-Sig, set it to head. Valid values are nil, t, `head', `last', an integer or a predicate. See Info node `(gnus)Customizing Articles' for details." + :version "21.4" :group 'gnus-article-treat :group 'mime-security :link '(custom-manual "(gnus)Customizing Articles") @@ -5645,7 +5651,10 @@ groups." "Start editing the contents of the current article buffer." (let ((winconf (current-window-configuration))) (set-buffer gnus-article-buffer) - (gnus-article-edit-mode) + (let ((message-auto-save-directory + ;; Don't associate the article buffer with a draft file. + nil)) + (gnus-article-edit-mode)) (funcall start-func) (set-buffer-modified-p nil) (gnus-configure-windows 'edit-article) diff --git a/lisp/gnus/gnus-cite.el b/lisp/gnus/gnus-cite.el index bf9f5863428..5306f3b17bf 100644 --- a/lisp/gnus/gnus-cite.el +++ b/lisp/gnus/gnus-cite.el @@ -124,6 +124,7 @@ The text matching the first grouping will be used as a button." (defcustom gnus-cite-unsightly-citation-regexp "^-----Original Message-----\nFrom: \\(.+\n\\)+\n" "Regexp matching Microsoft-type rest-of-message citations." + :version "21.4" :group 'gnus-cite :type 'regexp) @@ -131,6 +132,7 @@ The text matching the first grouping will be used as a button." "Non-nil means don't regard lines beginning with \">From \" as cited text. Those lines may have been quoted by MTAs in order not to mix up with the envelope From line." + :version "21.4" :group 'gnus-cite :type 'boolean) @@ -141,6 +143,7 @@ the envelope From line." (defcustom gnus-cite-attribution-face 'gnus-cite-attribution-face "Face used for attribution lines. It is merged with the face for the cited text belonging to the attribution." + :version "21.4" :group 'gnus-cite :type 'face) @@ -278,7 +281,6 @@ This should make it easier to see who wrote what." (defcustom gnus-cite-blank-line-after-header t "If non-nil, put a blank line between the citation header and the button." - :version "21.4" :group 'gnus-cite :type 'boolean) @@ -290,7 +292,6 @@ This should make it easier to see who wrote what." If an article has more pages below the one you are looking at, but nothing on those pages is a word of at least three letters that is not in a boring face, then the pages will be skipped." - :version "21.4" :type '(repeat face) :group 'gnus-article-hiding) diff --git a/lisp/gnus/gnus-delay.el b/lisp/gnus/gnus-delay.el index ee431076fad..8a566e3e5d8 100644 --- a/lisp/gnus/gnus-delay.el +++ b/lisp/gnus/gnus-delay.el @@ -41,6 +41,7 @@ ;;;###autoload (defgroup gnus-delay nil "Arrange for sending postings later." + :version "21.4" :group 'gnus) (defcustom gnus-delay-group "delayed" diff --git a/lisp/gnus/gnus-diary.el b/lisp/gnus/gnus-diary.el index e82d77fa58b..7d2df362bbc 100644 --- a/lisp/gnus/gnus-diary.el +++ b/lisp/gnus/gnus-diary.el @@ -102,7 +102,8 @@ (require 'gnus-art) (defgroup gnus-diary nil - "Utilities on top of the nndiary backend for Gnus.") + "Utilities on top of the nndiary backend for Gnus." + :version "21.4") (defcustom gnus-diary-summary-line-format "%U%R%z %uD: %(%s%) (%ud)\n" "*Summary line format for nndiary groups." diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index f3b2f91cd5e..c55264b22de 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -491,7 +491,10 @@ simple manner.") (?O gnus-tmp-moderated-string ?s) (?p gnus-tmp-process-marked ?c) (?s gnus-tmp-news-server ?s) - (?n gnus-tmp-news-method ?s) + (?n ,(if (featurep 'xemacs) + '(symbol-name gnus-tmp-news-method) + 'gnus-tmp-news-method) + ?s) (?P gnus-group-indentation ?s) (?E gnus-tmp-group-icon ?s) (?B gnus-tmp-summary-live ?c) diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 7dcef4b813b..6b093480940 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -281,6 +281,7 @@ If nil, Gnus will never ask for confirmation if replying to mail." "If non-nil, Gnus tries to suggest a default address to resend to. If nil, the address field will always be empty after invoking `gnus-summary-resend-message'." + :version "21.4" :group 'gnus-message :type 'boolean) @@ -1871,8 +1872,9 @@ this is a reply." (setq v (with-temp-buffer (insert-file-contents v) (goto-char (point-max)) - (while (bolp) - (delete-char -1)) + (skip-chars-backward "\n") + (delete-region (+ (point) (if (bolp) 0 1)) + (point-max)) (buffer-string)))) (setq results (delq (assoc element results) results)) (push (cons element v) results)))) diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 841f0057566..046114cbe24 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -66,6 +66,7 @@ (defgroup gnus-registry nil "The Gnus registry." + :version "21.4" :group 'gnus) (defvar gnus-registry-hashtb nil diff --git a/lisp/gnus/gnus-spec.el b/lisp/gnus/gnus-spec.el index 690fc7e026a..1177df4731a 100644 --- a/lisp/gnus/gnus-spec.el +++ b/lisp/gnus/gnus-spec.el @@ -32,12 +32,14 @@ (defcustom gnus-use-correct-string-widths (featurep 'xemacs) "*If non-nil, use correct functions for dealing with wide characters." + :version "21.4" :group 'gnus-format :type 'boolean) (defcustom gnus-make-format-preserve-properties (featurep 'xemacs) "*If non-nil, use a replacement `format' function which preserves text properties. This is only needed on XEmacs, as FSF Emacs does this anyway." + :version "21.4" :group 'gnus-format :type 'boolean) @@ -183,7 +185,8 @@ text properties. This is only needed on XEmacs, as FSF Emacs does this anyway." (insert (gnus-pp-to-string spec)))) (defun gnus-update-format-specifications (&optional force &rest types) - "Update all (necessary) format specifications." + "Update all (necessary) format specifications. +Return a list of updated types." ;; Make the indentation array. ;; See whether all the stored info needs to be flushed. (when (or force @@ -195,13 +198,12 @@ text properties. This is only needed on XEmacs, as FSF Emacs does this anyway." (setq gnus-format-specs nil)) ;; Go through all the formats and see whether they need updating. - (let (new-format entry type val) + (let (new-format entry type val updated) (while (setq type (pop types)) ;; Jump to the proper buffer to find out the value of the ;; variable, if possible. (It may be buffer-local.) (save-excursion - (let ((buffer (intern (format "gnus-%s-buffer" type))) - val) + (let ((buffer (intern (format "gnus-%s-buffer" type)))) (when (and (boundp buffer) (setq val (symbol-value buffer)) (gnus-buffer-exists-p val)) @@ -231,10 +233,12 @@ text properties. This is only needed on XEmacs, as FSF Emacs does this anyway." (setcar (cdr entry) val) (setcar entry new-format)) (push (list type new-format val) gnus-format-specs)) - (set (intern (format "gnus-%s-line-format-spec" type)) val))))) + (set (intern (format "gnus-%s-line-format-spec" type)) val) + (push type updated)))) - (unless (assq 'version gnus-format-specs) - (push (cons 'version emacs-version) gnus-format-specs))) + (unless (assq 'version gnus-format-specs) + (push (cons 'version emacs-version) gnus-format-specs)) + updated)) (defvar gnus-mouse-face-0 'highlight) (defvar gnus-mouse-face-1 'highlight) diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el index 7fef378722a..d42c5d71cfd 100644 --- a/lisp/gnus/gnus-srvr.el +++ b/lisp/gnus/gnus-srvr.el @@ -205,21 +205,25 @@ If nil, a faster, but more primitive, buffer is used instead." (defcustom gnus-server-agent-face 'gnus-server-agent-face "Face name to use on AGENTIZED servers." + :version "21.4" :group 'gnus-server-visual :type 'face) (defcustom gnus-server-opened-face 'gnus-server-opened-face "Face name to use on OPENED servers." + :version "21.4" :group 'gnus-server-visual :type 'face) (defcustom gnus-server-closed-face 'gnus-server-closed-face "Face name to use on CLOSED servers." + :version "21.4" :group 'gnus-server-visual :type 'face) (defcustom gnus-server-denied-face 'gnus-server-denied-face "Face name to use on DENIED servers." + :version "21.4" :group 'gnus-server-visual :type 'face) diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index ecce9f00b37..e51227063f0 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -299,6 +299,7 @@ claim them." (defcustom gnus-subscribe-newsgroup-hooks nil "*Hooks run after you subscribe to a new group. The hooks will be called with new group's name as argument." + :version "21.4" :group 'gnus-group-new :type 'hook) @@ -405,6 +406,7 @@ This hook is called as the first thing when Gnus is started." (defcustom gnus-get-top-new-news-hook nil "A hook run just before Gnus checks for new news globally." + :version "21.4" :group 'gnus-group-new :type 'hook) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 68f40b3a7bb..33abc379ff4 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -469,6 +469,7 @@ this variable specifies group names." (defcustom gnus-spam-mark ?$ "*Mark used for spam articles." + :version "21.4" :group 'gnus-summary-marks :type 'character) @@ -505,6 +506,7 @@ this variable specifies group names." (defcustom gnus-recent-mark ?N "*Mark used for articles that are recent." + :version "21.4" :group 'gnus-summary-marks :type 'character) @@ -552,6 +554,7 @@ this variable specifies group names." (defcustom gnus-undownloaded-mark ?- "*Mark used for articles that weren't downloaded." + :version "21.4" :group 'gnus-summary-marks :type 'character) @@ -890,16 +893,19 @@ automatically when it is selected." (defcustom gnus-summary-article-move-hook nil "*A hook called after an article is moved, copied, respooled, or crossposted." + :version "21.4" :group 'gnus-summary :type 'hook) (defcustom gnus-summary-article-delete-hook nil "*A hook called after an article is deleted." + :version "21.4" :group 'gnus-summary :type 'hook) (defcustom gnus-summary-article-expire-hook nil "*A hook called after an article is expired." + :version "21.4" :group 'gnus-summary :type 'hook) @@ -3225,43 +3231,54 @@ buffer that was in action when the last article was fetched." (save-excursion (when (gnus-buffer-exists-p gnus-summary-buffer) (set-buffer gnus-summary-buffer)) - (let ((gnus-replied-mark 129) - (gnus-score-below-mark 130) - (gnus-score-over-mark 130) - (gnus-undownloaded-mark 131) - (spec gnus-summary-line-format-spec) - gnus-visual pos) + (let ((spec gnus-summary-line-format-spec) + pos) (save-excursion (gnus-set-work-buffer) - (let ((gnus-summary-line-format-spec spec) + (let ((gnus-tmp-unread ?Z) + (gnus-replied-mark ?Z) + (gnus-score-below-mark ?Z) + (gnus-score-over-mark ?Z) + (gnus-undownloaded-mark ?Z) + (gnus-summary-line-format-spec spec) (gnus-newsgroup-downloadable '(0)) - marks) - (insert ?\200 "\200" ?\201 "\201" ?\202 "\202" ?\203 "\203") - (while (not (bobp)) - (push (buffer-substring (1- (point)) (point)) marks) - (backward-char)) + (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil]) + case-fold-search ignores) + ;; Here, all marks are bound to Z. + (gnus-summary-insert-line header + 0 nil t gnus-tmp-unread t nil "" nil 1) + (goto-char (point-min)) + ;; Memorize the positions of the same characters as dummy marks. + (while (re-search-forward "[A-D]" nil t) + (push (point) ignores)) (erase-buffer) - (gnus-summary-insert-line - [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil] - 0 nil t 128 t nil "" nil 1) + ;; We use A-D as dummy marks in order to know column positions + ;; where marks should be inserted. + (setq gnus-tmp-unread ?A + gnus-replied-mark ?B + gnus-score-below-mark ?C + gnus-score-over-mark ?C + gnus-undownloaded-mark ?D) + (gnus-summary-insert-line header + 0 nil t gnus-tmp-unread t nil "" nil 1) + ;; Ignore characters which aren't dummy marks. + (dolist (p ignores) + (delete-region (goto-char (1- p)) p) + (insert ?Z)) (goto-char (point-min)) (setq pos (list (cons 'unread - (and (or (search-forward (nth 0 marks) nil t) - (search-forward (nth 1 marks) nil t)) + (and (search-forward "A" nil t) (- (point) (point-min) 1))))) (goto-char (point-min)) - (push (cons 'replied (and (or (search-forward (nth 2 marks) nil t) - (search-forward (nth 3 marks) nil t)) + (push (cons 'replied (and (search-forward "B" nil t) (- (point) (point-min) 1))) pos) (goto-char (point-min)) - (push (cons 'score (and (or (search-forward (nth 4 marks) nil t) - (search-forward (nth 5 marks) nil t)) + (push (cons 'score (and (search-forward "C" nil t) (- (point) (point-min) 1))) pos) (goto-char (point-min)) - (push (cons 'download (and (or (search-forward (nth 6 marks) nil t) - (search-forward (nth 7 marks) nil t)) + (push (cons 'download (and (search-forward "D" nil t) (- (point) (point-min) 1))) pos))) (setq gnus-summary-mark-positions pos)))) @@ -3559,9 +3576,11 @@ If NO-DISPLAY, don't generate a summary buffer." (gnus-active gnus-newsgroup-name))) ;; You can change the summary buffer in some way with this hook. (gnus-run-hooks 'gnus-select-group-hook) - (gnus-update-format-specifications - nil 'summary 'summary-mode 'summary-dummy) - (gnus-update-summary-mark-positions) + (when (memq 'summary (gnus-update-format-specifications + nil 'summary 'summary-mode 'summary-dummy)) + ;; The format specification for the summary line was updated, + ;; so we need to update the mark positions as well. + (gnus-update-summary-mark-positions)) ;; Do score processing. (when gnus-use-scoring (gnus-possibly-score-headers)) @@ -9165,6 +9184,7 @@ If nil, use to the current newsgroup method." "If non-nil, show and update the summary buffer as it's being built. If the value is t, update the buffer after every line is inserted. If the value is an integer (N), update the display every N lines." + :version "21.4" :group 'gnus-thread :type '(choice (const :tag "off" nil) number diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el index 8de4673fddc..554c9dc3437 100644 --- a/lisp/gnus/gnus-win.el +++ b/lisp/gnus/gnus-win.el @@ -62,6 +62,7 @@ "*If non-nil, frames on all displays will be considered useable by Gnus. When nil, only frames on the same display as the selected frame will be used to display Gnus windows." + :version "21.4" :group 'gnus-windows :type 'boolean) @@ -198,6 +199,7 @@ See the Gnus manual for an explanation of the syntax used.") (defcustom gnus-configure-windows-hook nil "*A hook called when configuring windows." + :version "21.4" :group 'gnus-windows :type 'hook) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index bff1c3bba2f..c8dc878eacd 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -1314,6 +1314,7 @@ If the default site is too slow, try one of these: (gnus-replace-in-string name "\\." "-") "-charter.html"))) "*An alist of (HIERARCHY . FORM) pairs used to construct the URL of a charter. When FORM is evaluated `name' is bound to the name of the group." + :version "21.4" :group 'gnus-group-various :type '(repeat (cons (string :tag "Hierarchy") (sexp :tag "Form")))) @@ -1321,6 +1322,7 @@ When FORM is evaluated `name' is bound to the name of the group." "*Non-nil means that control messages are displayed using `browse-url'. Otherwise they are fetched with ange-ftp and displayed in an ephemeral group." + :version "21.4" :group 'gnus-group-various :type 'boolean) @@ -1788,6 +1790,7 @@ total number of articles in the group.") (defcustom gnus-install-group-spam-parameters t "*Disable the group parameters for spam detection. Enable if `G c' in XEmacs is giving you trouble, and make sure to submit a bug report." + :version "21.4" :type 'boolean :group 'gnus-start) diff --git a/lisp/gnus/html2text.el b/lisp/gnus/html2text.el index 31d1869c695..ef05af9bae6 100644 --- a/lisp/gnus/html2text.el +++ b/lisp/gnus/html2text.el @@ -24,11 +24,11 @@ ;; These functions provide a simple way to wash/clean html infected ;; mails. Definitely do not work in all cases, but some improvement -;; in readability is generally obtained. Formatting is only done in +;; in readability is generally obtained. Formatting is only done in ;; the buffer, so the next time you enter the article it will be ;; "re-htmlized". ;; -;; The main function is "html2text" +;; The main function is `html2text'. ;;; Code: @@ -47,9 +47,9 @@ "The map of entity to text. This is an alist were each element is a dotted pair consisting of an -old string, and a replacement string. This replacement is done by the -function \"html2text-substitute\" which basically performs a -replace-string operation for every element in the list. This is +old string, and a replacement string. This replacement is done by the +function `html2text-substitute' which basically performs a +`replace-string' operation for every element in the list. This is completely verbatim - without any use of REGEXP.") (defvar html2text-remove-tag-list @@ -57,11 +57,11 @@ completely verbatim - without any use of REGEXP.") "A list of removable tags. This is a list of tags which should be removed, without any -formatting. Observe that if you the tags in the list are presented -*without* any \"<\" or \">\". All occurences of a tag appearing in -this list are removed, irrespective of whether it is a closing or -opening tag, or if the tag has additional attributes. The actual -deletion is done by the function \"html2text-remove-tags\". +formatting. Note that tags in the list are presented *without* +any \"<\" or \">\". All occurences of a tag appearing in this +list are removed, irrespective of whether it is a closing or +opening tag, or if the tag has additional attributes. The +deletion is done by the function `html2text-remove-tags'. For instance the text: @@ -75,8 +75,10 @@ If this list contains the element \"font\".") (defvar html2text-format-tag-list '(("b" . html2text-clean-bold) + ("strong" . html2text-clean-bold) ("u" . html2text-clean-underline) ("i" . html2text-clean-italic) + ("em" . html2text-clean-italic) ("blockquote" . html2text-clean-blockquote) ("a" . html2text-clean-anchor) ("ul" . html2text-clean-ul) @@ -86,7 +88,7 @@ If this list contains the element \"font\".") "An alist of tags and processing functions. This is an alist where each dotted pair consists of a tag, and then -the name of a function to be called when this tag is found. The +the name of a function to be called when this tag is found. The function is called with the arguments p1, p2, p3 and p4. These are demontrated below: @@ -117,17 +119,15 @@ formatting, and then moved afterward.") ;; -(defun html2text-replace-string (from-string to-string p1 p2) - (goto-char p1) +(defun html2text-replace-string (from-string to-string min max) + "Replace FROM-STRING with TO-STRING in region from MIN to MAX." + (goto-char min) (let ((delta (- (string-width to-string) (string-width from-string))) (change 0)) - (while (search-forward from-string p2 t) + (while (search-forward from-string max t) (replace-match to-string) - (setq change (+ change delta)) - ) - change - ) - ) + (setq change (+ change delta))) + change)) ;; ;; </Utility functions> @@ -140,11 +140,11 @@ formatting, and then moved afterward.") ;; <Functions related to attributes> i.e. <font size=+3> ;; -(defun html2text-attr-value (attr-list attr) - (nth 1 (assoc attr attr-list)) - ) +(defun html2text-attr-value (list attribute) + "Get value of ATTRIBUTE from LIST." + (nth 1 (assoc attribute list))) -(defun html2text-get-attr (p1 p2 tag) +(defun html2text-get-attr (p1 p2) (goto-char p1) (re-search-forward " +[^ ]" p2 t) (let* ((attr-string (buffer-substring-no-properties (1- (point)) (1- p2))) @@ -161,14 +161,10 @@ formatting, and then moved afterward.") ((string-match "[^ ]=[^ ]" prev) (let ((attr (nth 0 (split-string prev "="))) (value (nth 1 (split-string prev "=")))) - (setq attr-list (cons (list attr value) attr-list)) - ) - ) + (setq attr-list (cons (list attr value) attr-list)))) ;; size= 3 ((string-match "[^ ]=\\'" prev) - (setq attr-list (cons (list (substring prev 0 -1) this) attr-list)) - ) - ) + (setq attr-list (cons (list (substring prev 0 -1) this) attr-list)))) (while (< index (length tmp-list)) (cond @@ -176,29 +172,20 @@ formatting, and then moved afterward.") ((string-match "[^ ]=[^ ]" this) (let ((attr (nth 0 (split-string this "="))) (value (nth 1 (split-string this "=")))) - (setq attr-list (cons (list attr value) attr-list)) - ) - ) + (setq attr-list (cons (list attr value) attr-list)))) ;; size =3 ((string-match "\\`=[^ ]" this) (setq attr-list (cons (list prev (substring this 1)) attr-list))) - ;; size= 3 ((string-match "[^ ]=\\'" this) - (setq attr-list (cons (list (substring this 0 -1) next) attr-list)) - ) - + (setq attr-list (cons (list (substring this 0 -1) next) attr-list))) ;; size = 3 ((string= "=" this) - (setq attr-list (cons (list prev next) attr-list)) - ) - ) + (setq attr-list (cons (list prev next) attr-list)))) (setq index (1+ index)) (setq prev this) (setq this next) - (setq next (nth (1+ index) tmp-list)) - ) - + (setq next (nth (1+ index) tmp-list))) ;; ;; Tags with no accompanying "=" i.e. value=nil ;; @@ -207,41 +194,25 @@ formatting, and then moved afterward.") (setq next (nth 2 tmp-list)) (setq index 1) - (if (not (string-match "=" prev)) - (progn - (if (not (string= (substring this 0 1) "=")) - (setq attr-list (cons (list prev nil) attr-list)) - ) - ) - ) - + (when (and (not (string-match "=" prev)) + (not (string= (substring this 0 1) "="))) + (setq attr-list (cons (list prev nil) attr-list))) (while (< index (1- (length tmp-list))) - (if (not (string-match "=" this)) - (if (not (or (string= (substring next 0 1) "=") - (string= (substring prev -1) "="))) - (setq attr-list (cons (list this nil) attr-list)) - ) - ) + (when (and (not (string-match "=" this)) + (not (or (string= (substring next 0 1) "=") + (string= (substring prev -1) "=")))) + (setq attr-list (cons (list this nil) attr-list))) (setq index (1+ index)) (setq prev this) (setq this next) - (setq next (nth (1+ index) tmp-list)) - ) - - (if this - (progn - (if (not (string-match "=" this)) - (progn - (if (not (string= (substring prev -1) "=")) - (setq attr-list (cons (list this nil) attr-list)) - ) - ) - ) - ) - ) - attr-list ;; return - value - ) - ) + (setq next (nth (1+ index) tmp-list))) + + (when (and this + (not (string-match "=" this)) + (not (string= (substring prev -1) "="))) + (setq attr-list (cons (list this nil) attr-list))) + ;; return - value + attr-list)) ;; ;; </Functions related to attributes> @@ -266,10 +237,7 @@ formatting, and then moved afterward.") (cond ((string= list-type "ul") (insert " o ")) ((string= list-type "ol") (insert (format " %s: " item-nr))) - (t (insert " x "))) - ) - ) - ) + (t (insert " x ")))))) (defun html2text-clean-dtdd (p1 p2) (goto-char p1) @@ -308,61 +276,51 @@ formatting, and then moved afterward.") (html2text-delete-single-tag p1 p2) (goto-char p1) (newline 1) - (insert (make-string fill-column ?-)) - ) + (insert (make-string fill-column ?-))) (defun html2text-clean-ul (p1 p2 p3 p4) (html2text-delete-tags p1 p2 p3 p4) - (html2text-clean-list-items p1 (- p3 (- p1 p2)) "ul") - ) + (html2text-clean-list-items p1 (- p3 (- p1 p2)) "ul")) (defun html2text-clean-ol (p1 p2 p3 p4) (html2text-delete-tags p1 p2 p3 p4) - (html2text-clean-list-items p1 (- p3 (- p1 p2)) "ol") - ) + (html2text-clean-list-items p1 (- p3 (- p1 p2)) "ol")) (defun html2text-clean-dl (p1 p2 p3 p4) (html2text-delete-tags p1 p2 p3 p4) - (html2text-clean-dtdd p1 (- p3 (- p1 p2))) - ) + (html2text-clean-dtdd p1 (- p3 (- p1 p2)))) (defun html2text-clean-center (p1 p2 p3 p4) (html2text-delete-tags p1 p2 p3 p4) - (center-region p1 (- p3 (- p2 p1))) - ) + (center-region p1 (- p3 (- p2 p1)))) (defun html2text-clean-bold (p1 p2 p3 p4) (put-text-property p2 p3 'face 'bold) - (html2text-delete-tags p1 p2 p3 p4) - ) + (html2text-delete-tags p1 p2 p3 p4)) (defun html2text-clean-title (p1 p2 p3 p4) (put-text-property p2 p3 'face 'bold) - (html2text-delete-tags p1 p2 p3 p4) - ) + (html2text-delete-tags p1 p2 p3 p4)) (defun html2text-clean-underline (p1 p2 p3 p4) (put-text-property p2 p3 'face 'underline) - (html2text-delete-tags p1 p2 p3 p4) - ) + (html2text-delete-tags p1 p2 p3 p4)) (defun html2text-clean-italic (p1 p2 p3 p4) (put-text-property p2 p3 'face 'italic) - (html2text-delete-tags p1 p2 p3 p4) - ) + (html2text-delete-tags p1 p2 p3 p4)) (defun html2text-clean-font (p1 p2 p3 p4) - (html2text-delete-tags p1 p2 p3 p4) - ) + (html2text-delete-tags p1 p2 p3 p4)) (defun html2text-clean-blockquote (p1 p2 p3 p4) - (html2text-delete-tags p1 p2 p3 p4) - ) + (html2text-delete-tags p1 p2 p3 p4)) (defun html2text-clean-anchor (p1 p2 p3 p4) - ;; If someone can explain how to make the URL clickable I will - ;; surely improve upon this. - (let* ((attr-list (html2text-get-attr p1 p2 "a")) + ;; If someone can explain how to make the URL clickable I will surely + ;; improve upon this. + ;; Maybe `goto-addr.el' can be used here. + (let* ((attr-list (html2text-get-attr p1 p2)) (href (html2text-attr-value attr-list "href"))) (delete-region p1 p4) (when href @@ -386,38 +344,27 @@ formatting, and then moved afterward.") (let ((has-br-line) (refill-start) (refill-stop)) - (if (re-search-forward "<br>$" p2 t) - (setq has-br-line t) - ) - (if has-br-line - (progn - (goto-char p1) - (if (re-search-forward ".+[^<][^b][^r][^>]$" p2 t) - (progn - (beginning-of-line) - (setq refill-start (point)) - (goto-char p2) - (re-search-backward ".+[^<][^b][^r][^>]$" refill-start t) - (next-line 1) - (end-of-line) - ;; refill-stop should ideally be adjusted to - ;; accomodate the "<br>" strings which are removed - ;; between refill-start and refill-stop. Can simply - ;; be returned from my-replace-string - (setq refill-stop (+ (point) - (html2text-replace-string - "<br>" "" - refill-start (point)))) - ;; (message "Point = %s refill-stop = %s" (point) refill-stop) - ;; (sleep-for 4) - (fill-region refill-start refill-stop) - ) - ) - ) - ) - ) - (html2text-replace-string "<br>" "" p1 p2) - ) + (when (re-search-forward "<br>$" p2 t) + (goto-char p1) + (when (re-search-forward ".+[^<][^b][^r][^>]$" p2 t) + (beginning-of-line) + (setq refill-start (point)) + (goto-char p2) + (re-search-backward ".+[^<][^b][^r][^>]$" refill-start t) + (next-line 1) + (end-of-line) + ;; refill-stop should ideally be adjusted to + ;; accomodate the "<br>" strings which are removed + ;; between refill-start and refill-stop. Can simply + ;; be returned from my-replace-string + (setq refill-stop (+ (point) + (html2text-replace-string + "<br>" "" + refill-start (point)))) + ;; (message "Point = %s refill-stop = %s" (point) refill-stop) + ;; (sleep-for 4) + (fill-region refill-start refill-stop)))) + (html2text-replace-string "<br>" "" p1 p2)) ;; ;; This one is interactive ... @@ -452,7 +399,7 @@ fashion, quite close to pure guess-work. It does work in some cases though." ;; (defun html2text-remove-tags (tag-list) - "Removes the tags listed in the list \"html2text-remove-tag-list\". + "Removes the tags listed in the list `html2text-remove-tag-list'. See the documentation for that variable." (interactive) (dolist (tag tag-list) @@ -461,7 +408,7 @@ See the documentation for that variable." (delete-region (match-beginning 0) (match-end 0))))) (defun html2text-format-tags () - "See the variable \"html2text-format-tag-list\" for documentation" + "See the variable `html2text-format-tag-list' for documentation." (interactive) (dolist (tag-and-function html2text-format-tag-list) (let ((tag (car tag-and-function)) @@ -471,8 +418,7 @@ See the documentation for that variable." (point-max) t) (let ((p1) (p2 (point)) - (p3) (p4) - (attr (match-string 1))) + (p3) (p4)) (search-backward "<" (point-min) t) (setq p1 (point)) (re-search-forward (format "</%s>" tag) (point-max) t) @@ -480,27 +426,18 @@ See the documentation for that variable." (search-backward "</" (point-min) t) (setq p3 (point)) (funcall function p1 p2 p3 p4) - (goto-char p1) - ) - ) - ) - ) - ) + (goto-char p1)))))) (defun html2text-substitute () - "See the variable \"html2text-replace-list\" for documentation" + "See the variable `html2text-replace-list' for documentation." (interactive) (dolist (e html2text-replace-list) (goto-char (point-min)) (let ((old-string (car e)) (new-string (cdr e))) - (html2text-replace-string old-string new-string (point-min) (point-max)) - ) - ) - ) + (html2text-replace-string old-string new-string (point-min) (point-max))))) (defun html2text-format-single-elements () - "" (interactive) (dolist (tag-and-function html2text-format-single-element-list) (let ((tag (car tag-and-function)) @@ -512,12 +449,7 @@ See the documentation for that variable." (p2 (point))) (search-backward "<" (point-min) t) (setq p1 (point)) - (funcall function p1 p2) - ) - ) - ) - ) - ) + (funcall function p1 p2)))))) ;; ;; Main function @@ -540,6 +472,6 @@ See the documentation for that variable." ;; ;; </Interactive functions> ;; - +(provide 'html2text) ;;; arch-tag: e9e57b79-35d4-4de1-a647-e7e01fe56d1e ;;; html2text.el ends here diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 585a72af549..fb63d6724be 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -587,6 +587,7 @@ Done before generating the new subject of a forward." non-word-constituents "]\\)+>+\\|[ \t]*[]>|}+]\\)+")))) "*Regexp matching the longest possible citation prefix on a line." + :version "21.4" :group 'message-insertion :link '(custom-manual "(message)Insertion Variables") :type 'regexp) @@ -743,6 +744,7 @@ Doing so would be even more evil than leaving it out." "*Envelope-from when sending mail with sendmail. If this is nil, use `user-mail-address'. If it is the symbol `header', use the From: header of the message." + :version "21.4" :type '(choice (string :tag "From name") (const :tag "Use From: header from message" header) (const :tag "Use `user-mail-address'" nil)) @@ -855,7 +857,8 @@ the signature is inserted." (let ((map (make-sparse-keymap 'message-minibuffer-local-map))) (set-keymap-parent map minibuffer-local-map) map) - "Keymap for `message-read-from-minibuffer'.") + "Keymap for `message-read-from-minibuffer'." + :version "21.4") ;;;###autoload (defcustom message-citation-line-function 'message-insert-citation-line @@ -1435,6 +1438,7 @@ no, only reply back to the author." (defcustom message-user-fqdn nil "*Domain part of Messsage-Ids." + :version "21.4" :group 'message-headers :link '(custom-manual "(message)News Headers") :type '(radio (const :format "%v " nil) @@ -6590,6 +6594,7 @@ which specify the range to operate on." '("^\\(Disposition-Notification-To\\|Return-Receipt-To\\):" . message-expand-name)) "Alist of (RE . FUN). Use FUN for completion on header lines matching RE." + :version "21.4" :group 'message :type '(alist :key-type regexp :value-type function)) diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 51ec38dc387..b167ea7d104 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -150,12 +150,14 @@ when displaying the image. The default value is \"\\\\`cid:\" which only matches parts embedded to the Multipart/Related type MIME contents and Gnus will never connect to the spammer's site arbitrarily. You may set this variable to nil if you consider all urls to be safe." + :version "21.4" :type '(choice (regexp :tag "Regexp") (const :tag "All URLs are safe" nil)) :group 'mime-display) (defcustom mm-inline-text-html-with-w3m-keymap t "If non-nil, use emacs-w3m command keys in the article buffer." + :version "21.4" :type 'boolean :group 'mime-display) @@ -378,6 +380,7 @@ If not set, `default-directory' will be used." (defcustom mm-attachment-file-modes 384 "Set the mode bits of saved attachments to this integer." + :version "21.4" :type 'integer :group 'mime-display) @@ -435,6 +438,7 @@ If not set, `default-directory' will be used." "Option of decrypting encrypted parts. `never', not decrypt; `always', always decrypt; `known', only decrypt known protocols. Otherwise, ask user." + :version "21.4" :type '(choice (item always) (item never) (item :tag "only known protocols" known) diff --git a/lisp/gnus/mm-url.el b/lisp/gnus/mm-url.el index 1652dbca245..1388371c981 100644 --- a/lisp/gnus/mm-url.el +++ b/lisp/gnus/mm-url.el @@ -49,6 +49,7 @@ (require 'url) (error nil))) "*If non-nil, use external grab program `mm-url-program'." + :version "21.4" :type 'boolean :group 'mm-url) @@ -67,6 +68,7 @@ (t "GET")) "The url grab program. Likely values are `wget', `w3m', `lynx' and `curl'." + :version "21.4" :type '(choice (symbol :tag "wget" wget) (symbol :tag "w3m" w3m) @@ -77,6 +79,7 @@ Likely values are `wget', `w3m', `lynx' and `curl'." (defcustom mm-url-arguments nil "The arguments for `mm-url-program'." + :version "21.4" :type '(repeat string) :group 'mm-url) diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index 3831e1a07ce..d961b2b4100 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el @@ -123,13 +123,16 @@ (defun mm-coding-system-p (cs) "Return non-nil if CS is a symbol naming a coding system. -In XEmacs, also return non-nil if CS is a coding system object." +In XEmacs, also return non-nil if CS is a coding system object. +If CS is available, return CS itself in Emacs, and return a coding +system object in XEmacs." (if (fboundp 'find-coding-system) (find-coding-system cs) (if (fboundp 'coding-system-p) - (coding-system-p cs) + (when (coding-system-p cs) + cs) ;; Is this branch ever actually useful? - (memq cs (mm-get-coding-system-list))))) + (car (memq cs (mm-get-coding-system-list)))))) (defvar mm-charset-synonym-alist `( @@ -219,12 +222,12 @@ In XEmacs, also return non-nil if CS is a coding system object." (big5 chinese-big5-1 chinese-big5-2) (tibetan tibetan) (thai-tis620 thai-tis620) + (windows-1251 cyrillic-iso8859-5) (iso-2022-7bit ethiopic arabic-1-column arabic-2-column) (iso-2022-jp-2 latin-iso8859-1 greek-iso8859-7 latin-jisx0201 japanese-jisx0208-1978 chinese-gb2312 japanese-jisx0208 - korean-ksc5601 japanese-jisx0212 - katakana-jisx0201) + korean-ksc5601 japanese-jisx0212) (iso-2022-int-1 latin-iso8859-1 greek-iso8859-7 latin-jisx0201 japanese-jisx0208-1978 chinese-gb2312 japanese-jisx0208 @@ -239,6 +242,9 @@ In XEmacs, also return non-nil if CS is a coding system object." chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5 chinese-cns11643-6 chinese-cns11643-7) + (iso-2022-jp-3 latin-jisx0201 japanese-jisx0208-1978 japanese-jisx0208 + japanese-jisx0213-1 japanese-jisx0213-2) + (shift_jis latin-jisx0201 katakana-jisx0201 japanese-jisx0208) ,(if (or (not (fboundp 'charsetp)) ;; non-Mule case (charsetp 'unicode-a) (not (mm-coding-system-p 'mule-utf-8))) @@ -249,32 +255,56 @@ In XEmacs, also return non-nil if CS is a coding system object." (coding-system-get 'mule-utf-8 'safe-charsets))))) "Alist of MIME-charset/MULE-charsets.") -;; Correct by construction, but should be unnecessary: -;; XEmacs hates it. -(when (and (not (featurep 'xemacs)) - (fboundp 'coding-system-list) - (fboundp 'sort-coding-systems)) - (setq mm-mime-mule-charset-alist - (apply - 'nconc - (mapcar - (lambda (cs) - (when (and (or (coding-system-get cs :mime-charset) ; Emacs 22 - (coding-system-get cs 'mime-charset)) - (not (eq t (coding-system-get cs 'safe-charsets)))) - (list (cons (or (coding-system-get cs :mime-charset) - (coding-system-get cs 'mime-charset)) - (delq 'ascii - (coding-system-get cs 'safe-charsets)))))) - (sort-coding-systems (coding-system-list 'base-only)))))) +(defun mm-enrich-utf-8-by-mule-ucs () + "Make the `utf-8' MIME charset usable by the Mule-UCS package. +This function will run when the `un-define' module is loaded under +XEmacs, and fill the `utf-8' entry in `mm-mime-mule-charset-alist' +with Mule charsets. It is completely useless for Emacs." + (unless (cdr (delete '(mm-enrich-utf-8-by-mule-ucs) + (assoc "un-define" after-load-alist))) + (setq after-load-alist + (delete '("un-define") after-load-alist))) + (when (boundp 'unicode-basic-translation-charset-order-list) + (condition-case nil + (let ((val (delq + 'ascii + (copy-sequence + (symbol-value + 'unicode-basic-translation-charset-order-list)))) + (elem (assq 'utf-8 mm-mime-mule-charset-alist))) + (if elem + (setcdr elem val) + (setq mm-mime-mule-charset-alist + (nconc mm-mime-mule-charset-alist + (list (cons 'utf-8 val)))))) + (error)))) + +;; Correct by construction, but should be unnecessary for Emacs: +(if (featurep 'xemacs) + (eval-after-load "un-define" '(mm-enrich-utf-8-by-mule-ucs)) + (when (and (fboundp 'coding-system-list) + (fboundp 'sort-coding-systems)) + (let ((css (sort-coding-systems (coding-system-list 'base-only))) + cs mime mule alist) + (while css + (setq cs (pop css) + mime (or (coding-system-get cs :mime-charset) ; Emacs 22 + (coding-system-get cs 'mime-charset))) + (when (and mime + (not (eq t (setq mule + (coding-system-get cs 'safe-charsets)))) + (not (assq mime alist))) + (push (cons mime (delq 'ascii mule)) alist))) + (setq mm-mime-mule-charset-alist (nreverse alist))))) (defcustom mm-coding-system-priorities (if (boundp 'current-language-environment) (let ((lang (symbol-value 'current-language-environment))) (cond ((string= lang "Japanese") - ;; Japanese users may prefer iso-2022-jp to shift-jis. - '(iso-2022-jp iso-2022-jp-2 japanese-shift-jis - iso-latin-1 utf-8))))) + ;; Japanese users prefer iso-2022-jp to euc-japan or + ;; shift_jis, however iso-8859-1 should be used when + ;; there are only ASCII text and Latin-1 characters. + '(iso-8859-1 iso-2022-jp iso-2022-jp-2 shift_jis utf-8))))) "Preferred coding systems for encoding outgoing messages. More than one suitable coding system may be found for some text. @@ -301,16 +331,20 @@ mail with multiple parts is preferred to sending a Unicode one.") "Return the MIME charset corresponding to the given Mule CHARSET." (if (and (fboundp 'find-coding-systems-for-charsets) (fboundp 'sort-coding-systems)) - (let (mime) - (dolist (cs (sort-coding-systems - (copy-sequence - (find-coding-systems-for-charsets (list charset))))) - (unless mime - (when cs - (setq mime (or (coding-system-get cs :mime-charset) - (coding-system-get cs 'mime-charset)))))) + (let ((css (sort (sort-coding-systems + (find-coding-systems-for-charsets (list charset))) + 'mm-sort-coding-systems-predicate)) + cs mime) + (while (and (not mime) + css) + (when (setq cs (pop css)) + (setq mime (or (coding-system-get cs :mime-charset) + (coding-system-get cs 'mime-charset))))) mime) - (let ((alist mm-mime-mule-charset-alist) + (let ((alist (mapcar (lambda (cs) + (assq cs mm-mime-mule-charset-alist)) + (sort (mapcar 'car mm-mime-mule-charset-alist) + 'mm-sort-coding-systems-predicate))) out) (while alist (when (memq charset (cdar alist)) @@ -482,11 +516,14 @@ This affects whether coding conversion should be attempted generally." (let ((priorities (mapcar (lambda (cs) ;; Note: invalid entries are dropped silently - (and (coding-system-p cs) + (and (setq cs (mm-coding-system-p cs)) (coding-system-base cs))) mm-coding-system-priorities))) - (> (length (memq a priorities)) - (length (memq b priorities))))) + (and (setq a (mm-coding-system-p a)) + (if (setq b (mm-coding-system-p b)) + (> (length (memq (coding-system-base a) priorities)) + (length (memq (coding-system-base b) priorities))) + t)))) (defun mm-find-mime-charset-region (b e) "Return the MIME charsets needed to encode the region between B and E. diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el index 17fa59311db..b140cb76df5 100644 --- a/lisp/gnus/mm-uu.el +++ b/lisp/gnus/mm-uu.el @@ -80,6 +80,7 @@ This can be either \"inline\" or \"attachment\".") (defcustom mm-uu-diff-groups-regexp "gnus\\.commits" "*Regexp matching diff groups." + :version "21.4" :type 'regexp :group 'gnus-article-mime) diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el index b8107364411..8bd2ed784ad 100644 --- a/lisp/gnus/mml-sec.el +++ b/lisp/gnus/mml-sec.el @@ -43,6 +43,7 @@ (defcustom mml-default-sign-method "pgpmime" "Default sign method. The string must have an entry in `mml-sign-alist'." + :version "21.4" :type '(choice (const "smime") (const "pgp") (const "pgpauto") @@ -60,6 +61,7 @@ The string must have an entry in `mml-sign-alist'." (defcustom mml-default-encrypt-method "pgpmime" "Default encryption method. The string must have an entry in `mml-encrypt-alist'." + :version "21.4" :type '(choice (const "smime") (const "pgp") (const "pgpauto") @@ -83,6 +85,7 @@ Note that the output generated by using a `combined' mode is NOT understood by all PGP implementations, in particular PGP version 2 does not support it! See Info node `(message)Security' for details." + :version "21.4" :group 'message :type '(repeat (list (choice (const :tag "S/MIME" "smime") (const :tag "PGP" "pgp") diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el index 6c89cfbe798..e083c2c9d9c 100644 --- a/lisp/gnus/mml2015.el +++ b/lisp/gnus/mml2015.el @@ -83,6 +83,7 @@ ("TRUST_FULLY" . t) ("TRUST_ULTIMATE" . t)) "Map GnuPG trust output values to a boolean saying if you trust the key." + :version "21.4" :group 'mime-security :type '(repeat (cons (regexp :tag "GnuPG output regexp") (boolean :tag "Trust key")))) diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el index 81d5443b640..13000a8ad19 100644 --- a/lisp/gnus/nndiary.el +++ b/lisp/gnus/nndiary.el @@ -223,6 +223,7 @@ (defgroup nndiary nil "The Gnus Diary backend." + :version "21.4" :group 'gnus-diary) (defcustom nndiary-mail-sources diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el index c1a23d8ca9b..040be1e60e1 100644 --- a/lisp/gnus/nnmail.el +++ b/lisp/gnus/nnmail.el @@ -119,6 +119,7 @@ If nil, the first match found will be used." (defcustom nnmail-split-fancy-with-parent-ignore-groups nil "Regexp that matches group names to be ignored when applying `nnmail-split-fancy-with-parent'. This can also be a list of regexps." + :version "21.4" :group 'nnmail-split :type '(choice (const :tag "none" nil) (regexp :value ".*") @@ -127,6 +128,7 @@ This can also be a list of regexps." (defcustom nnmail-cache-ignore-groups nil "Regexp that matches group names to be ignored when inserting message ids into the cache (`nnmail-cache-insert'). This can also be a list of regexps." + :version "21.4" :group 'nnmail-split :type '(choice (const :tag "none" nil) (regexp :value ".*") @@ -353,6 +355,7 @@ discarded after running the split process." (defcustom nnmail-spool-hook nil "*A hook called when a new article is spooled." + :version "21.4" :group 'nnmail :type 'hook) @@ -575,6 +578,7 @@ Normally, regexes given in `nnmail-split-fancy' are implicitly surrounded by \"\\=\\<...\\>\". If this variable is true, they are not implicitly\ surrounded by anything." + :version "21.4" :group 'nnmail :type 'boolean) @@ -582,6 +586,7 @@ by anything." "Whether to lowercase expanded entries (i.e. \\N) when splitting mails. This avoids the creation of multiple groups when users send to an address using different case (i.e. mailing-list@domain vs Mailing-List@Domain)." + :version "21.4" :group 'nnmail :type 'boolean) diff --git a/lisp/gnus/nnspool.el b/lisp/gnus/nnspool.el index 9a08cdfe71c..d54897a7750 100644 --- a/lisp/gnus/nnspool.el +++ b/lisp/gnus/nnspool.el @@ -44,7 +44,10 @@ This is most commonly `inews' or `injnews'.") "Switches for nnspool-request-post to pass to `inews' for posting news. If you are using Cnews, you probably should set this variable to nil.") -(defvoo nnspool-spool-directory (file-name-as-directory news-directory) +(defvoo nnspool-spool-directory + (file-name-as-directory (if (boundp 'news-directory) + (symbol-value 'news-directory) + news-path)) "Local news spool directory.") (defvoo nnspool-nov-directory (concat nnspool-spool-directory "over.view/") diff --git a/lisp/gnus/sha1.el b/lisp/gnus/sha1.el index a9b68805d3f..51a826fe5fc 100644 --- a/lisp/gnus/sha1.el +++ b/lisp/gnus/sha1.el @@ -60,6 +60,7 @@ (defgroup sha1 nil "Elisp interface for SHA1 hash computation." + :version "21.4" :group 'extensions) (defcustom sha1-maximum-internal-length 500 @@ -82,7 +83,6 @@ It must be a string \(program name\) or list of strings \(name and its args\)." (error)) "*Use external SHA1 program. If this variable is set to nil, use internal function only." - :version "21.4" :type 'boolean :group 'sha1) diff --git a/lisp/gnus/sieve.el b/lisp/gnus/sieve.el index f4645168dec..c37ffb616db 100644 --- a/lisp/gnus/sieve.el +++ b/lisp/gnus/sieve.el @@ -65,6 +65,7 @@ (defgroup sieve nil "Manage sieve scripts." + :version "21.4" :group 'tools) (defcustom sieve-new-script "<new script>" diff --git a/lisp/gnus/spam-stat.el b/lisp/gnus/spam-stat.el index f197d165cdd..eb33b7ad0b3 100644 --- a/lisp/gnus/spam-stat.el +++ b/lisp/gnus/spam-stat.el @@ -128,6 +128,7 @@ Use the functions to build a dictionary of words and their statistical distribution in spam and non-spam mails. Then use a function to determine whether a buffer contains spam or not." + :version "21.4" :group 'gnus) (defcustom spam-stat-file "~/.spam-stat.el" diff --git a/lisp/gnus/starttls.el b/lisp/gnus/starttls.el index c172e88c515..7a2eef5e7d0 100644 --- a/lisp/gnus/starttls.el +++ b/lisp/gnus/starttls.el @@ -126,6 +126,7 @@ "Name of GNUTLS command line tool. This program is used when GNUTLS is used, i.e. when `starttls-use-gnutls' is non-nil." + :version "21.4" :type 'string :group 'starttls) @@ -138,6 +139,7 @@ i.e. when `starttls-use-gnutls' is nil." (defcustom starttls-use-gnutls (not (executable-find starttls-program)) "*Whether to use GNUTLS instead of the `starttls' command." + :version "21.4" :type 'boolean :group 'starttls) @@ -156,11 +158,13 @@ This program is used when GNUTLS is used, i.e. when For example, non-TLS compliant servers may require '(\"--protocols\" \"ssl3\"). Invoke \"gnutls-cli --help\" to find out which parameters are available." + :version "21.4" :type '(repeat string) :group 'starttls) (defcustom starttls-process-connection-type nil "*Value for `process-connection-type' to use when starting STARTTLS process." + :version "21.4" :type 'boolean :group 'starttls) @@ -170,6 +174,7 @@ The default is what GNUTLS's \"gnutls-cli\" outputs." ;; GNUTLS cli.c:main() print this string when it is starting to run ;; in the application read/write phase. If the logic, or the string ;; itself, is modified, this must be updated. + :version "21.4" :type 'regexp :group 'starttls) @@ -178,6 +183,7 @@ The default is what GNUTLS's \"gnutls-cli\" outputs." The default is what GNUTLS's \"gnutls-cli\" outputs." ;; GNUTLS cli.c:do_handshake() print this string on failure. If the ;; logic, or the string itself, is modified, this must be updated. + :version "21.4" :type 'regexp :group 'starttls) @@ -188,6 +194,7 @@ The default is what GNUTLS's \"gnutls-cli\" outputs." ;; common.c:print_info(), that unconditionally print this string ;; last. If that logic, or the string itself, is modified, this ;; must be updated. + :version "21.4" :type 'regexp :group 'starttls) diff --git a/lisp/help-at-pt.el b/lisp/help-at-pt.el index d6ac6ec3fdc..2266c8d5a2a 100644 --- a/lisp/help-at-pt.el +++ b/lisp/help-at-pt.el @@ -1,6 +1,6 @@ ;;; help-at-pt.el --- local help through the keyboard -;; Copyright (C) 2003 Free Software Foundation, Inc. +;; Copyright (C) 2003, 2004 Free Software Foundation, Inc. ;; Author: Luc Teirlinck <teirllm@auburn.edu> ;; Keywords: help @@ -98,6 +98,13 @@ mainly meant for use from Lisp." (message "%s" help) (if (not arg) (message "No local help at point"))))) +(defvar help-at-pt-timer nil + "Non-nil means that a timer is set that checks for local help. +If non-nil, this is the value returned by the call of +`run-with-idle-timer' that set that timer. This variable is used +internally to enable `help-at-pt-display-when-idle'. Do not set it +yourself.") + (defcustom help-at-pt-timer-delay 1 "*Delay before displaying local help. This is used if `help-at-pt-display-when-idle' is enabled. @@ -112,17 +119,12 @@ active, but if one is already active, Custom will make it use the new value." :group 'help-at-pt :type 'number + :initialize 'custom-initialize-default :set (lambda (variable value) (set-default variable value) - (when (and (boundp 'help-at-pt-timer) help-at-pt-timer) - (timer-set-idle-time help-at-pt-timer value t)))) - -(defvar help-at-pt-timer nil - "Non-nil means that a timer is set that checks for local help. -If non-nil, this is the value returned by the call of -`run-with-idle-timer' that set that timer. This variable is used -internally to enable `help-at-pt-display-when-idle'. Do not set it -yourself.") + (and (boundp 'help-at-pt-timer) + help-at-pt-timer + (timer-set-idle-time help-at-pt-timer value t)))) ;;;###autoload (defun help-at-pt-cancel-timer () @@ -144,7 +146,6 @@ This is done by setting a timer, if none is currently active." (run-with-idle-timer help-at-pt-timer-delay t #'help-at-pt-maybe-display)))) -;;;###autoload (defcustom help-at-pt-display-when-idle 'never "*Automatically show local help on point-over. If the value is t, the string obtained from any `kbd-help' or diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 57b0b39767e..8f2a1b7fa6e 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -473,7 +473,7 @@ Return 0 if there is no such symbol." (and (symbolp obj) (boundp obj) obj)))) (error nil)) (let* ((str (find-tag-default)) - (obj (if str (read str)))) + (obj (if str (intern str)))) (and (symbolp obj) (boundp obj) obj)) 0)) diff --git a/lisp/help.el b/lisp/help.el index ee35d007639..5ec9b1f5299 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -267,7 +267,7 @@ If that doesn't give a function, return nil." (and (symbolp obj) (fboundp obj) obj)))) (error nil)))) (let* ((str (find-tag-default)) - (obj (if str (read str)))) + (obj (if str (intern str)))) (and (symbolp obj) (fboundp obj) obj)))) diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 30c97a383d3..6dce953df0f 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -45,6 +45,7 @@ Ibuffer allows you to operate on buffers in a manner much like Dired. Operations include sorting, marking by regular expression, and the ability to filter the displayed buffers by various criteria." + :version "21.4" :group 'convenience) (defcustom ibuffer-formats '((mark modified read-only " " (name 18 18 :left :elide) diff --git a/lisp/ido.el b/lisp/ido.el index f9066544e1f..8d55887eae5 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -338,6 +338,7 @@ "Switch between files using substrings." :group 'extensions :group 'convenience + :version "21.4" :link '(emacs-commentary-link :tag "Commentary" "ido.el") :link '(emacs-library-link :tag "Lisp File" "ido.el")) @@ -359,7 +360,6 @@ use either \\[customize] or the function `ido-mode'." :require 'ido :link '(emacs-commentary-link "ido.el") :set-after '(ido-save-directory-list-file) - :version "21.4" :type '(choice (const :tag "Turn on only buffer" buffer) (const :tag "Turn on only file" file) (const :tag "Turn on both buffer and file" both) diff --git a/lisp/imenu.el b/lisp/imenu.el index 924746f3bd1..7c775dc6337 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -161,16 +161,17 @@ element should come before the second. The arguments are cons cells; :type 'integer :group 'imenu) -(defcustom imenu-scanning-message "Scanning buffer for index (%3d%%)" - "*Progress message during the index scanning of the buffer. -If non-nil, user gets a message during the scanning of the buffer. - -Relevant only if the mode-specific function that creates the buffer -index use `imenu-progress-message', and not useful if that is fast, in -which case you might as well set this to nil." - :type '(choice string - (const :tag "None" nil)) - :group 'imenu) +;; No longer used. KFS 2004-10-27 +;; (defcustom imenu-scanning-message "Scanning buffer for index (%3d%%)" +;; "*Progress message during the index scanning of the buffer. +;; If non-nil, user gets a message during the scanning of the buffer. +;; +;; Relevant only if the mode-specific function that creates the buffer +;; index use `imenu-progress-message', and not useful if that is fast, in +;; which case you might as well set this to nil." +;; :type '(choice string +;; (const :tag "None" nil)) +;; :group 'imenu) (defcustom imenu-space-replacement "." "*The replacement string for spaces in index names. @@ -300,16 +301,22 @@ The function in this variable is called when selecting a normal index-item.") ;; is calculated. ;; PREVPOS is the variable in which we store the last position displayed. (defmacro imenu-progress-message (prevpos &optional relpos reverse) - `(and - imenu-scanning-message - (let ((pos ,(if relpos - relpos - `(imenu--relative-position ,reverse)))) - (if ,(if relpos t - `(> pos (+ 5 ,prevpos))) - (progn - (message imenu-scanning-message pos) - (setq ,prevpos pos)))))) + +;; Made obsolete/empty, as computers are now faster than the eye, and +;; it had problems updating the messages correctly, and could shadow +;; more important messages/prompts in the minibuffer. KFS 2004-10-27. + +;; `(and +;; imenu-scanning-message +;; (let ((pos ,(if relpos +;; relpos +;; `(imenu--relative-position ,reverse)))) +;; (if ,(if relpos t +;; `(> pos (+ 5 ,prevpos))) +;; (progn +;; (message imenu-scanning-message pos) +;; (setq ,prevpos pos))))) +) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -765,7 +772,7 @@ the alist look like: (INDEX-NAME . INDEX-POSITION) or like: (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...) -They may also be nested index alists like: +They may also be nested index alists like: (INDEX-NAME . INDEX-ALIST) depending on PATTERNS." diff --git a/lisp/info.el b/lisp/info.el index 4fc7b5c9cf7..2e0ddd0fb02 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -1980,7 +1980,7 @@ Because of ambiguities, this should be concatenated with something like (if (match-beginning 5) (string-to-number (match-string 5)) (buffer-substring (match-beginning 0) (1- (match-beginning 1))))) -;;; Comment out the next line to use names of cross-references: +;;; Uncomment next line to use names of cross-references in non-index nodes: ;;; (setq Info-point-loc ;;; (buffer-substring (match-beginning 0) (1- (match-beginning 1)))) ) @@ -3214,7 +3214,7 @@ Allowed only if variable `Info-enable-edit' is non-nil." (message "Tags may have changed. Use Info-tagify if necessary"))) (defvar Info-file-list-for-emacs - '("ediff" "eudc" "forms" "gnus" "info" ("mh" . "mh-e") + '("ediff" "eudc" "forms" "gnus" "info" ("Info" . "info") ("mh" . "mh-e") "sc" "message" ("dired" . "dired-x") "viper" "vip" "idlwave" ("c" . "ccmode") ("c++" . "ccmode") ("objc" . "ccmode") ("java" . "ccmode") ("idl" . "ccmode") ("pike" . "ccmode") @@ -3245,11 +3245,13 @@ The `info-file' property of COMMAND says which Info manual to search. If COMMAND has no property, the variable `Info-file-list-for-emacs' defines heuristics for which Info manual to try. The locations are of the format used in `Info-history', i.e. -\(FILENAME NODENAME BUFFERPOS\)." - (let ((where '()) +\(FILENAME NODENAME BUFFERPOS\), where BUFFERPOS is the line number +in the first element of the returned list (which is treated specially in +`Info-goto-emacs-command-node'), and 0 for the rest elements of a list." + (let ((where '()) line-number (cmd-desc (concat "^\\* +" (regexp-quote (symbol-name command)) "\\( <[0-9]+>\\)?:\\s *\\(.*\\)\\." - "\\([ \t]*(line[ \t]*[0-9]*)\\)?$")) + "\\(?:[ \t\n]+(line +\\([0-9]+\\))\\)?")) (info-file "emacs")) ;default ;; Determine which info file this command is documented in. (if (get command 'info-file) @@ -3288,11 +3290,17 @@ The locations are of the format used in `Info-history', i.e. (cons (list Info-current-file (match-string-no-properties 2) 0) - where))) + where)) + (setq line-number (and (match-beginning 3) + (string-to-number (match-string 3))))) (and (setq nodes (cdr nodes) node (car nodes)))) (Info-goto-node node))) - where)) + (if (and line-number where) + (cons (list (nth 0 (car where)) (nth 1 (car where)) line-number) + (cdr where)) + where))) +;;;###autoload (put 'Info-goto-emacs-command-node 'info-file "emacs") ;;;###autoload (defun Info-goto-emacs-command-node (command) "Go to the Info node in the Emacs manual for command COMMAND. @@ -3316,9 +3324,11 @@ COMMAND must be a symbol or string." ;; Bind Info-history to nil, to prevent the last Index node ;; visited by Info-find-emacs-command-nodes from being ;; pushed onto the history. - (let ((Info-history nil) (Info-history-list nil)) - (Info-find-node (car (car where)) - (car (cdr (car where))))) + (let ((Info-history nil) (Info-history-list nil) + (line-number (nth 2 (car where)))) + (Info-find-node (nth 0 (car where)) (nth 1 (car where))) + (if (and (integerp line-number) (> line-number 0)) + (forward-line (1- line-number)))) (if (> num-matches 1) (progn ;; (car where) will be pushed onto Info-history @@ -3332,6 +3342,7 @@ COMMAND must be a symbol or string." (if (> num-matches 2) "them" "it"))))) (error "Couldn't find documentation for %s" command)))) +;;;###autoload (put 'Info-goto-emacs-key-command-node 'info-file "emacs") ;;;###autoload (defun Info-goto-emacs-key-command-node (key) "Go to the node in the Emacs manual which describes the command bound to KEY. diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 2b4cbcaf323..9ee34a8432c 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -1,6 +1,6 @@ ;;; kmacro.el --- enhanced keyboard macros -;; Copyright (C) 2002 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. ;; Author: Kim F. Storm <storm@cua.dk> ;; Keywords: keyboard convenience @@ -120,6 +120,7 @@ "Simplified keyboard macro user interface." :group 'keyboard :group 'convenience + :version "21.4" :link '(emacs-commentary-link :tag "Commentary" "kmacro.el") :link '(emacs-library-link :tag "Lisp File" "kmacro.el")) @@ -222,6 +223,14 @@ macro to be executed before appending to it." (global-set-key (vector kmacro-call-mouse-event) 'kmacro-end-call-mouse)) +;;; Called from keyboard-quit + +(defun kmacro-keyboard-quit () + (or (not defining-kbd-macro) + (eq defining-kbd-macro 'append) + (kmacro-ring-empty-p) + (kmacro-pop-ring))) + ;;; Keyboard macro counter @@ -585,7 +594,9 @@ Use \\[kmacro-bind-to-key] to bind it to a key sequence." (and append (if kmacro-execute-before-append (> (car arg) 4) - (= (car arg) 4))))))) + (= (car arg) 4)))) + (if (and defining-kbd-macro append) + (setq defining-kbd-macro 'append))))) ;;;###autoload diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index e93f76c3042..c5579b3c0db 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -128,6 +128,9 @@ usually do not have translators to read other languages for them.\n\n") (insert "\n\n\n") (insert "In " (emacs-version) "\n") + (if (fboundp 'x-server-vendor) + (insert "Distributor `" (x-server-vendor) "', version " + (mapconcat 'number-to-string (x-server-version) ".") "\n")) (if (and system-configuration-options (not (equal system-configuration-options ""))) (insert "configured using `configure " diff --git a/lisp/makefile.w32-in b/lisp/makefile.w32-in index e23830bc210..c0d5b4c7683 100644 --- a/lisp/makefile.w32-in +++ b/lisp/makefile.w32-in @@ -171,7 +171,7 @@ cus-load.el: touch $@ custom-deps: cus-load.el doit @echo Directories: $(WINS) - -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hooks nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS) + -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS) finder-data: doit @echo Directories: $(WINS) @@ -221,7 +221,7 @@ loaddefs.el-CMD: autoloads: loaddefs.el doit @echo Directories: $(WINS) $(emacs) -l autoload \ - --eval $(ARGQUOTE)(setq find-file-hooks nil \ + --eval $(ARGQUOTE)(setq find-file-hook nil \ find-file-suppress-same-file-warnings t \ generated-autoload-file \ $(DQUOTE)$(lisp)/loaddefs.el$(DQUOTE))$(ARGQUOTE) \ diff --git a/lisp/man.el b/lisp/man.el index afd183fa720..e4573748fcb 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -426,7 +426,7 @@ Otherwise, the value is whatever the function (view-file f) (error "Cannot read a file: %s" f)) (error "Cannot find a file: %s" f)))) - 'help-echo "mouse-2: mouse-2: display this file") + 'help-echo "mouse-2: display this file") ;; ====================================================================== diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 22840896c17..2c1d37c80e2 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -186,10 +186,15 @@ A large number or nil slows down menu responsiveness." '(menu-item "Open Directory..." dired :help "Read a directory, operate on its files")) (define-key menu-bar-files-menu [open-file] - '(menu-item "Open File..." find-file + '(menu-item "Open File..." find-file-existing :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) - :help "Read a file into an Emacs buffer")) + :help "Read an existing file into an Emacs buffer")) +(define-key menu-bar-files-menu [new-file] + '(menu-item "New File..." find-file + :enable (not (window-minibuffer-p + (frame-selected-window menu-updating-frame))) + :help "Read or create a file and edit it")) ;; The "Edit" menu items diff --git a/lisp/mouse-sel.el b/lisp/mouse-sel.el index b6f4558f280..4f3741a5213 100644 --- a/lisp/mouse-sel.el +++ b/lisp/mouse-sel.el @@ -1,6 +1,7 @@ ;;; mouse-sel.el --- multi-click selection support for Emacs 19 -;; Copyright (C) 1993,1994,1995,2001,2002 Free Software Foundation, Inc. +;; Copyright (C) 1993, 1994, 1995, 2001, 2002, 2004 +;; Free Software Foundation, Inc. ;; Author: Mike Williams <mdub@bigfoot.com> ;; Keywords: mouse @@ -243,7 +244,7 @@ primary selection and region." :group 'mouse-sel (if mouse-sel-mode (progn - (add-hook 'x-lost-selection-hooks 'mouse-sel-lost-selection-hook) + (add-hook 'x-lost-selection-functions 'mouse-sel-lost-selection-hook) (when mouse-sel-default-bindings ;; Save original bindings and replace them with new ones. (setq mouse-sel-original-bindings @@ -263,7 +264,7 @@ primary selection and region." interprogram-paste-function nil)))) ;; Restore original bindings - (remove-hook 'x-lost-selection-hooks 'mouse-sel-lost-selection-hook) + (remove-hook 'x-lost-selection-functions 'mouse-sel-lost-selection-hook) (dolist (binding mouse-sel-original-bindings) (global-set-key (car binding) (cdr binding))) ;; Restore the old values of these variables, @@ -712,5 +713,5 @@ If `mouse-yank-at-point' is non-nil, insert at point instead." (provide 'mouse-sel) -;;; arch-tag: 86e6c73f-deaa-48d3-a24e-c565fda1f7d7 +;; arch-tag: 86e6c73f-deaa-48d3-a24e-c565fda1f7d7 ;;; mouse-sel.el ends here diff --git a/lisp/mouse.el b/lisp/mouse.el index abf62a97836..2a467aa8069 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1025,54 +1025,56 @@ If MODE is 2 then do the same for lines." "List of keys which shall cause the mouse region to be deleted.") (defun mouse-show-mark () - (if transient-mark-mode - (delete-overlay mouse-drag-overlay) - (let ((inhibit-quit t) - (echo-keystrokes 0) - event events key ignore - x-lost-selection-hooks) - (add-hook 'x-lost-selection-hooks - (lambda (seltype) - (if (eq seltype 'PRIMARY) - (progn (setq ignore t) - (throw 'mouse-show-mark t))))) - (move-overlay mouse-drag-overlay (point) (mark t)) - (catch 'mouse-show-mark - ;; In this loop, execute scroll bar and switch-frame events. - ;; Also ignore down-events that are undefined. - (while (progn (setq event (read-event)) - (setq events (append events (list event))) - (setq key (apply 'vector events)) - (or (and (consp event) - (eq (car event) 'switch-frame)) - (and (consp event) - (eq (posn-point (event-end event)) - 'vertical-scroll-bar)) - (and (memq 'down (event-modifiers event)) - (not (key-binding key)) - (not (mouse-undouble-last-event events)) - (not (member key mouse-region-delete-keys))))) - (and (consp event) - (or (eq (car event) 'switch-frame) - (eq (posn-point (event-end event)) - 'vertical-scroll-bar)) - (let ((keys (vector 'vertical-scroll-bar event))) - (and (key-binding keys) - (progn - (call-interactively (key-binding keys) - nil keys) - (setq events nil))))))) - ;; If we lost the selection, just turn off the highlighting. - (if ignore - nil - ;; For certain special keys, delete the region. - (if (member key mouse-region-delete-keys) - (delete-region (overlay-start mouse-drag-overlay) - (overlay-end mouse-drag-overlay)) - ;; Otherwise, unread the key so it gets executed normally. - (setq unread-command-events - (nconc events unread-command-events)))) - (setq quit-flag nil) + (let ((inhibit-quit t) + (echo-keystrokes 0) + event events key ignore + (x-lost-selection-functions + (when (boundp 'x-lost-selection-functions) + (copy-sequence x-lost-selection-functions)))) + (add-hook 'x-lost-selection-functions + (lambda (seltype) + (when (eq seltype 'PRIMARY) + (setq ignore t) + (throw 'mouse-show-mark t)))) + (if transient-mark-mode + (delete-overlay mouse-drag-overlay) + (move-overlay mouse-drag-overlay (point) (mark t))) + (catch 'mouse-show-mark + ;; In this loop, execute scroll bar and switch-frame events. + ;; Also ignore down-events that are undefined. + (while (progn (setq event (read-event)) + (setq events (append events (list event))) + (setq key (apply 'vector events)) + (or (and (consp event) + (eq (car event) 'switch-frame)) + (and (consp event) + (eq (posn-point (event-end event)) + 'vertical-scroll-bar)) + (and (memq 'down (event-modifiers event)) + (not (key-binding key)) + (not (mouse-undouble-last-event events)) + (not (member key mouse-region-delete-keys))))) + (and (consp event) + (or (eq (car event) 'switch-frame) + (eq (posn-point (event-end event)) + 'vertical-scroll-bar)) + (let ((keys (vector 'vertical-scroll-bar event))) + (and (key-binding keys) + (progn + (call-interactively (key-binding keys) + nil keys) + (setq events nil))))))) + ;; If we lost the selection, just turn off the highlighting. + (unless ignore + ;; For certain special keys, delete the region. + (if (member key mouse-region-delete-keys) + (delete-region (overlay-start mouse-drag-overlay) + (overlay-end mouse-drag-overlay)) + ;; Otherwise, unread the key so it gets executed normally. + (setq unread-command-events + (nconc events unread-command-events)))) + (setq quit-flag nil) + (unless transient-mark-mode (delete-overlay mouse-drag-overlay)))) (defun mouse-set-mark (click) @@ -1110,7 +1112,7 @@ and set mark at the beginning. Prefix arguments are interpreted as with \\[yank]. If `mouse-yank-at-point' is non-nil, insert at point regardless of where you click." - (interactive "*e\nP") + (interactive "e\nP") ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) (or mouse-yank-at-point (mouse-set-point click)) @@ -1412,7 +1414,7 @@ The function returns a non-nil value if it creates a secondary selection." Move point to the end of the inserted text. If `mouse-yank-at-point' is non-nil, insert at point regardless of where you click." - (interactive "*e") + (interactive "e") ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) (or mouse-yank-at-point (mouse-set-point click)) diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index 6d12d5e6364..bcdd1d195bf 100644 --- a/lisp/net/eudc.el +++ b/lisp/net/eudc.el @@ -462,73 +462,73 @@ attribute name ATTR." "Display the record list RECORDS in a formatted buffer. If RAW-ATTR-NAMES is non-nil, the raw attribute names are displayed otherwise they are formatted according to `eudc-user-attribute-names-alist'." - (let ((buffer (get-buffer-create "*Directory Query Results*")) - inhibit-read-only + (let (inhibit-read-only precords (width 0) beg first-record attribute-name) - (switch-to-buffer buffer) - (setq buffer-read-only t) - (setq inhibit-read-only t) - (erase-buffer) - (insert "Directory Query Result\n") - (insert "======================\n\n\n") - (if (null records) - (insert "No match found.\n" - (if eudc-strict-return-matches - "Try setting `eudc-strict-return-matches' to nil or change `eudc-default-return-attributes'.\n" - "")) - ;; Replace field names with user names, compute max width - (setq precords - (mapcar - (function - (lambda (record) + (with-output-to-temp-buffer "*Directory Query Results*" + (with-current-buffer standard-output + (setq buffer-read-only t) + (setq inhibit-read-only t) + (erase-buffer) + (insert "Directory Query Result\n") + (insert "======================\n\n\n") + (if (null records) + (insert "No match found.\n" + (if eudc-strict-return-matches + "Try setting `eudc-strict-return-matches' to nil or change `eudc-default-return-attributes'.\n" + "")) + ;; Replace field names with user names, compute max width + (setq precords (mapcar (function - (lambda (field) - (setq attribute-name - (if raw-attr-names - (symbol-name (car field)) - (eudc-format-attribute-name-for-display (car field)))) - (if (> (length attribute-name) width) - (setq width (length attribute-name))) - (cons attribute-name (cdr field)))) - record))) - records)) - ;; Display the records - (setq first-record (point)) - (mapcar - (function - (lambda (record) - (setq beg (point)) - ;; Map over the record fields to print the attribute/value pairs - (mapcar (function - (lambda (field) - (eudc-print-record-field field width))) - record) - ;; Store the record internal format in some convenient place - (overlay-put (make-overlay beg (point)) - 'eudc-record - (car records)) - (setq records (cdr records)) - (insert "\n"))) - precords)) - (insert "\n") - (widget-create 'push-button - :notify (lambda (&rest ignore) - (eudc-query-form)) - "New query") - (widget-insert " ") - (widget-create 'push-button - :notify (lambda (&rest ignore) - (kill-this-buffer)) - "Quit") - (eudc-mode) - (widget-setup) - (if first-record - (goto-char first-record)))) + (lambda (record) + (mapcar + (function + (lambda (field) + (setq attribute-name + (if raw-attr-names + (symbol-name (car field)) + (eudc-format-attribute-name-for-display (car field)))) + (if (> (length attribute-name) width) + (setq width (length attribute-name))) + (cons attribute-name (cdr field)))) + record))) + records)) + ;; Display the records + (setq first-record (point)) + (mapcar + (function + (lambda (record) + (setq beg (point)) + ;; Map over the record fields to print the attribute/value pairs + (mapcar (function + (lambda (field) + (eudc-print-record-field field width))) + record) + ;; Store the record internal format in some convenient place + (overlay-put (make-overlay beg (point)) + 'eudc-record + (car records)) + (setq records (cdr records)) + (insert "\n"))) + precords)) + (insert "\n") + (widget-create 'push-button + :notify (lambda (&rest ignore) + (eudc-query-form)) + "New query") + (widget-insert " ") + (widget-create 'push-button + :notify (lambda (&rest ignore) + (kill-this-buffer)) + "Quit") + (eudc-mode) + (widget-setup) + (if first-record + (goto-char first-record)))))) (defun eudc-process-form () "Process the query form in current buffer and display the results." @@ -709,34 +709,36 @@ server for future sessions." (eudc-save-options))) ;;;###autoload -(defun eudc-get-email (name) - "Get the email field of NAME from the directory server." - (interactive "sName: ") +(defun eudc-get-email (name &optional error) + "Get the email field of NAME from the directory server. +If ERROR is non-nil, report an error if there is none." + (interactive "sName: \np") (or eudc-server (call-interactively 'eudc-set-server)) (let ((result (eudc-query (list (cons 'name name)) '(email))) email) (if (null (cdr result)) (setq email (eudc-cdaar result)) - (error "Multiple match. Use the query form")) - (if (interactive-p) + (error "Multiple match--use the query form")) + (if error (if email (message "%s" email) (error "No record matching %s" name))) email)) ;;;###autoload -(defun eudc-get-phone (name) - "Get the phone field of NAME from the directory server." - (interactive "sName: ") +(defun eudc-get-phone (name &optional error) + "Get the phone field of NAME from the directory server. +If ERROR is non-nil, report an error if there is none." + (interactive "sName: \np") (or eudc-server (call-interactively 'eudc-set-server)) (let ((result (eudc-query (list (cons 'name name)) '(phone))) phone) (if (null (cdr result)) (setq phone (eudc-cdaar result)) - (error "Multiple match. Use the query form")) - (if (interactive-p) + (error "Multiple match--use the query form")) + (if error (if phone (message "%s" phone) (error "No record matching %s" name))) diff --git a/lisp/net/password.el b/lisp/net/password.el deleted file mode 100644 index da009ed9ea0..00000000000 --- a/lisp/net/password.el +++ /dev/null @@ -1,184 +0,0 @@ -;;; password.el --- Read passwords from user, possibly using a password cache. - -;; Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. - -;; Author: Simon Josefsson <simon@josefsson.org> -;; Created: 2003-12-21 -;; Keywords: password cache passphrase key - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Greatly influenced by pgg.el written by Daiki Ueno, with timer -;; fixes for XEmacs by Katsumi Yamaoka. In fact, this is mostly just -;; a rip-off. -;; -;; (password-read "Password? " "test") -;; ;; Minibuffer prompt for password. -;; => "foo" -;; -;; (password-cache-add "test" "foo") -;; => nil - -;; Note the previous two can be replaced with: -;; (password-read-and-add "Password? " "test") -;; ;; Minibuffer prompt for password. -;; => "foo" -;; ;; "foo" is now cached with key "test" - - -;; (password-read "Password? " "test") -;; ;; No minibuffer prompt -;; => "foo" -;; -;; (password-read "Password? " "test") -;; ;; No minibuffer prompt -;; => "foo" -;; -;; ;; Wait `password-cache-expiry' seconds. -;; -;; (password-read "Password? " "test") -;; ;; Minibuffer prompt for password is back. -;; => "foo" - -;;; Code: - -(when (featurep 'xemacs) - (require 'run-at-time)) - -(eval-when-compile - (require 'cl)) - -(defcustom password-cache t - "Whether to cache passwords." - :group 'password - :type 'boolean) - -(defcustom password-cache-expiry 16 - "How many seconds passwords are cached, or nil to disable expiring. -Whether passwords are cached at all is controlled by `password-cache'." - :group 'password - :type '(choice (const :tag "Never" nil) - (integer :tag "Seconds"))) - -(defvar password-data (make-vector 7 0)) - -(defun password-read (prompt &optional key) - "Read password, for use with KEY, from user, or from cache if wanted. -KEY indicate the purpose of the password, so the cache can -separate passwords. The cache is not used if KEY is nil. It is -typically a string. -The variable `password-cache' control whether the cache is used." - (or (and password-cache - key - (symbol-value (intern-soft key password-data))) - (read-passwd prompt))) - -(defun password-read-and-add (prompt &optional key) - "Read password, for use with KEY, from user, or from cache if wanted. -Then store the password in the cache. Uses `password-read' and -`password-cache-add'." - (let ((password (password-read prompt key))) - (when (and password key) - (password-cache-add key password)) - password)) - -(defun password-cache-remove (key) - "Remove password indexed by KEY from password cache. -This is typically run be a timer setup from `password-cache-add', -but can be invoked at any time to forcefully remove passwords -from the cache. This may be useful when it has been detected -that a password is invalid, so that `password-read' query the -user again." - (let ((password (symbol-value (intern-soft key password-data)))) - (when password - (fillarray password ?_) - (unintern key password-data)))) - -(defun password-cache-add (key password) - "Add password to cache. -The password is removed by a timer after `password-cache-expiry' -seconds." - (set (intern key password-data) password) - (when password-cache-expiry - (run-at-time password-cache-expiry nil - #'password-cache-remove - key)) - nil) - -;;;###autoload -(defun read-passwd (prompt &optional confirm default) - "Read a password, prompting with PROMPT, and return it. -If optional CONFIRM is non-nil, read the password twice to make sure. -Optional DEFAULT is a default password to use instead of empty input. - -This function echoes `.' for each character that the user types. -The user ends with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. -C-g quits; if `inhibit-quit' was non-nil around this function, -then it returns nil if the user types C-g. - -Once the caller uses the password, it can erase the password -by doing (clear-string STRING)." - (with-local-quit - (if confirm - (let (success) - (while (not success) - (let ((first (read-passwd prompt nil default)) - (second (read-passwd "Confirm password: " nil default))) - (if (equal first second) - (progn - (and (arrayp second) (clear-string second)) - (setq success first)) - (and (arrayp first) (clear-string first)) - (and (arrayp second) (clear-string second)) - (message "Password not repeated accurately; please start over") - (sit-for 1)))) - success) - (let ((pass nil) - (c 0) - (echo-keystrokes 0) - (cursor-in-echo-area t)) - (while (progn (message "%s%s" - prompt - (make-string (length pass) ?.)) - (setq c (read-char-exclusive nil t)) - (and (/= c ?\r) (/= c ?\n) (/= c ?\e))) - (clear-this-command-keys) - (if (= c ?\C-u) - (progn - (and (arrayp pass) (clear-string pass)) - (setq pass "")) - (if (and (/= c ?\b) (/= c ?\177)) - (let* ((new-char (char-to-string c)) - (new-pass (concat pass new-char))) - (and (arrayp pass) (clear-string pass)) - (clear-string new-char) - (setq c ?\0) - (setq pass new-pass)) - (if (> (length pass) 0) - (let ((new-pass (substring pass 0 -1))) - (and (arrayp pass) (clear-string pass)) - (setq pass new-pass)))))) - (message nil) - (or pass default ""))))) - -(provide 'password) - -;;; arch-tag: ab160494-16c8-4c68-a4a1-73eebf6686e5 -;;; password.el ends here diff --git a/lisp/net/tls.el b/lisp/net/tls.el index 5f57c084f9b..1b58760c17c 100644 --- a/lisp/net/tls.el +++ b/lisp/net/tls.el @@ -67,18 +67,21 @@ after successful negotiation." (defcustom tls-process-connection-type nil "*Value for `process-connection-type' to use when starting TLS process." + :version "21.4" :type 'boolean :group 'tls) (defcustom tls-success "- Handshake was completed" "*Regular expression indicating completed TLS handshakes. The default is what GNUTLS's \"gnutls-cli\" outputs." + :version "21.4" :type 'regexp :group 'tls) (defcustom tls-certtool-program (executable-find "certtool") "Name of GnuTLS certtool. Used by `tls-certificate-information'." + :version "21.4" :type '(repeat string) :group 'tls) diff --git a/lisp/obsolete/hilit19.el b/lisp/obsolete/hilit19.el index 4d8af4b5a2b..a5fd33adcaa 100644 --- a/lisp/obsolete/hilit19.el +++ b/lisp/obsolete/hilit19.el @@ -1,6 +1,6 @@ ;;; hilit19.el --- customizable highlighting for Emacs 19 -;; Copyright (c) 1993, 1994, 2001 Free Software Foundation, Inc. +;; Copyright (c) 1993, 1994, 2001, 2004 Free Software Foundation, Inc. ;; Author: Jonathan Stigelman <stig@hackvan.com> ;; Maintainer: FSF @@ -397,8 +397,6 @@ See the hilit-lookup-face-create documentation for valid face names.") If hilit19 is dumped into emacs at your site, you may have to set this in your init file.") -(eval-when-compile (setq byte-optimize t)) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Use this to report bugs: @@ -945,47 +943,61 @@ the entire buffer is forced." ;; Initialization. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(and (not hilit-inhibit-rebinding) - (progn - (substitute-key-definition 'yank 'hilit-yank - (current-global-map)) - (substitute-key-definition 'yank-pop 'hilit-yank-pop - (current-global-map)) - (substitute-key-definition 'recenter 'hilit-recenter - (current-global-map)))) - -(global-set-key [?\C-\S-l] 'hilit-repaint-command) - -(add-hook 'find-file-hook 'hilit-find-file-hook t) +(define-minor-mode hilit-mode + "Obsolete minor mode. Use `global-font-lock-mode' instead." + :global t + + (unless (and hilit-inhibit-rebinding hilit-mode) + (substitute-key-definition + (if hilit-mode 'yank 'hilit-yank) + (if hilit-mode 'hilit-yank 'yank) + (current-global-map)) + (substitute-key-definition + (if hilit-mode 'yank-pop 'hilit-yank-pop) + (if hilit-mode 'hilit-yank-pop 'yank-pop) + (current-global-map)) + (substitute-key-definition + (if hilit-mode 'recenter 'hilit-recenter) + (if hilit-mode 'hilit-recenter 'recenter) + (current-global-map))) + + (if hilit-mode + (global-set-key [?\C-\S-l] 'hilit-repaint-command) + (global-unset-key [?\C-\S-l])) + + (if hilit-mode + (add-hook 'find-file-hook 'hilit-find-file-hook t) + (remove-hook 'find-file-hook 'hilit-find-file-hook)) + + (unless (and hilit-inhibit-hooks hilit-mode) + (condition-case c + (progn + + ;; BUFFER highlights... + (mapcar (lambda (hook) + (if hilit-mode + (add-hook hook 'hilit-rehighlight-buffer-quietly) + (remove-hook hook 'hilit-rehighlight-buffer-quietly))) + '( + Info-selection-hook + + ;; runs too early vm-summary-mode-hooks + vm-summary-pointer-hook + vm-preview-message-hook + vm-show-message-hook + + rmail-show-message-hook + mail-setup-hook + mh-show-mode-hook + + dired-after-readin-hook + )) + ) + (error (message "Error loading highlight hooks: %s" c) + (ding) (sit-for 1))))) (eval-when-compile (require 'gnus)) ; no compilation gripes -(and (not hilit-inhibit-hooks) - (condition-case c - (progn - - ;; BUFFER highlights... - (mapcar (function - (lambda (hook) - (add-hook hook 'hilit-rehighlight-buffer-quietly))) - '( - Info-selection-hook - -;; runs too early vm-summary-mode-hooks - vm-summary-pointer-hook - vm-preview-message-hook - vm-show-message-hook - - rmail-show-message-hook - mail-setup-hook - mh-show-mode-hook - - dired-after-readin-hook - )) - ) - (error (message "Error loading highlight hooks: %s" c) - (ding) (sit-for 1)))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Default patterns for various modes. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1510,5 +1522,5 @@ number of backslashes." (provide 'hilit19) -;;; arch-tag: db99739a-4837-41ee-ad02-3baced8ae71d +;; arch-tag: db99739a-4837-41ee-ad02-3baced8ae71d ;;; hilit19.el ends here diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 5dff6d954f8..f4b796dd1a7 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -150,7 +150,7 @@ This mirrors the optional behavior of tcsh." :type 'boolean :group 'pcomplete) -(defcustom pcomplete-suffix-list (list directory-sep-char ?:) +(defcustom pcomplete-suffix-list (list ?/ ?:) "*A list of characters which constitute a proper suffix." :type '(repeat character) :group 'pcomplete) @@ -740,7 +740,7 @@ component, `default-directory' is used as the basis for completion." (function (lambda (file) (if (eq (aref file (1- (length file))) - directory-sep-char) + ?/) (and pcomplete-dir-ignore (string-match pcomplete-dir-ignore file)) (and pcomplete-file-ignore @@ -757,11 +757,11 @@ component, `default-directory' is used as the basis for completion." ;; since . is earlier in the ASCII alphabet than ;; / (let ((left (if (eq (aref l (1- (length l))) - directory-sep-char) + ?/) (substring l 0 (1- (length l))) l)) (right (if (eq (aref r (1- (length r))) - directory-sep-char) + ?/) (substring r 0 (1- (length r))) r))) (if above-cutoff diff --git a/lisp/play/5x5.el b/lisp/play/5x5.el index 886e53a6afa..83d67958f44 100644 --- a/lisp/play/5x5.el +++ b/lisp/play/5x5.el @@ -224,9 +224,8 @@ Quit current game \\[5x5-quit-game]" 5x5-y-pos (/ 5x5-grid-size 2) 5x5-moves 0 5x5-grid (5x5-make-move (5x5-make-new-grid) 5x5-y-pos 5x5-x-pos)) - (when (interactive-p) - (5x5-draw-grid (list 5x5-grid)) - (5x5-position-cursor)))) + (5x5-draw-grid (list 5x5-grid)) + (5x5-position-cursor))) (defun 5x5-quit-game () "Quit the current game of `5x5'." diff --git a/lisp/play/fortune.el b/lisp/play/fortune.el index 306cf7daac1..3919f57e78c 100644 --- a/lisp/play/fortune.el +++ b/lisp/play/fortune.el @@ -271,7 +271,7 @@ and choose the directory as the fortune-file." (fortune-ask-file) fortune-file))) (save-excursion - (fortune-in-buffer (interactive-p) file) + (fortune-in-buffer t file) (set-buffer fortune-buffer-name) (let* ((fortune (buffer-string)) (signature (concat fortune-sigstart fortune fortune-sigend))) @@ -285,7 +285,7 @@ and choose the directory as the fortune-file." (defun fortune-in-buffer (interactive &optional file) "Put a fortune cookie in the *fortune* buffer. -When INTERACTIVE is nil, don't display it. Optional argument FILE, +INTERACTIVE is ignored. Optional argument FILE, when supplied, specifies the file to choose the fortune from." (let ((fortune-buffer (or (get-buffer fortune-buffer-name) (generate-new-buffer fortune-buffer-name))) diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el index fc1d2d46ab3..472cfc3053e 100644 --- a/lisp/progmodes/ada-xref.el +++ b/lisp/progmodes/ada-xref.el @@ -2154,17 +2154,17 @@ This is a GNAT specific function that uses gnatkrunch." adaname ) -(defun ada-make-body-gnatstub () +(defun ada-make-body-gnatstub (&optional interactive) "Create an Ada package body in the current buffer. This function uses the `gnatstub' program to create the body. This function typically is to be hooked into `ff-file-created-hooks'." - (interactive) + (interactive "p") (save-some-buffers nil nil) ;; If the current buffer is the body (as is the case when calling this ;; function from ff-file-created-hooks), then kill this temporary buffer - (unless (interactive-p) + (unless interactive (progn (set-buffer-modified-p nil) (kill-buffer (current-buffer)))) diff --git a/lisp/progmodes/autoconf.el b/lisp/progmodes/autoconf.el index 5bdb1fb25eb..ec83e33b10d 100644 --- a/lisp/progmodes/autoconf.el +++ b/lisp/progmodes/autoconf.el @@ -1,6 +1,6 @@ ;;; autoconf.el --- mode for editing Autoconf configure.in files -;; Copyright (C) 2000, 2003 Free Software Foundation, Inc. +;; Copyright (C) 2000, 2003, 2004 Free Software Foundation, Inc. ;; Author: Dave Love <fx@gnu.org> ;; Keywords: languages @@ -49,7 +49,7 @@ "AC_\\(SUBST\\|DEFINE\\(_UNQUOTED\\)?\\)(\\(\\sw+\\)") (defvar autoconf-font-lock-keywords - `(("A[CHM]_\\sw+" . font-lock-keyword-face) + `(("A[CHMS]_\\sw+" . font-lock-keyword-face) (,autoconf-definition-regexp 3 font-lock-function-name-face) ;; Are any other M4 keywords really appropriate for configure.in, diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 0dc73e96664..223455e9872 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -181,6 +181,16 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) (epc "^Error [0-9]+ at (\\([0-9]+\\):\\([^)\n]+\\))" 2 1) + (ftnchek-file + "^File \\(.+\\.f\\):$" + 1 nil nil 0) + (ftnchek-line-file + "\\(^Warning .* \\)?line \\([0-9]+\\)\\(?: col \\([0-9]+\\)\\)? file \\(.+\\.f\\)" + 4 2 3 (1) nil (1 'default nil t)) + (ftnchek-line + "\\(?:^\\(Warning\\) .* \\)?line \\([0-9]+\\)\\(?: col \\([0-9]+\\)\\)?" + nil 2 3 (1) nil (1 (compilation-face '(1)) nil t)) + (iar "^\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(?:Error\\|Warnin\\(g\\)\\)\\[[0-9]+\\]:" 1 2 nil (3)) @@ -191,8 +201,8 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) ;; fixme: should be `mips' (irix - "^[-[:alnum:]_/]+: \\(?:[sS]evere\\|[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*:\ - \\([^,\" \n\t]+\\)\\(?:, line\\|:\\) \\([0-9]+\\):" 3 4 nil (1 . 2)) + "^[-[:alnum:]_/ ]+: \\(?:\\(?:[sS]evere\\|[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*: \\)?\ +\\([^,\" \n\t]+\\)\\(?:, line\\|:\\) \\([0-9]+\\):" 3 4 nil (1 . 2)) (java "^\\(?:[ \t]+at \\|==[0-9]+== +\\(?:at\\|b\\(y\\)\\)\\).+(\\([^()\n]+\\):\\([0-9]+\\))$" 2 3 nil (1)) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index e679a48d642..94458df56e8 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -6664,11 +6664,11 @@ prototype \&SUB Returns prototype of the function given a reference. =pod Switch from Perl to POD. ") -(defun cperl-switch-to-doc-buffer () +(defun cperl-switch-to-doc-buffer (&optional interactive) "Go to the perl documentation buffer and insert the documentation." - (interactive) + (interactive "p") (let ((buf (get-buffer-create cperl-doc-buffer))) - (if (interactive-p) + (if interactive (switch-to-buffer-other-window buf) (set-buffer buf)) (if (= (buffer-size) 0) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 3ccea967bc5..737071203e0 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -56,7 +56,7 @@ (defun flymake-makehash(&optional test) (cond ((equal flymake-emacs 'xemacs) (if test (make-hash-table :test test) (make-hash-table))) - (t (makehash test)) + (t (makehash test)) ) ) @@ -370,8 +370,8 @@ (let* ((init-f (nth 0 (flymake-get-file-name-mode-and-masks file-name)))) ;(flymake-log 0 "calling %s" init-f) ;(funcall init-f (current-buffer)) + init-f ) - (nth 0 (flymake-get-file-name-mode-and-masks file-name)) ) (defun flymake-get-cleanup-function(file-name) @@ -846,7 +846,7 @@ Whenether a buffer for master-file-name exists, use it as a source instead of re (set-buffer source-buffer) (flymake-parse-residual source-buffer) - (flymake-post-syntax-check source-buffer) + (flymake-post-syntax-check source-buffer exit-status command) (flymake-set-buffer-is-running source-buffer nil) ) ) @@ -863,7 +863,7 @@ Whenether a buffer for master-file-name exists, use it as a source instead of re ) ) -(defun flymake-post-syntax-check(source-buffer) +(defun flymake-post-syntax-check(source-buffer exit-status command) "" (flymake-set-buffer-err-info source-buffer (flymake-get-buffer-new-err-info source-buffer)) (flymake-set-buffer-new-err-info source-buffer nil) @@ -1220,7 +1220,33 @@ Whenether a buffer for master-file-name exists, use it as a source instead of re ) ) -(eval-when-compile (require 'compile)) +(defun flymake-reformat-err-line-patterns-from-compile-el(original-list) + "grab error line patterns from original list in compile.el format, convert to flymake internal format" + (let* ((converted-list '())) + (mapcar + (lambda (item) + (setq item (cdr item)) + (let ((regexp (nth 0 item)) + (file (nth 1 item)) + (line (nth 2 item)) + (col (nth 3 item)) + end-line) + (if (consp file) (setq file (car file))) + (if (consp line) (setq end-line (cdr line) line (car line))) + (if (consp col) (setq col (car col))) + + (when (not (functionp line)) + (setq converted-list (cons (list regexp file line col) converted-list)) + ) + ) + ) + original-list + ) + converted-list + ) +) + +(require 'compile) (defvar flymake-err-line-patterns ; regexp file-idx line-idx col-idx (optional) text-idx(optional), match-end to end of string is error text (append '( @@ -1243,9 +1269,9 @@ Whenether a buffer for master-file-name exists, use it as a source instead of re (" *\\(\\[javac\\]\\)? *\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[ \t\n]*\\(.+\\)" 2 4 nil 5) ) - ;; compilation-error-regexp-alist) - (mapcar (lambda (x) (cdr x)) compilation-error-regexp-alist-alist)) - "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx)" + ;; compilation-error-regexp-alist) + (flymake-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist)) + "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx). Use flymake-reformat-err-line-patterns-from-compile-el to add patterns from compile.el" ) ;(defcustom flymake-err-line-patterns ; '( @@ -1452,7 +1478,7 @@ Whenether a buffer for master-file-name exists, use it as a source instead of re (let* ((dir (nth idx include-dirs))) (setq full-file-name (concat dir "/" rel-file-name)) (when (file-exists-p full-file-name) - (setq done t) + (setq found t) ) ) (setq idx (1+ idx)) @@ -1574,7 +1600,7 @@ Whenether a buffer for master-file-name exists, use it as a source instead of re process ) (error - (let ((err-str (format "Failed to launch syntax check process '%s' with args %s: %s" + (let* ((err-str (format "Failed to launch syntax check process '%s' with args %s: %s" cmd args (error-message-string err))) (source-file-name (buffer-file-name buffer)) (cleanup-f (flymake-get-cleanup-function source-file-name))) @@ -1905,7 +1931,8 @@ Whenether a buffer for master-file-name exists, use it as a source instead of re (defun flymake-mode(&optional arg) "toggle flymake-mode" (interactive) - (let ((old-flymake-mode flymake-mode)) + (let ((old-flymake-mode flymake-mode) + (turn-on nil)) (setq turn-on (if (null arg) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 64f8808c7f1..90c0a50c7dc 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -25,28 +25,28 @@ ;;; Commentary: -;; This mode acts as a graphical user interface to GDB. You can interact with +;; This mode acts as a graphical user interface to GDB. You can interact with ;; GDB through the GUD buffer in the usual way, but there are also further ;; buffers which control the execution and describe the state of your program. ;; It separates the input/output of your program from that of GDB, if -;; required, and watches expressions in the speedbar. It also uses features of +;; required, and watches expressions in the speedbar. It also uses features of ;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar ;; (see the GDB Graphical Interface section in the Emacs info manual). ;; Start the debugger with M-x gdba. ;; This file has evolved from gdba.el from GDB 5.0 written by Tom Lord and Jim -;; Kingdon and uses GDB's annotation interface. You don't need to know about +;; Kingdon and uses GDB's annotation interface. You don't need to know about ;; annotations to use this mode as a debugger, but if you are interested ;; developing the mode itself, then see the Annotations section in the GDB ;; info manual. ;; -;; GDB developers plan to make the annotation interface obsolete. A new +;; GDB developers plan to make the annotation interface obsolete. A new ;; interface called GDB/MI (machine interface) has been designed to replace -;; it. Some GDB/MI commands are used in this file through the CLI command -;; 'interpreter mi <mi-command>'. A file called gdb-mi.el is included in the +;; it. Some GDB/MI commands are used in this file through the CLI command +;; 'interpreter mi <mi-command>'. A file called gdb-mi.el is included in the ;; GDB repository for future releases (6.2 onwards) that uses GDB/MI as the -;; primary interface to GDB. It is still under development and is part of a +;; primary interface to GDB. It is still under development and is part of a ;; process to migrate Emacs from annotations to GDB/MI. ;; ;; Known Bugs: @@ -63,7 +63,7 @@ (defvar gdb-current-language nil) (defvar gdb-view-source t "Non-nil means that source code can be viewed.") (defvar gdb-selected-view 'source "Code type that user wishes to view.") -(defvar gdb-var-list nil "List of variables in watch window") +(defvar gdb-var-list nil "List of variables in watch window.") (defvar gdb-var-changed nil "Non-nil means that gdb-var-list has changed.") (defvar gdb-buffer-type nil) (defvar gdb-overlay-arrow-position nil) @@ -85,12 +85,12 @@ other with the source file with the main routine of the inferior. If `gdb-many-windows' is t, regardless of the value of `gdb-show-main', the layout below will appear unless `gdb-use-inferior-io-buffer' is nil when the source buffer -occupies the full width of the frame. Keybindings are given in +occupies the full width of the frame. Keybindings are given in relevant buffer. Watch expressions appear in the speedbar/slowbar. -The following interactive lisp functions help control operation : +The following commands help control operation : `gdb-many-windows' - Toggle the number of windows gdb uses. `gdb-restore-windows' - To restore the window layout. @@ -120,8 +120,7 @@ detailed description of this mode. RET gdb-frames-select | SPC gdb-toggle-breakpoint | RET gdb-goto-breakpoint | d gdb-delete-breakpoint ---------------------------------------------------------------------- -" +---------------------------------------------------------------------" ;; (interactive (list (gud-query-cmdline 'gdba))) ;; @@ -134,12 +133,14 @@ detailed description of this mode. (defcustom gdb-enable-debug-log nil "Non-nil means record the process input and output in `gdb-debug-log'." :type 'boolean - :group 'gud) + :group 'gud + :version "21.4") (defcustom gdb-use-inferior-io-buffer nil "Non-nil means display output from the inferior in a separate buffer." :type 'boolean - :group 'gud) + :group 'gud + :version "21.4") (defun gdb-ann3 () (setq gdb-debug-log nil) @@ -210,10 +211,10 @@ detailed description of this mode. (run-hooks 'gdba-mode-hook)) (defcustom gdb-use-colon-colon-notation nil - "Non-nil means use FUNCTION::VARIABLE format to display variables in the -speedbar." + "If non-nil use FUN::VAR format to display variables in the speedbar." ; :type 'boolean - :group 'gud) + :group 'gud + :version "21.4") (defun gud-watch () "Watch expression at point." @@ -376,7 +377,7 @@ speedbar." (setq gdb-var-changed t)))))) (defun gdb-edit-value (text token indent) - "Assign a value to a variable displayed in the speedbar" + "Assign a value to a variable displayed in the speedbar." (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) (varnum (cadr var)) (value)) (setq value (read-string "New value: ")) @@ -389,8 +390,8 @@ speedbar." 'ignore)))) (defcustom gdb-show-changed-values t - "Non-nil means use font-lock-warning-face to display values that have -recently changed in the speedbar." + "If non-nil highlight values that have recently changed in the speedbar. +The highlighting is done with `font-lock-warning-face'." :type 'boolean :group 'gud) @@ -422,23 +423,23 @@ INDENT is the current indentation depth." "The disposition of the output of the current gdb command. Possible values are these symbols: - user -- gdb output should be copied to the GUD buffer - for the user to see. + `user' -- gdb output should be copied to the GUD buffer + for the user to see. - inferior -- gdb output should be copied to the inferior-io buffer + `inferior' -- gdb output should be copied to the inferior-io buffer - pre-emacs -- output should be ignored util the post-prompt - annotation is received. Then the output-sink - becomes:... - emacs -- output should be collected in the partial-output-buffer - for subsequent processing by a command. This is the - disposition of output generated by commands that - gdb mode sends to gdb on its own behalf. - post-emacs -- ignore output until the prompt annotation is - received, then go to USER disposition. + `pre-emacs' -- output should be ignored util the post-prompt + annotation is received. Then the output-sink + becomes:... + `emacs' -- output should be collected in the partial-output-buffer + for subsequent processing by a command. This is the + disposition of output generated by commands that + gdb mode sends to gdb on its own behalf. + `post-emacs' -- ignore output until the prompt annotation is + received, then go to USER disposition. gdba (gdb-ui.el) uses all five values, gdbmi (gdb-mi.el) only two -(user and emacs).") +\(`user' and `emacs').") (defvar gdb-current-item nil "The most recent command item sent to gdb.") @@ -619,7 +620,7 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'." (defun gdb-send (proc string) "A comint send filter for gdb. -This filter may simply queue output for a later time." +This filter may simply queue input for a later time." (if gud-running (process-send-string proc (concat string "\n")) (gdb-enqueue-input (concat string "\n")))) @@ -660,7 +661,8 @@ This filter may simply queue output for a later time." (defcustom gud-gdba-command-name "gdb -annotate=3" "Default command to execute an executable under the GDB-UI debugger." :type 'string - :group 'gud) + :group 'gud + :version "21.4") (defvar gdb-annotation-rules '(("pre-prompt" gdb-pre-prompt) @@ -705,25 +707,25 @@ This filter may simply queue output for a later time." (setq gdb-current-item item) (with-current-buffer gud-comint-buffer (if (eq gud-minor-mode 'gdba) - (progn - (if (stringp item) - (progn - (setq gdb-output-sink 'user) - (process-send-string (get-buffer-process gud-comint-buffer) item)) + (if (stringp item) (progn - (gdb-clear-partial-output) - (setq gdb-output-sink 'pre-emacs) - (process-send-string (get-buffer-process gud-comint-buffer) - (car item))))) - ; case: eq gud-minor-mode 'gdbmi + (setq gdb-output-sink 'user) + (process-send-string (get-buffer-process gud-comint-buffer) item)) + (progn + (gdb-clear-partial-output) + (setq gdb-output-sink 'pre-emacs) + (process-send-string (get-buffer-process gud-comint-buffer) + (car item)))) + ;; case: eq gud-minor-mode 'gdbmi (gdb-clear-partial-output) (setq gdb-output-sink 'emacs) (process-send-string (get-buffer-process gud-comint-buffer) - (car item))))) + (car item))))) (defun gdb-pre-prompt (ignored) - "An annotation handler for `pre-prompt'. This terminates the collection of -output from a previous command if that happens to be in effect." + "An annotation handler for `pre-prompt'. +This terminates the collection of output from a previous command if that +happens to be in effect." (let ((sink gdb-output-sink)) (cond ((eq sink 'user) t) @@ -761,8 +763,9 @@ This sends the next command (if any) to gdb." (setq gdb-prompting t)) (defun gdb-starting (ignored) - "An annotation handler for `starting'. This says that I/O for the -subprocess is now the program being debugged, not GDB." + "An annotation handler for `starting'. +This says that I/O for the subprocess is now the program being debugged, +not GDB." (let ((sink gdb-output-sink)) (cond ((eq sink 'user) @@ -773,8 +776,9 @@ subprocess is now the program being debugged, not GDB." (t (error "Unexpected `starting' annotation"))))) (defun gdb-stopping (ignored) - "An annotation handler for `exited' and other annotations which say that I/O -for the subprocess is now GDB, not the program being debugged." + "An annotation handler for `exited' and other annotations. +They say that I/O for the subprocess is now GDB, not the program +being debugged." (if gdb-use-inferior-io-buffer (let ((sink gdb-output-sink)) (cond @@ -792,8 +796,9 @@ for the subprocess is now GDB, not the program being debugged." (t (error "Unexpected frame-begin annotation (%S)" sink))))) (defun gdb-stopped (ignored) - "An annotation handler for `stopped'. It is just like gdb-stopping, except -that if we already set the output sink to 'user in gdb-stopping, that is fine." + "An annotation handler for `stopped'. +It is just like `gdb-stopping', except that if we already set the output +sink to `user' in `gdb-stopping', that is fine." (setq gud-running nil) (let ((sink gdb-output-sink)) (cond @@ -803,8 +808,9 @@ that if we already set the output sink to 'user in gdb-stopping, that is fine." (t (error "Unexpected stopped annotation"))))) (defun gdb-post-prompt (ignored) - "An annotation handler for `post-prompt'. This begins the collection of -output from the current command if that happens to be appropriate." + "An annotation handler for `post-prompt'. +This begins the collection of output from the current command if that +happens to be appropriate." (if (not gdb-pending-triggers) (progn (gdb-get-current-frame) @@ -832,7 +838,7 @@ output from the current command if that happens to be appropriate." (error "Phase error in gdb-post-prompt (got %s)" sink))))) (defun gud-gdba-marker-filter (string) - "A gud marker filter for gdb. Handle a burst of output from GDB." + "A gud marker filter for gdb. Handle a burst of output from GDB." (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log)) ;; Recall the left over gud-marker-acc from last time (setq gud-marker-acc (concat gud-marker-acc string)) @@ -1065,10 +1071,10 @@ static char *magick[] = { "PBM data used for disabled breakpoint icon.") (defvar breakpoint-enabled-icon nil - "Icon for enabled breakpoint in display margin") + "Icon for enabled breakpoint in display margin.") (defvar breakpoint-disabled-icon nil - "Icon for disabled breakpoint in display margin") + "Icon for disabled breakpoint in display margin.") ;; Bitmap for breakpoint in fringe (define-fringe-bitmap 'breakpoint @@ -1133,7 +1139,7 @@ static char *magick[] = { (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) (defun gdb-mouse-toggle-breakpoint (event) - "Toggle breakpoint in left fringe/margin with mouse click" + "Toggle breakpoint in left fringe/margin with mouse click." (interactive "e") (mouse-minibuffer-check event) (let ((posn (event-end event))) @@ -1683,7 +1689,8 @@ static char *magick[] = { (defcustom gdb-show-main nil "Nil means don't display source file containing the main routine." :type 'boolean - :group 'gud) + :group 'gud + :version "21.4") (defun gdb-setup-windows () "Layout the window pattern for gdb-many-windows." @@ -1718,13 +1725,14 @@ static char *magick[] = { (other-window 1)) (defcustom gdb-many-windows nil - "Nil (the default value) means just pop up the GUD buffer -unless `gdb-show-main' is t. In this case it starts with two -windows: one displaying the GUD buffer and the other with the -source file with the main routine of the inferior. Non-nil means -display the layout shown for `gdba'." + "Nil means just pop up the GUD buffer unless `gdb-show-main' is t. +In this case it starts with two windows: one displaying the GUD +buffer and the other with the source file with the main routine +of the inferior. Non-nil means display the layout shown for +`gdba'." :type 'boolean - :group 'gud) + :group 'gud + :version "21.4") (defun gdb-many-windows (arg) "Toggle the number of windows in the basic arrangement." @@ -1760,8 +1768,8 @@ This arrangement depends on the value of `gdb-many-windows'." (other-window 1))) (defun gdb-reset () - "Exit a debugging session cleanly by killing the gdb buffers and resetting - the source buffers." + "Exit a debugging session cleanly. +Kills the gdb buffers and resets the source buffers." (dolist (buffer (buffer-list)) (unless (eq buffer gud-comint-buffer) (with-current-buffer buffer diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 4d9e05109a8..7a13ddba6ed 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1,7 +1,7 @@ ;;; grep.el --- run compiler as inferior of Emacs, parse error messages -;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999, 2001, 02, 2004 -;; Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +;; 2001, 2002, 2004 Free Software Foundation, Inc. ;; Author: Roland McGrath <roland@gnu.org> ;; Maintainer: FSF @@ -252,21 +252,12 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies \\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?[:) \t]" 1 (2 . 5) (4 . 6)) ("^\\(.+?\\)[:(]+\\([0-9]+\\)\\([:)]\\).*?\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)" 1 2 + ;; Calculate column positions (beg . end) of first grep match on a line ((lambda () (setq compilation-error-screen-columns nil) (- (match-beginning 5) (match-end 3) 8)) . - (lambda () (- (match-end 5) (match-end 3) 8))) - nil nil - (4 (list 'face nil 'invisible t 'intangible t)) - (5 (list 'face compilation-column-face)) - (6 (list 'face nil 'invisible t 'intangible t)) - ;; highlight other matches on the same line - ("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)" - nil nil - (1 (list 'face nil 'invisible t 'intangible t)) - (2 (list 'face compilation-column-face) t) - (3 (list 'face nil 'invisible t 'intangible t)))) + (lambda () (- (match-end 5) (match-end 3) 8)))) ("^Binary file \\(.+\\) matches$" 1 nil nil 1)) "Regexp used to match grep hits. See `compilation-error-regexp-alist'.") @@ -294,7 +285,16 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies ("^Grep \\(exited abnormally\\) with code \\([0-9]+\\).*" (0 '(face nil message nil help-echo nil mouse-face nil) t) (1 compilation-warning-face) - (2 compilation-line-face))) + (2 compilation-line-face)) + ;; Highlight grep matches and delete markers + ("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)" + (2 compilation-column-face) + ((lambda (p)) + (progn + ;; Delete markers with `replace-match' because it updates + ;; the match-data, whereas `delete-region' would render it obsolete. + (replace-match "" t t nil 3) + (replace-match "" t t nil 1))))) "Additional things to highlight in grep output. This gets tacked on the end of the generated expressions.") @@ -436,9 +436,11 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." (defun grep-default-command () (let ((tag-default - (funcall (or find-tag-default-function - (get major-mode 'find-tag-default-function) - 'find-tag-default))) + (shell-quote-argument + (or (funcall (or find-tag-default-function + (get major-mode 'find-tag-default-function) + 'find-tag-default)) + ""))) (sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)") (grep-default (or (car grep-history) grep-command))) ;; Replace the thing matching for with that around cursor. @@ -460,7 +462,7 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." 0 (match-beginning 2)) " *." (file-name-extension buffer-file-name)))) - (replace-match (or tag-default "") t t grep-default 1)))) + (replace-match tag-default t t grep-default 1)))) ;;;###autoload (defun grep (command-args &optional highlight-regexp) diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el index ae0c43c2730..692fce0234e 100644 --- a/lisp/progmodes/idlw-shell.el +++ b/lisp/progmodes/idlw-shell.el @@ -1137,10 +1137,10 @@ prompt is present and if `idlwave-shell-ready' is non-nil." (goto-char save-point)) (set-buffer save-buffer)))) -(defun idlwave-shell-send-char (c &optional no-error) +(defun idlwave-shell-send-char (c &optional error) "Send one character to the shell, without a newline." - (interactive "cChar to send to IDL: ") - (let ((errf (if (interactive-p) 'error 'message)) + (interactive "cChar to send to IDL: \np") + (let ((errf (if error 'error 'message)) buf proc) (if (or (not (setq buf (get-buffer (idlwave-shell-buffer)))) (not (setq proc (get-buffer-process buf)))) diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index a49f70aa0b0..a5e07049843 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -4231,7 +4231,7 @@ will re-read the catalog." (defvar idlwave-load-rinfo-idle-timer) -(defun idlwave-update-routine-info (&optional arg) +(defun idlwave-update-routine-info (&optional arg dont-concentrate) "Update the internal routine-info lists. These lists are used by `idlwave-routine-info' (\\[idlwave-routine-info]) and by `idlwave-complete' (\\[idlwave-complete]) to provide information @@ -4248,10 +4248,12 @@ Scans all IDLWAVE-mode buffers of the current editing session (see When an IDL shell is running, this command also queries the IDL program for currently compiled routines. +???Document what DONT-CONCENTRATE means??? + With prefix ARG, also reload the system and library lists. With two prefix ARG's, also rescans the library tree. With three prefix args, dispatch asynchronous process to do the update." - (interactive "P") + (interactive "P\np") ;; Stop any idle processing (if (or (and (fboundp 'itimerp) (itimerp idlwave-load-rinfo-idle-timer)) @@ -4300,7 +4302,7 @@ With three prefix args, dispatch asynchronous process to do the update." idlwave-query-shell-for-routine-info))) (if (or (not ask-shell) - (not (interactive-p))) + (not dont-concentrate)) ;; 1. If we are not going to ask the shell, we need to do the ;; concatenation now. ;; 2. When this function is called non-interactively, it means diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 42aabace4d2..cb2a3e2dfcc 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -6120,17 +6120,17 @@ stops due to beginning or end of buffer." (vhdl-keep-region-active) foundp)) -(defun vhdl-beginning-of-statement (&optional count lim) +(defun vhdl-beginning-of-statement (&optional count lim interactive) "Go to the beginning of the innermost VHDL statement. With prefix arg, go back N - 1 statements. If already at the beginning of a statement then go to the beginning of the preceding one. If within a string or comment, or next to a comment (only whitespace between), move by sentences instead of statements. -When called from a program, this function takes 2 optional args: the +When called from a program, this function takes 3 optional args: the prefix arg, and a buffer position limit which is the farthest back to -search." - (interactive "p") +search, and something whose meaning I don't understand." + (interactive "p\np") (let ((count (or count 1)) (case-fold-search t) (lim (or lim (point-min))) @@ -6139,7 +6139,7 @@ search." (save-excursion (goto-char lim) (setq state (parse-partial-sexp (point) here nil nil))) - (if (and (interactive-p) + (if (and interactive (or (nth 3 state) (nth 4 state) (looking-at (concat "[ \t]*" comment-start-skip)))) @@ -7531,10 +7531,10 @@ buffer." (defun vhdl-fill-region (beg end &optional arg) "Fill lines for a region of code." - (interactive "r") + (interactive "r\np") (save-excursion (goto-char beg) - (let ((margin (if (interactive-p) (current-indentation) (current-column)))) + (let ((margin (if interactive (current-indentation) (current-column)))) (goto-char end) (setq end (point-marker)) ;; remove inline comments, newlines and whitespace diff --git a/lisp/reveal.el b/lisp/reveal.el index 2809db23e2e..393400071a6 100644 --- a/lisp/reveal.el +++ b/lisp/reveal.el @@ -1,6 +1,6 @@ ;;; reveal.el --- Automatically reveal hidden text at point -;; Copyright (C) 2000, 2001 Free Software Foundation, Inc. +;; Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc. ;; Author: Stefan Monnier <monnier@cs.yale.edu> ;; Keywords: outlines @@ -59,6 +59,9 @@ (defvar reveal-open-spots nil) (make-variable-buffer-local 'reveal-open-spots) +(defvar reveal-last-tick nil) +(make-variable-buffer-local 'reveal-last-tick) + ;; Actual code (defun reveal-post-command () @@ -90,16 +93,16 @@ (overlays-at (point)))) (push (cons (selected-window) ol) reveal-open-spots) (setq old-ols (delq ol old-ols)) - (let ((open (overlay-get ol 'reveal-toggle-invisible))) + (let ((open (overlay-get ol 'reveal-toggle-invisible)) inv) (when (or open - (let ((inv (overlay-get ol 'invisible))) - (and inv (symbolp inv) - (or (setq open (or (get inv 'reveal-toggle-invisible) - (overlay-get ol 'isearch-open-invisible-temporary))) - (overlay-get ol 'isearch-open-invisible) - (and (consp buffer-invisibility-spec) - (assq inv buffer-invisibility-spec))) - (overlay-put ol 'reveal-invisible inv)))) + (and (setq inv (overlay-get ol 'invisible)) + (symbolp inv) + (or (setq open (or (get inv 'reveal-toggle-invisible) + (overlay-get ol 'isearch-open-invisible-temporary))) + (overlay-get ol 'isearch-open-invisible) + (and (consp buffer-invisibility-spec) + (assq inv buffer-invisibility-spec))) + (overlay-put ol 'reveal-invisible inv))) (if (null open) (overlay-put ol 'invisible nil) ;; Use the provided opening function and repeat (since the @@ -113,27 +116,39 @@ (setq repeat nil) (overlay-put ol 'invisible nil)))))))) ;; Close old overlays. - (dolist (ol old-ols) - (when (and (eq (current-buffer) (overlay-buffer ol)) - (not (rassq ol reveal-open-spots))) - (if (and (>= (point) (save-excursion - (goto-char (overlay-start ol)) - (line-beginning-position 1))) - (<= (point) (save-excursion - (goto-char (overlay-end ol)) - (line-beginning-position 2)))) - ;; Still near the overlay: keep it open. - (push (cons (selected-window) ol) reveal-open-spots) - ;; Really close it. - (let ((open (overlay-get ol 'reveal-toggle-invisible)) inv) - (if (or open - (and (setq inv (overlay-get ol 'reveal-invisible)) - (setq open (or (get inv 'reveal-toggle-invisible) - (overlay-get ol 'isearch-open-invisible-temporary))))) - (condition-case err - (funcall open ol t) - (error (message "!!Reveal-hide: %s !!" err))) - (overlay-put ol 'invisible inv))))))) + (if (not (eq reveal-last-tick + (setq reveal-last-tick (buffer-modified-tick)))) + ;; The buffer was modified since last command: let's refrain from + ;; closing any overlay because it tends to behave poorly when + ;; inserting text at the end of an overlay (basically the overlay + ;; should be rear-advance when it's open, but things like + ;; outline-minor-mode make it non-rear-advance because it's + ;; a better choice when it's closed). + (dolist (ol old-ols) + (push (cons (selected-window) ol) reveal-open-spots)) + ;; The last command was only a point motion or some such + ;; non-buffer-modifying command. Let's close whatever can be closed. + (dolist (ol old-ols) + (when (and (eq (current-buffer) (overlay-buffer ol)) + (not (rassq ol reveal-open-spots))) + (if (and (>= (point) (save-excursion + (goto-char (overlay-start ol)) + (line-beginning-position 1))) + (<= (point) (save-excursion + (goto-char (overlay-end ol)) + (line-beginning-position 2)))) + ;; Still near the overlay: keep it open. + (push (cons (selected-window) ol) reveal-open-spots) + ;; Really close it. + (let ((open (overlay-get ol 'reveal-toggle-invisible)) inv) + (if (or open + (and (setq inv (overlay-get ol 'reveal-invisible)) + (setq open (or (get inv 'reveal-toggle-invisible) + (overlay-get ol 'isearch-open-invisible-temporary))))) + (condition-case err + (funcall open ol t) + (error (message "!!Reveal-hide: %s !!" err))) + (overlay-put ol 'invisible inv)))))))) (error (message "Reveal: %s" err))))) ;;;###autoload @@ -171,5 +186,5 @@ With zero or negative ARG turn mode off." (provide 'reveal) -;;; arch-tag: 96ba0242-2274-4ed7-8e10-26bc0707b4d8 +;; arch-tag: 96ba0242-2274-4ed7-8e10-26bc0707b4d8 ;;; reveal.el ends here diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el index f047223cbae..b3149500ae5 100644 --- a/lisp/shadowfile.el +++ b/lisp/shadowfile.el @@ -518,8 +518,9 @@ Pending copies are stored in variable `shadow-files-to-copy', and in `shadow-save-buffers-kill-emacs', so it is not usually necessary to call it manually." (interactive "P") - (if (and (not shadow-files-to-copy) (interactive-p)) - (message "No files need to be shadowed.") + (if (not shadow-files-to-copy) + (if (interactive-p) + (message "No files need to be shadowed.")) (save-excursion (map-y-or-n-p (function (lambda (pair) diff --git a/lisp/simple.el b/lisp/simple.el index 6420ebffd54..cde0e75f030 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1,7 +1,7 @@ ;;; simple.el --- basic editing commands for Emacs ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 99, -;; 2000, 01, 02, 03, 04 +;; 2000, 01, 02, 03, 2004 ;; Free Software Foundation, Inc. ;; Maintainer: FSF @@ -3916,6 +3916,8 @@ During execution of Lisp code, this character causes a quit directly. At top-level, as an editor command, this simply beeps." (interactive) (deactivate-mark) + (if (fboundp 'kmacro-keyboard-quit) + (kmacro-keyboard-quit)) (setq defining-kbd-macro nil) (signal 'quit nil)) diff --git a/lisp/speedbar.el b/lisp/speedbar.el index db16f2f78f3..c182dffdba7 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -354,7 +354,9 @@ Any parameter supported by a frame may be added. The parameter `height' will be initialized to the height of the frame speedbar is attached to and added to this list before the new frame is initialized." :group 'speedbar - :type '(repeat (sexp :tag "Parameter:"))) + :type '(repeat (cons :format "%v" + (symbol :tag "Parameter") + (sexp :tag "Value")))) ;; These values by Hrvoje Niksic <hniksic@srce.hr> (defcustom speedbar-frame-plist diff --git a/lisp/strokes.el b/lisp/strokes.el index 57f1e3355b2..f1121d1fee5 100644 --- a/lisp/strokes.el +++ b/lisp/strokes.el @@ -1746,7 +1746,7 @@ Store XPM in buffer BUFNAME if supplied \(default is ` *strokes-xpm*'\)" (strokes-mode -1) (remove-hook 'kill-emacs-query-functions 'strokes-prompt-user-save-strokes)) -(add-hooks 'strokes-unload-hook 'strokes-unload-hook) +(add-hook 'strokes-unload-hook 'strokes-unload-hook) (run-hooks 'strokes-load-hook) (provide 'strokes) diff --git a/lisp/subr.el b/lisp/subr.el index 7d666f4c157..54d382dea61 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -817,6 +817,10 @@ is converted into a string by expressing it in decimal." (make-obsolete-variable 'post-command-idle-delay "use timers instead, with `run-with-idle-timer'." "before 19.34") +(defvaralias 'x-lost-selection-hooks 'x-lost-selection-functions) +(make-obsolete-variable 'x-lost-selection-hooks 'x-lost-selection-functions "21.4") +(defvaralias 'x-sent-selection-hooks 'x-sent-selection-functions) +(make-obsolete-variable 'x-sent-selection-hooks 'x-sent-selection-functions "21.4") ;;;; Alternate names for functions - these are not being phased out. @@ -1211,6 +1215,61 @@ any other non-digit terminates the character code and is then used as input.")) (setq first nil)) code)) +(defun read-passwd (prompt &optional confirm default) + "Read a password, prompting with PROMPT, and return it. +If optional CONFIRM is non-nil, read the password twice to make sure. +Optional DEFAULT is a default password to use instead of empty input. + +This function echoes `.' for each character that the user types. +The user ends with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. +C-g quits; if `inhibit-quit' was non-nil around this function, +then it returns nil if the user types C-g. + +Once the caller uses the password, it can erase the password +by doing (clear-string STRING)." + (with-local-quit + (if confirm + (let (success) + (while (not success) + (let ((first (read-passwd prompt nil default)) + (second (read-passwd "Confirm password: " nil default))) + (if (equal first second) + (progn + (and (arrayp second) (clear-string second)) + (setq success first)) + (and (arrayp first) (clear-string first)) + (and (arrayp second) (clear-string second)) + (message "Password not repeated accurately; please start over") + (sit-for 1)))) + success) + (let ((pass nil) + (c 0) + (echo-keystrokes 0) + (cursor-in-echo-area t)) + (while (progn (message "%s%s" + prompt + (make-string (length pass) ?.)) + (setq c (read-char-exclusive nil t)) + (and (/= c ?\r) (/= c ?\n) (/= c ?\e))) + (clear-this-command-keys) + (if (= c ?\C-u) + (progn + (and (arrayp pass) (clear-string pass)) + (setq pass "")) + (if (and (/= c ?\b) (/= c ?\177)) + (let* ((new-char (char-to-string c)) + (new-pass (concat pass new-char))) + (and (arrayp pass) (clear-string pass)) + (clear-string new-char) + (setq c ?\0) + (setq pass new-pass)) + (if (> (length pass) 0) + (let ((new-pass (substring pass 0 -1))) + (and (arrayp pass) (clear-string pass)) + (setq pass new-pass)))))) + (message nil) + (or pass default ""))))) + ;; This should be used by `call-interactively' for `n' specs. (defun read-number (prompt &optional default) (let ((n nil)) diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 181fc9baca5..4fc73288de2 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -580,7 +580,7 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'. ;; Prevent loss of data when saving the file. (set (make-local-variable 'file-precious-flag) t) (auto-save-mode 0) - (set (make-local-variable 'write-contents-hooks) '(tar-mode-write-file)) + (set (make-local-variable 'write-contents-functions) '(tar-mode-write-file)) (widen) (if (and (boundp 'tar-header-offset) tar-header-offset) (narrow-to-region (point-min) tar-header-offset) diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index ddc1d4ecb62..dd989fbea81 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -42,6 +42,8 @@ ;;; Code: +(require 'button) + ;; User Options: @@ -496,7 +498,7 @@ Each element is a pair of strings (ABBREVIATION . EXPANSION)." (defcustom bibtex-string-files nil "*List of BibTeX files containing string definitions. -Those files must be specified using pathnames relative to the +List elements can be absolute file names or file names relative to the directories specified in `bibtex-string-file-path'." :group 'bibtex :type '(repeat file)) @@ -504,6 +506,18 @@ directories specified in `bibtex-string-file-path'." (defvar bibtex-string-file-path (getenv "BIBINPUTS") "*Colon separated list of paths to search for `bibtex-string-files'.") +(defcustom bibtex-files nil + "*List of BibTeX files checked for duplicate keys. +List elements can be absolute file names or file names relative to the +directories specified in `bibtex-file-path'. If an element is a directory, +check all BibTeX files in this directory. If an element is the symbol +`bibtex-file-path', check all BibTeX files in `bibtex-file-path'." + :group 'bibtex + :type '(repeat file)) + +(defvar bibtex-file-path (getenv "BIBINPUTS") + "*Colon separated list of paths to search for `bibtex-files'.") + (defcustom bibtex-help-message t "*If non-nil print help messages in the echo area on entering a new field." :group 'bibtex @@ -557,7 +571,7 @@ See `bibtex-generate-autokey' for details." ;; braces, quotes, concatenation. ("[`'\"{}#]" . "") ;; spaces - ("[ \t\n]+" . " ")) + ("\\\\?[ \t\n]+\\|~" . " ")) "Alist of (OLD-REGEXP . NEW-STRING) pairs. Used by the default values of `bibtex-autokey-name-change-strings' and `bibtex-autokey-titleword-change-strings'. Defaults to translating some @@ -756,12 +770,22 @@ If non-nil, the column for the equal sign is the value of (defcustom bibtex-autoadd-commas t "If non-nil automatically add missing commas at end of BibTeX fields." + :group 'bibtex :type 'boolean) (defcustom bibtex-autofill-types '("Proceedings") "Automatically fill fields if possible for those BibTeX entry types." + :group 'bibtex :type '(repeat string)) +(defcustom bibtex-summary-function 'bibtex-summary + "Function to call for generating a one-line summary of a BibTeX entry. +It takes one argument, the key of the entry. +Used by `bibtex-complete-key-cleanup' and `bibtex-copy-summary-as-kill'." + :group 'bibtex + :type '(choice (const :tag "Default" bibtex-summary) + (function :tag "Personalized function"))) + (defcustom bibtex-generate-url-list '((("url" . ".*:.*")) ;; Example of a complex setup. @@ -778,7 +802,7 @@ These schemes are used by `bibtex-url'. Each scheme is of the form ((FIELD . REGEXP) STEP...). FIELD is a field name as returned by `bibtex-parse-entry'. -REGEXP is matched against the text of FIELD. If the match succeed, then +REGEXP is matched against the text of FIELD. If the match succeeds, then this scheme will be used. If no STEPS are specified the matched text is used as the URL, otherwise the URL is built by concatenating the STEPS. @@ -838,6 +862,7 @@ Case is always ignored. Always remove the field delimiters." (define-key km "\C-c\C-c" 'bibtex-clean-entry) (define-key km "\C-c\C-q" 'bibtex-fill-entry) (define-key km "\C-c\C-s" 'bibtex-find-entry) + (define-key km "\C-c\C-t" 'bibtex-copy-summary-as-kill) (define-key km "\C-c?" 'bibtex-print-help-message) (define-key km "\C-c\C-p" 'bibtex-pop-previous) (define-key km "\C-c\C-n" 'bibtex-pop-next) @@ -892,7 +917,9 @@ Case is always ignored. Always remove the field delimiters." ("Moving in BibTeX Buffer" ["Find Entry" bibtex-find-entry t] ["Find Crossref Entry" bibtex-find-crossref t]) - "--" + ("Moving between BibTeX Buffers" + ["Find Entry Globally" bibtex-find-entry-globally t]) + "--" ("Operating on Current Field" ["Fill Field" fill-paragraph t] ["Remove Delimiters" bibtex-remove-delimiters t] @@ -922,6 +949,8 @@ Case is always ignored. Always remove the field delimiters." ["Paste Most Recently Killed Entry" bibtex-yank t] ["Paste Previously Killed Entry" bibtex-yank-pop t] "--" + ["Copy Summary to Kill Ring" bibtex-copy-summary-as-kill t] + "--" ["Ispell Entry" bibtex-ispell-entry t] ["Ispell Entry Abstract" bibtex-ispell-abstract t] ["Narrow to Entry" bibtex-narrow-to-entry t] @@ -934,7 +963,9 @@ Case is always ignored. Always remove the field delimiters." ["Reformat Entries" bibtex-reformat t] ["Count Entries" bibtex-count-entries t] "--" - ["Convert Alien Buffer" bibtex-convert-alien t]))) + ["Convert Alien Buffer" bibtex-convert-alien t]) + ("Operating on Multiple Buffers" + ["Validate Entries" bibtex-validate-globally t]))) (easy-menu-define bibtex-entry-menu bibtex-mode-map "Entry-Types Menu in BibTeX mode" @@ -955,13 +986,6 @@ Case is always ignored. Always remove the field delimiters." ["String" bibtex-String t] ["Preamble" bibtex-Preamble t])) -(defvar bibtex-url-map - (let ((km (make-sparse-keymap))) - (define-key km [(mouse-2)] 'bibtex-url) - km) - "Local keymap for clickable URLs.") -(fset 'bibtex-url-map bibtex-url-map) - ;; Internal Variables @@ -996,8 +1020,9 @@ Initialized from `bibtex-predefined-strings' and `bibtex-string-files'.") (make-variable-buffer-local 'bibtex-strings) (defvar bibtex-reference-keys - (lazy-completion-table bibtex-reference-keys bibtex-parse-keys nil nil t) - "Completion table for BibTeX reference keys.") + (lazy-completion-table bibtex-reference-keys bibtex-parse-keys nil t) + "Completion table for BibTeX reference keys. +The CDRs of the elements are t for header keys and nil for crossref keys.") (make-variable-buffer-local 'bibtex-reference-keys) (defvar bibtex-buffer-last-parsed-tick nil @@ -1103,13 +1128,13 @@ Initialized from `bibtex-predefined-strings' and `bibtex-string-files'.") (,(concat "^[ \t]*\\(" bibtex-field-name "\\)[ \t]*=") 1 font-lock-variable-name-face) ;; url - (bibtex-font-lock-url 0 '(face nil mouse-face highlight - keymap bibtex-url-map))) + bibtex-font-lock-url bibtex-font-lock-crossref) "*Default expressions to highlight in BibTeX mode.") (defvar bibtex-font-lock-url-regexp - (concat "\\<" (regexp-opt (mapcar 'caar bibtex-generate-url-list) t) - "\\>[ \t]*=[ \t]*") + ;; Assume that field names begin at the beginning of a line. + (concat "^[ \t]*" (regexp-opt (mapcar 'caar bibtex-generate-url-list) t) + "[ \t]*=[ \t]*") "Regexp for `bibtex-font-lock-url'.") (defvar bibtex-field-name-for-parsing nil @@ -1128,32 +1153,12 @@ Auto-generated from `bibtex-sort-entry-class'. Used when `bibtex-maintain-sorted-entries' is `entry-class'.") -;; Special support taking care of variants -(defvar zmacs-regions) -(defalias 'bibtex-mark-active - (if (boundp 'mark-active) - ;; In Emacs mark-active indicates if mark is active. - (lambda () mark-active) - ;; In XEmacs (mark) returns nil when not active. - (lambda () (if zmacs-regions (mark) (mark t))))) - -(defalias 'bibtex-run-with-idle-timer - (if (fboundp 'run-with-idle-timer) - ;; timer.el is distributed with Emacs - 'run-with-idle-timer - ;; timer.el is not distributed with XEmacs - ;; Notice that this does not (yet) pass the arguments, but they - ;; are not used (yet) in bibtex.el. Fix if needed. - (lambda (secs repeat function &rest args) - (start-itimer "bibtex" function secs (if repeat secs nil) t)))) - - ;; Support for hideshow minor mode (defun bibtex-hs-forward-sexp (arg) "Replacement for `forward-sexp' to be used by `hs-minor-mode'. ARG is ignored." (if (looking-at "@\\S(*\\s(") - (goto-char (1- (match-end 0)))) + (goto-char (1- (match-end 0)))) (forward-sexp 1)) (add-to-list @@ -1471,12 +1476,10 @@ delimiters if present." (buffer-substring-no-properties (1+ (match-beginning bibtex-type-in-head)) (match-end bibtex-type-in-head))) -(defun bibtex-key-in-head (&optional empty) +(defsubst bibtex-key-in-head (&optional empty) "Extract BibTeX key in head. Return optional arg EMPTY if key is empty." - (if (match-beginning bibtex-key-in-head) - (buffer-substring-no-properties (match-beginning bibtex-key-in-head) - (match-end bibtex-key-in-head)) - empty)) + (or (match-string-no-properties bibtex-key-in-head) + empty)) ;; Helper Functions @@ -1492,7 +1495,7 @@ delimiters if present." (defun bibtex-current-line () "Compute line number of point regardless whether the buffer is narrowed." (+ (count-lines 1 (point)) - (if (equal (current-column) 0) 1 0))) + (if (bolp) 1 0))) (defun bibtex-skip-to-valid-entry (&optional backward) "Move point to beginning of the next valid BibTeX entry. @@ -1525,24 +1528,25 @@ entry is found, nil otherwise." found)) (defun bibtex-map-entries (fun) - "Call FUN for each BibTeX entry starting with the current. -Do this to the end of the file. FUN is called with three arguments, the key of -the entry and the buffer positions (marker) of beginning and end of entry. -Point is inside the entry. If `bibtex-sort-ignore-string-entries' is non-nil, -FUN will not be called for @String entries." + "Call FUN for each BibTeX entry in buffer (possibly narrowed). +FUN is called with three arguments, the key of the entry and the buffer +positions (marker) of beginning and end of entry. Point is inside the entry. +If `bibtex-sort-ignore-string-entries' is non-nil, FUN will not be called for +@String entries." (let ((case-fold-search t)) - (bibtex-beginning-of-entry) - (while (re-search-forward bibtex-entry-head nil t) - (let ((entry-type (bibtex-type-in-head)) - (key (bibtex-key-in-head "")) - (beg (copy-marker (match-beginning 0))) - (end (copy-marker (save-excursion (bibtex-end-of-entry))))) - (save-excursion - (if (or (and (not bibtex-sort-ignore-string-entries) - (bibtex-string= entry-type "string")) - (assoc-string entry-type bibtex-entry-field-alist t)) - (funcall fun key beg end))) - (goto-char end))))) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward bibtex-entry-head nil t) + (let ((entry-type (bibtex-type-in-head)) + (key (bibtex-key-in-head "")) + (beg (copy-marker (match-beginning 0))) + (end (copy-marker (save-excursion (bibtex-end-of-entry))))) + (save-excursion + (if (or (and (not bibtex-sort-ignore-string-entries) + (bibtex-string= entry-type "string")) + (assoc-string entry-type bibtex-entry-field-alist t)) + (funcall fun key beg end))) + (goto-char end)))))) (defun bibtex-progress-message (&optional flag interval) "Echo a message about progress of current buffer. @@ -1581,13 +1585,13 @@ If FLAG is nil, a message is echoed if point was incremented at least "\"")) (defun bibtex-entry-left-delimiter () - "Return a string dependent on `bibtex-field-delimiters'." + "Return a string dependent on `bibtex-entry-delimiters'." (if (equal bibtex-entry-delimiters 'braces) "{" "(")) (defun bibtex-entry-right-delimiter () - "Return a string dependent on `bibtex-field-delimiters'." + "Return a string dependent on `bibtex-entry-delimiters'." (if (equal bibtex-entry-delimiters 'braces) "}" ")")) @@ -1641,7 +1645,7 @@ are defined, but only for the head part of the entry (setq infix-start (bibtex-end-of-field bounds)) (setq finished t)) (goto-char infix-start)) - ;; This matches the infix* part. The AND construction assures + ;; This matches the infix* part. The AND construction assures ;; that BOUND is respected. (when (and (looking-at bibtex-entry-postfix) (eq (char-before (match-end 0)) entry-closer) @@ -1826,8 +1830,8 @@ Formats current entry according to variable `bibtex-entry-format'." (cdr field))) (cdr field)) req-field-list (if crossref-key - (nth 0 (nth 2 entry-list)) ; crossref part - (nth 0 (nth 1 entry-list)))) ; required part + (nth 0 (nth 2 entry-list)) ; crossref part + (nth 0 (nth 1 entry-list)))) ; required part (dolist (rfield req-field-list) (when (nth 3 rfield) ; we should have an alternative @@ -1864,9 +1868,9 @@ Formats current entry according to variable `bibtex-entry-format'." deleted) ;; We have more elegant high-level functions for several - ;; tasks done by bibtex-format-entry. However, they contain + ;; tasks done by bibtex-format-entry. However, they contain ;; quite some redundancy compared with what we need to do - ;; anyway. So for speed-up we avoid using them. + ;; anyway. So for speed-up we avoid using them. (if (memq 'opts-or-alts format) (cond ((and empty-field @@ -1875,8 +1879,8 @@ Formats current entry according to variable `bibtex-entry-format'." field-name req-field-list t))) (or (not field) ; OPT field (nth 3 field))))) ; ALT field - ;; Either it is an empty ALT field. Then we have checked - ;; already that we have one non-empty alternative. Or it + ;; Either it is an empty ALT field. Then we have checked + ;; already that we have one non-empty alternative. Or it ;; is an empty OPT field that we do not miss anyway. ;; So we can safely delete this field. (delete-region beg-field end-field) @@ -2041,19 +2045,33 @@ applied to the content of FIELD. It is an alist with pairs (dolist (pattern change-list content) (setq content (replace-regexp-in-string (car pattern) (cdr pattern) - content))))) + content t))))) (defun bibtex-autokey-get-names () "Get contents of the name field of the current entry. -Do some modifications based on `bibtex-autokey-name-change-strings' -and return results as a list." - (let ((case-fold-search t) - (names (bibtex-autokey-get-field "author\\|editor" +Do some modifications based on `bibtex-autokey-name-change-strings'. +Return the names as a concatenated string obeying `bibtex-autokey-names' +and `bibtex-autokey-names-stretch'." + (let ((names (bibtex-autokey-get-field "author\\|editor" bibtex-autokey-name-change-strings))) ;; Some entries do not have a name field. (unless (string= "" names) - (mapcar 'bibtex-autokey-demangle-name - (split-string names "[ \t\n]+and[ \t\n]+"))))) + (let* ((case-fold-search t) + (name-list (mapcar 'bibtex-autokey-demangle-name + (split-string names "[ \t\n]+and[ \t\n]+"))) + additional-names) + (unless (or (not (numberp bibtex-autokey-names)) + (<= (length name-list) + (+ bibtex-autokey-names + bibtex-autokey-names-stretch))) + ;; Take bibtex-autokey-names elements from beginning of name-list + (setq name-list (nreverse (nthcdr (- (length name-list) + bibtex-autokey-names) + (nreverse name-list))) + additional-names bibtex-autokey-additional-names)) + (concat (mapconcat 'identity name-list + bibtex-autokey-name-separator) + additional-names))))) (defun bibtex-autokey-demangle-name (fullname) "Get the last part from a well-formed FULLNAME and perform abbreviations." @@ -2082,8 +2100,15 @@ and return results as a list." (funcall bibtex-autokey-name-case-convert name) bibtex-autokey-name-length))) +(defun bibtex-autokey-get-year () + "Return year field contents as a string obeying `bibtex-autokey-year-length'." + (let ((yearfield (bibtex-autokey-get-field "year"))) + (substring yearfield (max 0 (- (length yearfield) + bibtex-autokey-year-length))))) + (defun bibtex-autokey-get-title () - "Get title field contents up to a terminator." + "Get title field contents up to a terminator. +Return the result as a string" (let ((case-fold-search t) (titlestring (bibtex-autokey-get-field "title" @@ -2092,35 +2117,37 @@ and return results as a list." (dolist (terminator bibtex-autokey-title-terminators) (if (string-match terminator titlestring) (setq titlestring (substring titlestring 0 (match-beginning 0))))) - ;; gather words from titlestring into a list. Ignore + ;; gather words from titlestring into a list. Ignore ;; specific words and use only a specific amount of words. (let ((counter 0) - titlewords titlewords-extra titleword end-match) + titlewords titlewords-extra word) (while (and (or (not (numberp bibtex-autokey-titlewords)) (< counter (+ bibtex-autokey-titlewords bibtex-autokey-titlewords-stretch))) (string-match "\\b\\w+" titlestring)) - (setq end-match (match-end 0) - titleword (substring titlestring - (match-beginning 0) end-match)) + (setq word (match-string 0 titlestring) + titlestring (substring titlestring (match-end 0))) + ;; Ignore words matched by one of the elements of + ;; bibtex-autokey-titleword-ignore (unless (let ((lst bibtex-autokey-titleword-ignore)) (while (and lst (not (string-match (concat "\\`\\(?:" (car lst) - "\\)\\'") titleword))) + "\\)\\'") word))) (setq lst (cdr lst))) lst) - (setq titleword - (funcall bibtex-autokey-titleword-case-convert titleword)) + (setq word (funcall bibtex-autokey-titleword-case-convert word) + counter (1+ counter)) (if (or (not (numberp bibtex-autokey-titlewords)) (< counter bibtex-autokey-titlewords)) - (setq titlewords (append titlewords (list titleword))) - (setq titlewords-extra - (append titlewords-extra (list titleword)))) - (setq counter (1+ counter))) - (setq titlestring (substring titlestring end-match))) + (push word titlewords) + (push word titlewords-extra)))) + ;; Obey bibtex-autokey-titlewords-stretch: + ;; If by now we have processed all words in titlestring, we include + ;; titlewords-extra in titlewords. Otherwise, we ignore titlewords-extra. (unless (string-match "\\b\\w+" titlestring) - (setq titlewords (append titlewords titlewords-extra))) - (mapcar 'bibtex-autokey-demangle-title titlewords)))) + (setq titlewords (append titlewords-extra titlewords))) + (mapconcat 'bibtex-autokey-demangle-title (nreverse titlewords) + bibtex-autokey-titleword-separator)))) (defun bibtex-autokey-demangle-title (titleword) "Do some abbreviations on TITLEWORD. @@ -2211,65 +2238,36 @@ The generation algorithm works as follows: the key is then presented in the minibuffer to the user, where it can be edited. The key given by the user is then used." - (let* ((name-etal "") - (namelist - (let ((nl (bibtex-autokey-get-names)) - nnl) - (if (or (not (numberp bibtex-autokey-names)) - (<= (length nl) - (+ bibtex-autokey-names - bibtex-autokey-names-stretch))) - nl - (setq name-etal bibtex-autokey-additional-names) - (while (< (length nnl) bibtex-autokey-names) - (setq nnl (append nnl (list (car nl))) - nl (cdr nl))) - nnl))) - (namepart (concat (mapconcat 'identity - namelist - bibtex-autokey-name-separator) - name-etal)) - (yearfield (bibtex-autokey-get-field "year")) - (yearpart (if (equal yearfield "") - "" - (substring yearfield - (- (length yearfield) - bibtex-autokey-year-length)))) - (titlepart (mapconcat 'identity - (bibtex-autokey-get-title) - bibtex-autokey-titleword-separator)) + (let* ((names (bibtex-autokey-get-names)) + (year (bibtex-autokey-get-year)) + (title (bibtex-autokey-get-title)) (autokey (concat bibtex-autokey-prefix-string - namepart - (unless (or (equal namepart "") - (equal yearpart "")) + names + (unless (or (equal names "") + (equal year "")) bibtex-autokey-name-year-separator) - yearpart - (unless (or (and (equal namepart "") - (equal yearpart "")) - (equal titlepart "")) + year + (unless (or (and (equal names "") + (equal year "")) + (equal title "")) bibtex-autokey-year-title-separator) - titlepart))) + title))) (if bibtex-autokey-before-presentation-function (funcall bibtex-autokey-before-presentation-function autokey) autokey))) -(defun bibtex-parse-keys (&optional add abortable verbose) +(defun bibtex-read-key (prompt &optional key) + "Read BibTeX key from minibuffer using PROMPT and default KEY." + (completing-read prompt bibtex-reference-keys + nil nil key 'bibtex-key-history)) + +(defun bibtex-parse-keys (&optional abortable verbose) "Set `bibtex-reference-keys' to the keys used in the whole buffer. -The buffer might possibly be restricted. -Find both entry keys and crossref entries. -If ADD is non-nil add the new keys to `bibtex-reference-keys' instead of -simply resetting it. If ADD is an alist of keys, also add ADD to -`bibtex-reference-keys'. If ABORTABLE is non-nil abort on user -input. If VERBOSE is non-nil gives messages about progress. -Return alist of keys if parsing was completed, `aborted' otherwise." - (let ((reference-keys (if (and add - (listp bibtex-reference-keys)) - bibtex-reference-keys))) - (if (listp add) - (dolist (key add) - (unless (assoc (car key) reference-keys) - (push key reference-keys)))) +Find both entry keys and crossref entries. If ABORTABLE is non-nil abort on +user input. If VERBOSE is non-nil gives messages about progress. Return alist +of keys if parsing was completed, `aborted' otherwise." + (let (ref-keys crossref-keys) (save-excursion (save-match-data (if verbose @@ -2286,22 +2284,24 @@ Return alist of keys if parsing was completed, `aborted' otherwise." (if (and abortable (input-pending-p)) ;; user has aborted by typing a key --> return `aborted' (throw 'userkey 'aborted)) - (let ((key (cond ((match-end 3) - ;; This is a crossref. - (buffer-substring-no-properties - (1+ (match-beginning 3)) (1- (match-end 3)))) - ((assoc-string (bibtex-type-in-head) - bibtex-entry-field-alist t) - ;; This is an entry. - (match-string-no-properties bibtex-key-in-head))))) - (if (and (stringp key) - (not (assoc key reference-keys))) - (push (list key) reference-keys))))) + (cond ((match-end 3) + ;; This is a crossref. + (let ((key (buffer-substring-no-properties + (1+ (match-beginning 3)) (1- (match-end 3))))) + (unless (assoc key crossref-keys) + (push (list key) crossref-keys)))) + ;; only keys of known entries + ((assoc-string (bibtex-type-in-head) + bibtex-entry-field-alist t) + ;; This is an entry. + (let ((key (bibtex-key-in-head))) + (unless (assoc key ref-keys) + (push (cons key t) ref-keys))))))) (let (;; ignore @String entries because they are handled ;; separately by bibtex-parse-strings (bibtex-sort-ignore-string-entries t) - crossref-key bounds) + bounds) (bibtex-map-entries (lambda (key beg end) (if (and abortable @@ -2309,17 +2309,19 @@ Return alist of keys if parsing was completed, `aborted' otherwise." ;; user has aborted by typing a key --> return `aborted' (throw 'userkey 'aborted)) (if verbose (bibtex-progress-message)) - (unless (assoc key reference-keys) - (push (list key) reference-keys)) + (unless (assoc key ref-keys) + (push (cons key t) ref-keys)) (if (and (setq bounds (bibtex-search-forward-field "crossref" end)) - (setq crossref-key (bibtex-text-in-field-bounds bounds t)) - (not (assoc crossref-key reference-keys))) - (push (list crossref-key) reference-keys)))))) + (setq key (bibtex-text-in-field-bounds bounds t)) + (not (assoc key crossref-keys))) + (push (list key) crossref-keys)))))) + (dolist (key crossref-keys) + (unless (assoc (car key) ref-keys) (push key ref-keys))) (if verbose (bibtex-progress-message 'done)) ;; successful operation --> return `bibtex-reference-keys' - (setq bibtex-reference-keys reference-keys)))))) + (setq bibtex-reference-keys ref-keys)))))) (defun bibtex-parse-strings (&optional add abortable) "Set `bibtex-strings' to the string definitions in the whole buffer. @@ -2355,39 +2357,44 @@ Return alist of strings if parsing was completed, `aborted' otherwise." (defun bibtex-string-files-init () "Return initialization for `bibtex-strings'. -Use `bibtex-predefined-strings' and bib files `bibtex-string-files'." +Use `bibtex-predefined-strings' and BibTeX files `bibtex-string-files'." (save-match-data - ;; collect pathnames - (let ((dirlist (split-string (or bibtex-string-file-path ".") + (let ((dirlist (split-string (or bibtex-string-file-path default-directory) ":+")) (case-fold-search) - compl) + string-files fullfilename compl bounds found) + ;; collect absolute file names of valid string files (dolist (filename bibtex-string-files) (unless (string-match "\\.bib\\'" filename) (setq filename (concat filename ".bib"))) ;; test filenames - (let (fullfilename bounds found) + (if (file-name-absolute-p filename) + (if (file-readable-p filename) + (push filename string-files) + (error "BibTeX strings file %s not found" filename)) (dolist (dir dirlist) (when (file-readable-p (setq fullfilename (expand-file-name filename dir))) - ;; file was found - (with-temp-buffer - (insert-file-contents fullfilename) - (goto-char (point-min)) - (while (setq bounds (bibtex-search-forward-string)) - (push (cons (bibtex-reference-key-in-string bounds) - (bibtex-text-in-string bounds t)) - compl) - (goto-char (bibtex-end-of-string bounds)))) + (push fullfilename string-files) (setq found t))) (unless found (error "File %s not in paths defined via bibtex-string-file-path" filename)))) + ;; parse string files + (dolist (filename string-files) + (with-temp-buffer + (insert-file-contents filename) + (goto-char (point-min)) + (while (setq bounds (bibtex-search-forward-string)) + (push (cons (bibtex-reference-key-in-string bounds) + (bibtex-text-in-string bounds t)) + compl) + (goto-char (bibtex-end-of-string bounds))))) (append bibtex-predefined-strings (nreverse compl))))) (defun bibtex-parse-buffers-stealthily () "Parse buffer in the background during idle time. -Called by `bibtex-run-with-idle-timer'. Whenever Emacs has been idle +Called by `run-with-idle-timer'. Whenever Emacs has been idle for `bibtex-parse-keys-timeout' seconds, all BibTeX buffers (starting with the current) are parsed." (save-excursion @@ -2402,7 +2409,7 @@ with the current) are parsed." (widen) ;; Output no progress messages in bibtex-parse-keys ;; because when in y-or-n-p that can hide the question. - (if (and (listp (bibtex-parse-keys nil t)) + (if (and (listp (bibtex-parse-keys t)) ;; update bibtex-strings (listp (bibtex-parse-strings strings-init t))) @@ -2410,6 +2417,51 @@ with the current) are parsed." (setq bibtex-buffer-last-parsed-tick (buffer-modified-tick))))) (setq buffers (cdr buffers)))))) +(defun bibtex-files-expand (&optional current) + "Return an expanded list of BibTeX buffers based on `bibtex-files'. +Initialize in these buffers `bibtex-reference-keys' if not yet set. +List includes current buffer if CURRENT is non-nil." + (let ((file-path (split-string (or bibtex-file-path default-directory) ":+")) + file-list dir-list buffer-list) + (dolist (file bibtex-files) + (cond ((eq file 'bibtex-file-path) + (setq dir-list (append dir-list file-path))) + ((file-accessible-directory-p file) + (push file dir-list)) + ((progn (unless (string-match "\\.bib\\'" file) + (setq file (concat file ".bib"))) + (file-name-absolute-p file)) + (push file file-list)) + (t + (let (fullfilename found) + (dolist (dir file-path) + (when (file-readable-p + (setq fullfilename (expand-file-name file dir))) + (push fullfilename file-list) + (setq found t))) + (unless found + (error "File %s not in paths defined via bibtex-file-path" + file)))))) + (dolist (file file-list) + (unless (file-readable-p file) + (error "BibTeX file %s not found" file))) + ;; expand dir-list + (dolist (dir dir-list) + (setq file-list + (append file-list (directory-files dir t "\\.bib\\'" t)))) + (delete-dups file-list) + (dolist (file file-list) + (when (file-readable-p file) + (push (find-file-noselect file) buffer-list) + (with-current-buffer (car buffer-list) + (unless (listp bibtex-reference-keys) + (bibtex-parse-keys))))) + (cond ((and current (not (memq (current-buffer) buffer-list))) + (push (current-buffer) buffer-list)) + ((and (not current) (memq (current-buffer) buffer-list)) + (setq buffer-list (delq (current-buffer) buffer-list)))) + buffer-list)) + (defun bibtex-complete-internal (completions) "Complete word fragment before point to longest prefix of COMPLETIONS. COMPLETIONS should be a list of strings. If point is not after the part @@ -2459,58 +2511,59 @@ expansion of STR using expansion list STRINGS-ALIST." (bibtex-remove-delimiters)))))))) (defun bibtex-complete-key-cleanup (key) - "Display message on entry KEY after completion of a crossref key." + "Display summary message on entry KEY after completion of a crossref key. +Use `bibtex-summary-function' to generate summary." (save-excursion ;; Don't do anything if we completed the key of an entry. (let ((pnt (bibtex-beginning-of-entry))) (if (and (stringp key) (bibtex-find-entry key) (/= pnt (point))) - (let* ((bibtex-autokey-name-case-convert 'identity) - (bibtex-autokey-name-length 'infty) - (nl (bibtex-autokey-get-names)) - (name (concat (nth 0 nl) (if (nth 1 nl) " etal"))) - (year (bibtex-autokey-get-field "year")) - (bibtex-autokey-titlewords 5) - (bibtex-autokey-titlewords-stretch 2) - (bibtex-autokey-titleword-case-convert 'identity) - (bibtex-autokey-titleword-length 5) - (title (mapconcat 'identity - (bibtex-autokey-get-title) " ")) - (journal (bibtex-autokey-get-field - "journal" bibtex-autokey-transcriptions)) - (volume (bibtex-autokey-get-field "volume")) - (pages (bibtex-autokey-get-field "pages" '(("-.*\\'" . ""))))) - (message "Ref:%s" - (mapconcat (lambda (arg) - (if (not (string= "" (cdr arg))) - (concat (car arg) (cdr arg)))) - `((" " . ,name) (" " . ,year) - (": " . ,title) (", " . ,journal) - (" " . ,volume) (":" . ,pages)) - ""))))))) - -(defun bibtex-choose-completion-string (choice buffer mini-p base-size) - ;; Code borrowed from choose-completion-string: - ;; We must duplicate the code from choose-completion-string - ;; because it runs the hook choose-completion-string-functions - ;; before it inserts the completion. But we want to do something - ;; after the completion has been inserted. - ;; - ;; Insert the completion into the buffer where it was requested. - (set-buffer buffer) - (if base-size - (delete-region (+ base-size (point-min)) - (point)) - ;; Delete the longest partial match for CHOICE - ;; that can be found before point. - (choose-completion-delete-max-match choice)) - (insert choice) - (remove-text-properties (- (point) (length choice)) (point) - '(mouse-face nil)) - ;; Update point in the window that BUFFER is showing in. - (let ((window (get-buffer-window buffer t))) - (set-window-point window (point)))) + (message "Ref: %s" (funcall bibtex-summary-function key)))))) + +(defun bibtex-copy-summary-as-kill (key) + "Push summery of BibTeX entry KEY to kill ring. +Use `bibtex-summary-function' to generate summary." + (interactive + (list (bibtex-read-key + "Key: " (save-excursion + (bibtex-beginning-of-entry) + (when (re-search-forward bibtex-entry-head nil t) + (bibtex-key-in-head)))))) + (kill-new (message "%s" (funcall bibtex-summary-function key)))) + +(defun bibtex-summary (key) + "Return summary of BibTeX entry KEY. +Used as default value of `bibtex-summary-function'." + ;; It would be neat to customize this function. How? + (save-excursion + (if (bibtex-find-entry key) + (let* ((bibtex-autokey-name-case-convert 'identity) + (bibtex-autokey-name-length 'infty) + (bibtex-autokey-names 1) + (bibtex-autokey-names-stretch 0) + (bibtex-autokey-name-separator " ") + (bibtex-autokey-additional-names " etal") + (names (bibtex-autokey-get-names)) + (bibtex-autokey-year-length 4) + (year (bibtex-autokey-get-year)) + (bibtex-autokey-titlewords 5) + (bibtex-autokey-titlewords-stretch 2) + (bibtex-autokey-titleword-case-convert 'identity) + (bibtex-autokey-titleword-length 5) + (bibtex-autokey-titleword-separator " ") + (title (bibtex-autokey-get-title)) + (journal (bibtex-autokey-get-field + "journal" bibtex-autokey-transcriptions)) + (volume (bibtex-autokey-get-field "volume")) + (pages (bibtex-autokey-get-field "pages" '(("-.*\\'" . ""))))) + (mapconcat (lambda (arg) + (if (not (string= "" (cdr arg))) + (concat (car arg) (cdr arg)))) + `((" " . ,names) (" " . ,year) (": " . ,title) + (", " . ,journal) (" " . ,volume) (":" . ,pages)) + "")) + (error "Key `%s' not found." key)))) (defun bibtex-pop (arg direction) "Fill current field from the ARG'th same field's text in DIRECTION. @@ -2550,7 +2603,7 @@ Generic function used by `bibtex-pop-previous' and `bibtex-pop-next'." (if failure (error "No %s matching BibTeX field" (if (eq direction 'previous) "previous" "next")) - ;; Found a matching field. Remember boundaries. + ;; Found a matching field. Remember boundaries. (setq bibtex-pop-previous-search-point (bibtex-start-of-field bounds) bibtex-pop-next-search-point (bibtex-end-of-field bounds) new-text (bibtex-text-in-field-bounds bounds)) @@ -2563,10 +2616,82 @@ Generic function used by `bibtex-pop-previous' and `bibtex-pop-next'." (bibtex-find-text nil)) (setq this-command 'bibtex-pop)) -(defsubst bibtex-read-key (prompt &optional key) - "Read BibTeX key from minibuffer using PROMPT and default KEY." - (completing-read prompt bibtex-reference-keys - nil nil key 'bibtex-key-history)) +(defun bibtex-beginning-of-field () + "Move point backward to beginning of field. +This function uses a simple, fast algorithm assuming that the field +begins at the beginning of a line. We use this function for font-locking." + (let ((field-reg (concat "^[ \t]*" bibtex-field-name "[ \t]*="))) + (beginning-of-line) + (unless (looking-at field-reg) + (re-search-backward field-reg nil t)))) + +(defun bibtex-font-lock-url (bound) + "Font-lock for URLs." + (let ((case-fold-search t) + (pnt (point)) + field bounds start end found) + (bibtex-beginning-of-field) + (while (and (not found) + (prog1 (re-search-forward bibtex-font-lock-url-regexp bound t) + (setq field (match-string-no-properties 1))) + (setq bounds (bibtex-parse-field-text)) + (progn + (setq start (car bounds) end (cdr bounds)) + ;; Always ignore field delimiters + (if (memq (char-before end) '(?\} ?\")) + (setq end (1- end))) + (if (memq (char-after start) '(?\{ ?\")) + (setq start (1+ start))) + (>= bound start))) + (let ((lst bibtex-generate-url-list) url) + (goto-char start) + (while (and (not found) + (setq url (caar lst))) + (setq found (and (bibtex-string= field (car url)) + (re-search-forward (cdr url) end t) + (>= (match-beginning 0) pnt)) + lst (cdr lst)))) + (goto-char end)) + (if found (bibtex-button (match-beginning 0) (match-end 0) + 'bibtex-url (match-beginning 0))) + found)) + +(defun bibtex-font-lock-crossref (bound) + "Font-lock for crossref fields." + (let ((case-fold-search t) + (pnt (point)) + (crossref-reg (concat "^[ \t]*crossref[ \t]*=[ \t\n]*" + "\\(\"[^\"]*\"\\|{[^}]*}\\)[ \t\n]*[,})]")) + start end found) + (bibtex-beginning-of-field) + (while (and (not found) + (re-search-forward crossref-reg bound t)) + (setq start (1+ (match-beginning 1)) + end (1- (match-end 1)) + found (>= start pnt))) + (if found (bibtex-button start end 'bibtex-find-crossref + (buffer-substring-no-properties start end) + start t)) + found)) + +(defun bibtex-button-action (button) + "Call BUTTON's BibTeX function." + (apply (button-get button 'bibtex-function) + (button-get button 'bibtex-args))) + +(define-button-type 'bibtex-url + 'action 'bibtex-button-action + 'bibtex-function 'bibtex-url + 'help-echo (purecopy "mouse-2, RET: follow URL")) + +(define-button-type 'bibtex-find-crossref + 'action 'bibtex-button-action + 'bibtex-function 'bibtex-find-crossref + 'help-echo (purecopy "mouse-2, RET: follow crossref")) + +(defun bibtex-button (beg end type &rest args) + (make-text-button beg end 'type type 'bibtex-args args)) + ;; Interactive Functions: @@ -2668,7 +2793,7 @@ non-nil. (make-local-variable 'bibtex-buffer-last-parsed-tick) ;; Install stealthy parse function if not already installed (unless bibtex-parse-idle-timer - (setq bibtex-parse-idle-timer (bibtex-run-with-idle-timer + (setq bibtex-parse-idle-timer (run-with-idle-timer bibtex-parse-keys-timeout t 'bibtex-parse-buffers-stealthily))) (set (make-local-variable 'paragraph-start) "[ \f\n\t]*$") @@ -2680,8 +2805,8 @@ non-nil. (set (make-local-variable 'outline-regexp) "[ \t]*@") (set (make-local-variable 'fill-paragraph-function) 'bibtex-fill-field) (set (make-local-variable 'fill-prefix) (make-string (+ bibtex-entry-offset - bibtex-contline-indentation) - ? )) + bibtex-contline-indentation) + ? )) (set (make-local-variable 'font-lock-defaults) '(bibtex-font-lock-keywords nil t ((?$ . "\"") @@ -2693,7 +2818,7 @@ non-nil. ) nil (font-lock-syntactic-keywords . bibtex-font-lock-syntactic-keywords) - (font-lock-extra-managed-props . (mouse-face keymap)) + (font-lock-extra-managed-props . (category)) (font-lock-mark-block-function . (lambda () (set-mark (bibtex-end-of-entry)) @@ -2776,8 +2901,7 @@ according to `bibtex-entry-field-alist', but are not yet present." ;; bibtex-parse-entry moves point to the end of the last field. (let* ((fields-alist (bibtex-parse-entry)) (field-list (bibtex-field-list - (substring (cdr (assoc "=type=" fields-alist)) - 1)))) ; don't want @ + (cdr (assoc "=type=" fields-alist))))) (dolist (field (car field-list)) (unless (assoc-string (car field) fields-alist t) (bibtex-make-field field))) @@ -2793,8 +2917,8 @@ TEXT may be nil. Remove \"OPT\" and \"ALT\" from FIELD. Move point to the end of the last field." (let (alist bounds) (when (looking-at bibtex-entry-maybe-empty-head) - (push (cons "=type=" (match-string bibtex-type-in-head)) alist) - (push (cons "=key=" (match-string bibtex-key-in-head)) alist) + (push (cons "=type=" (bibtex-type-in-head)) alist) + (push (cons "=key=" (bibtex-key-in-head)) alist) (goto-char (match-end 0)) (while (setq bounds (bibtex-parse-field bibtex-field-name)) (push (cons (bibtex-name-in-field bounds t) @@ -2809,8 +2933,8 @@ Move point to the end of the last field." (undo-boundary) ;So you can easily undo it, if it didn't work right. (bibtex-beginning-of-entry) (when (looking-at bibtex-entry-head) - (let ((type (match-string bibtex-type-in-head)) - (key (match-string bibtex-key-in-head)) + (let ((type (bibtex-type-in-head)) + (key (bibtex-key-in-head)) (key-end (match-end bibtex-key-in-head)) (case-fold-search t) tmp other-key other bounds) @@ -2823,9 +2947,9 @@ Move point to the end of the last field." (bibtex-beginning-of-entry) (when (and (looking-at bibtex-entry-head) - (bibtex-string= type (match-string bibtex-type-in-head)) + (bibtex-string= type (bibtex-type-in-head)) ;; In case we found ourselves :-( - (not (equal key (setq tmp (match-string bibtex-key-in-head))))) + (not (equal key (setq tmp (bibtex-key-in-head))))) (setq other-key tmp) (setq other (point)))) (save-excursion @@ -2833,9 +2957,9 @@ Move point to the end of the last field." (bibtex-skip-to-valid-entry) (when (and (looking-at bibtex-entry-head) - (bibtex-string= type (match-string bibtex-type-in-head)) + (bibtex-string= type (bibtex-type-in-head)) ;; In case we found ourselves :-( - (not (equal key (setq tmp (match-string bibtex-key-in-head)))) + (not (equal key (setq tmp (bibtex-key-in-head)))) (or (not other-key) ;; Check which is the best match. (< (length (try-completion "" (list key other-key))) @@ -2883,24 +3007,26 @@ Move point to the end of the last field." (message (nth 1 comment)) (message "No comment available"))))) -(defun bibtex-make-field (field &optional called-by-yank) +(defun bibtex-make-field (field &optional called-by-yank interactive) "Make a field named FIELD in current BibTeX entry. FIELD is either a string or a list of the form \(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in `bibtex-entry-field-alist'. -If CALLED-BY-YANK is non-nil, don't insert delimiters." +If CALLED-BY-YANK is non-nil, don't insert delimiters. +In that case, or when called interactively, also don't do (WHAT?)." (interactive (list (let ((completion-ignore-case t) (field-list (bibtex-field-list - (save-excursion - (bibtex-enclosing-entry-maybe-empty-head) - (bibtex-type-in-head))))) + (save-excursion + (bibtex-enclosing-entry-maybe-empty-head) + (bibtex-type-in-head))))) (completing-read "BibTeX field name: " (append (car field-list) (cdr field-list)) - nil nil nil bibtex-field-history)))) + nil nil nil bibtex-field-history)) + t)) (unless (consp field) (setq field (list field))) - (if (or (interactive-p) called-by-yank) + (if (or interactive called-by-yank) (let (bibtex-help-message) (bibtex-find-text nil t t) (if (looking-at "[}\"]") @@ -2923,7 +3049,7 @@ If CALLED-BY-YANK is non-nil, don't insert delimiters." ((fboundp init) (insert (funcall init))))) (unless called-by-yank (insert (bibtex-field-right-delimiter))) - (when (interactive-p) + (when interactive (forward-char -1) (bibtex-print-help-message))) @@ -3003,17 +3129,13 @@ If mark is active it counts entries in region, if not in whole buffer." (not count-string-entries))) (save-excursion (save-restriction - (narrow-to-region (if (bibtex-mark-active) - (region-beginning) + (narrow-to-region (if mark-active (region-beginning) (bibtex-beginning-of-first-entry)) - (if (bibtex-mark-active) - (region-end) - (point-max))) - (goto-char (point-min)) + (if mark-active (region-end) (point-max))) (bibtex-map-entries (lambda (key beg end) (setq number (1+ number)))))) (message "%s contains %d entries." - (if (bibtex-mark-active) "Region" "Buffer") + (if mark-active "Region" "Buffer") number))) (defun bibtex-ispell-entry () @@ -3110,12 +3232,39 @@ will be ignored." nil ; ENDKEY function 'bibtex-lessp))) ; PREDICATE -(defun bibtex-find-crossref (crossref-key) +(defun bibtex-find-entry-globally (key) + "Move point to the beginning of BibTeX entry named KEY in `bibtex-files'." + (interactive + (list (let (key-alist) + (dolist (buffer (bibtex-files-expand t)) + (with-current-buffer buffer + (setq key-alist (append bibtex-reference-keys key-alist)))) + (completing-read "Find key: " key-alist + nil nil nil 'bibtex-key-history)))) + (let ((buffer-list (bibtex-files-expand t)) + buffer found) + (while (and (not found) + (setq buffer (pop buffer-list))) + (with-current-buffer buffer + (if (cdr (assoc-string key bibtex-reference-keys)) + (setq found t)))) + (if found + (progn + (let ((same-window-buffer-names + (cons (buffer-name buffer) same-window-buffer-names))) + (pop-to-buffer buffer)) + (bibtex-find-entry key)) + (message "Key `%s' not found" key)))) + +(defun bibtex-find-crossref (crossref-key &optional pnt split) "Move point to the beginning of BibTeX entry CROSSREF-KEY. Return position of entry if CROSSREF-KEY is found and nil otherwise. If position of current entry is after CROSSREF-KEY an error is signaled. +Optional arg PNT is the position of the referencing entry. +If optional arg SPLIT is non-nil, split window so that both the referencing +and the crossrefed entry are displayed. If called interactively, CROSSREF-KEY defaults to crossref key of current -entry." +entry and SPLIT is t." (interactive (let ((crossref-key (save-excursion @@ -3123,11 +3272,23 @@ entry." (let ((bounds (bibtex-search-forward-field "crossref" t))) (if bounds (bibtex-text-in-field-bounds bounds t)))))) - (list (bibtex-read-key "Find crossref key: " crossref-key)))) + (list (bibtex-read-key "Find crossref key: " crossref-key) (point) t))) (let ((pos (save-excursion (bibtex-find-entry crossref-key)))) - (if (and pos (> (point) pos)) - (error "This entry must not follow the crossrefed entry!")) - (goto-char pos))) + (unless pnt (setq pnt (point))) + (cond ((not pos) + (message "Crossref key `%s' not found" crossref-key)) + (split + (goto-char pnt) + (select-window (split-window)) + (goto-char pos) + (beginning-of-line) + (set-window-start (selected-window) (point)) + (if (> pnt pos) + (error "The referencing entry must preceed the crossrefed entry!"))) + ((> pnt pos) + (error "The referencing entry must preceed the crossrefed entry!")) + (t (goto-char pos))) + pos)) (defun bibtex-find-entry (key &optional start) "Move point to the beginning of BibTeX entry named KEY. @@ -3212,23 +3373,21 @@ Return t if preparation was successful or nil if entry KEY already exists." (defun bibtex-validate (&optional test-thoroughly) "Validate if buffer or region is syntactically correct. -Only known entry types are checked, so you can put comments -outside of entries. -With optional argument TEST-THOROUGHLY non-nil it checks for absence of -required fields and questionable month fields as well. +Check also for duplicate keys and correct sort order provided +`bibtex-maintain-sorted-entries' is non-nil. +With optional argument TEST-THOROUGHLY non-nil check also for +the absence of required fields and for questionable month fields. If mark is active, validate current region, if not the whole buffer. -Returns t if test was successful, nil otherwise." +Only check known entry types, so you can put comments outside of entries. +Return t if test was successful, nil otherwise." (interactive "P") (let* ((case-fold-search t) error-list syntax-error) (save-excursion (save-restriction - (narrow-to-region (if (bibtex-mark-active) - (region-beginning) + (narrow-to-region (if mark-active (region-beginning) (bibtex-beginning-of-first-entry)) - (if (bibtex-mark-active) - (region-end) - (point-max))) + (if mark-active (region-end) (point-max))) ;; looking if entries fit syntactical structure (goto-char (point-min)) @@ -3244,41 +3403,54 @@ Returns t if test was successful, nil otherwise." (if (equal (point) pnt) (forward-char) (goto-char pnt) - (push (list (bibtex-current-line) + (push (cons (bibtex-current-line) "Syntax error (check esp. commas, braces, and quotes)") error-list) (forward-char)))))) (bibtex-progress-message 'done) (if error-list + ;; proceed only if there were no syntax errors. (setq syntax-error t) - ;; looking for correct sort order and duplicates (only if - ;; there were no syntax errors) - (if bibtex-maintain-sorted-entries - (let (previous current) - (goto-char (point-min)) - (bibtex-progress-message "Checking correct sort order") - (bibtex-map-entries - (lambda (key beg end) - (bibtex-progress-message) - (goto-char beg) - (setq current (bibtex-entry-index)) - (cond ((or (not previous) - (bibtex-lessp previous current)) - (setq previous current)) - ((string-equal (car previous) (car current)) - (push (list (bibtex-current-line) - "Duplicate key with previous") - error-list)) - (t - (setq previous current) - (push (list (bibtex-current-line) - "Entries out of order") - error-list))))) - (bibtex-progress-message 'done))) + + ;; looking for duplicate keys and correct sort order + (let (previous current key-list) + (bibtex-progress-message "Checking for duplicate keys") + (bibtex-map-entries + (lambda (key beg end) + (bibtex-progress-message) + (goto-char beg) + (setq current (bibtex-entry-index)) + (cond ((not previous)) + ((member key key-list) + (push (cons (bibtex-current-line) + (format "Duplicate key `%s'" key)) + error-list)) + ((and bibtex-maintain-sorted-entries + (not (bibtex-lessp previous current))) + (push (cons (bibtex-current-line) + "Entries out of order") + error-list))) + (push key key-list) + (setq previous current))) + (bibtex-progress-message 'done)) + + ;; Check for duplicate keys in `bibtex-files'. + (bibtex-parse-keys) + (dolist (buffer (bibtex-files-expand)) + (dolist (key (with-current-buffer buffer + ;; We don't want to be fooled by outdated + ;; bibtex-reference-keys. + (bibtex-parse-keys) bibtex-reference-keys)) + (when (and (cdr key) + (cdr (assoc-string (car key) bibtex-reference-keys))) + (bibtex-find-entry (car key)) + (push (cons (bibtex-current-line) + (format "Duplicate key `%s' in %s" (car key) + (abbreviate-file-name (buffer-file-name buffer)))) + error-list)))) (when test-thoroughly - (goto-char (point-min)) (bibtex-progress-message "Checking required fields and month fields") (let ((bibtex-sort-ignore-string-entries t)) @@ -3292,73 +3464,135 @@ Returns t if test was successful, nil otherwise." bibtex-entry-field-alist t))) (req (copy-sequence (elt (elt entry-list 1) 0))) (creq (copy-sequence (elt (elt entry-list 2) 0))) - crossref-there bounds) + crossref-there bounds alt-there field) (goto-char beg) (while (setq bounds (bibtex-search-forward-field bibtex-field-name end)) (goto-char (bibtex-start-of-text-in-field bounds)) (let ((field-name (bibtex-name-in-field bounds))) (if (and (bibtex-string= field-name "month") - (not (assoc-string (bibtex-text-in-field-bounds bounds) - bibtex-predefined-month-strings t))) - (push (list (bibtex-current-line) + ;; Check only abbreviated month fields. + (let ((month (bibtex-text-in-field-bounds bounds))) + (not (or (string-match "\\`[\"{].+[\"}]\\'" month) + (assoc-string + month + bibtex-predefined-month-strings t))))) + (push (cons (bibtex-current-line) "Questionable month field") error-list)) - (setq req (delete (assoc-string field-name req t) req) + (setq field (assoc-string field-name req t)) + (if (nth 3 field) + (if alt-there (push (cons (bibtex-current-line) + "More than one non-empty alternative") + error-list) + (setq alt-there t))) + (setq req (delete field req) creq (delete (assoc-string field-name creq t) creq)) (if (bibtex-string= field-name "crossref") (setq crossref-there t)))) (if crossref-there (setq req creq)) - (if (or (> (length req) 1) - (and (= (length req) 1) - (not (elt (car req) 3)))) - ;; two (or more) fields missed or one field - ;; missed and this isn't flagged alternative - ;; (notice that this fails if there are more - ;; than two alternatives in a BibTeX entry, - ;; which isn't the case momentarily) - (push (list (save-excursion - (bibtex-beginning-of-entry) - (bibtex-current-line)) - (concat "Required field `" (caar req) "' missing")) - error-list)))))) + (let (alt) + (dolist (field req) + (if (nth 3 field) + (push (car field) alt) + (push (cons (save-excursion (goto-char beg) + (bibtex-current-line)) + (format "Required field `%s' missing" + (car field))) + error-list))) + ;; The following fails if there are more than two + ;; alternatives in a BibTeX entry, which isn't + ;; the case momentarily. + (if (cdr alt) + (push (cons (save-excursion (goto-char beg) + (bibtex-current-line)) + (format "Alternative fields `%s'/`%s' missing" + (car alt) (cadr alt))) + error-list))))))) (bibtex-progress-message 'done))))) + (if error-list - (let ((bufnam (buffer-name)) - (dir default-directory)) - (setq error-list - (sort error-list - (lambda (a b) - (< (car a) (car b))))) - (let ((pop-up-windows t)) - (pop-to-buffer nil t)) - (switch-to-buffer - (get-buffer-create "*BibTeX validation errors*") t) - ;; don't use switch-to-buffer-other-window, since this - ;; doesn't allow the second parameter NORECORD - (setq default-directory dir) - (toggle-read-only -1) - (compilation-mode) - (delete-region (point-min) (point-max)) - (goto-char (point-min)) - (insert "BibTeX mode command `bibtex-validate'\n" - (if syntax-error - "Maybe undetected errors due to syntax errors. Correct and validate again." - "") - "\n") - (dolist (err error-list) - (insert bufnam ":" (number-to-string (elt err 0)) - ": " (elt err 1) "\n")) - (set-buffer-modified-p nil) - (toggle-read-only 1) + (let ((file (file-name-nondirectory (buffer-file-name))) + (dir default-directory) + (err-buf "*BibTeX validation errors*")) + (setq error-list (sort error-list 'car-less-than-car)) + (with-current-buffer (get-buffer-create err-buf) + (setq default-directory dir) + (unless (eq major-mode 'compilation-mode) (compilation-mode)) + (toggle-read-only -1) + (delete-region (point-min) (point-max)) + (insert "BibTeX mode command `bibtex-validate'\n" + (if syntax-error + "Maybe undetected errors due to syntax errors. Correct and validate again.\n" + "\n")) + (dolist (err error-list) + (insert (format "%s:%d: %s\n" file (car err) (cdr err)))) + (set-buffer-modified-p nil) + (toggle-read-only 1) + (goto-line 3)) ; first error message + (display-buffer err-buf) + ;; return nil + nil) + (message "%s is syntactically correct" + (if mark-active "Region" "Buffer")) + t))) + +(defun bibtex-validate-globally (&optional strings) + "Check for duplicate keys in `bibtex-files'. +With prefix arg STRINGS, check for duplicate strings, too. +Return t if test was successful, nil otherwise." + (interactive "P") + (let ((buffer-list (bibtex-files-expand t)) + buffer-key-list current-buf current-keys error-list) + ;; Check for duplicate keys within BibTeX buffer + (dolist (buffer buffer-list) + (save-excursion + (set-buffer buffer) + (let (entry-type key key-list) (goto-char (point-min)) - (other-window -1) + (while (re-search-forward bibtex-entry-head nil t) + (setq entry-type (bibtex-type-in-head) + key (bibtex-key-in-head)) + (if (or (and strings (bibtex-string= entry-type "string")) + (assoc-string entry-type bibtex-entry-field-alist t)) + (if (member key key-list) + (push (format "%s:%d: Duplicate key `%s'\n" + (buffer-file-name) + (bibtex-current-line) key) + error-list) + (push key key-list)))) + (push (cons buffer key-list) buffer-key-list)))) + + ;; Check for duplicate keys among BibTeX buffers + (while (setq current-buf (pop buffer-list)) + (setq current-keys (cdr (assq current-buf buffer-key-list))) + (with-current-buffer current-buf + (dolist (buffer buffer-list) + (dolist (key (cdr (assq buffer buffer-key-list))) + (when (assoc-string key current-keys) + (bibtex-find-entry key) + (push (format "%s:%d: Duplicat key `%s' in %s\n" + (buffer-file-name) (bibtex-current-line) key + (abbreviate-file-name (buffer-file-name buffer))) + error-list)))))) + + ;; Process error list + (if error-list + (let ((err-buf "*BibTeX validation errors*")) + (with-current-buffer (get-buffer-create err-buf) + (unless (eq major-mode 'compilation-mode) (compilation-mode)) + (toggle-read-only -1) + (delete-region (point-min) (point-max)) + (insert "BibTeX mode command `bibtex-validate-globally'\n\n") + (dolist (err (sort error-list 'string-lessp)) (insert err)) + (set-buffer-modified-p nil) + (toggle-read-only 1) + (goto-line 3)) ; first error message + (display-buffer err-buf) ;; return nil nil) - (if (bibtex-mark-active) - (message "Region is syntactically correct") - (message "Buffer is syntactically correct")) + (message "No duplicate keys.") t))) (defun bibtex-next-field (arg) @@ -3378,10 +3612,9 @@ Returns t if test was successful, nil otherwise." (defun bibtex-find-text (arg &optional as-if-interactive no-error) "Go to end of text of current field; with ARG, go to beginning." - (interactive "P") + (interactive "P\np") (bibtex-inside-field) - (let ((bounds (bibtex-enclosing-field (or (interactive-p) - as-if-interactive)))) + (let ((bounds (bibtex-enclosing-field as-if-interactive))) (if bounds (progn (if arg (progn (goto-char (bibtex-start-of-text-in-field bounds)) @@ -3404,7 +3637,7 @@ Returns t if test was successful, nil otherwise." (match-end 0)))) (t (unless no-error - (error "Not on BibTeX field"))))))) + (error "Not on BibTeX field"))))))) (defun bibtex-remove-OPT-or-ALT () "Remove the string starting optional/alternative fields. @@ -3470,6 +3703,7 @@ but do not actually kill it." (setq bibtex-last-kill-command 'field)) (defun bibtex-copy-field-as-kill () + "Copy the field at point to the kill ring." (interactive) (bibtex-kill-field t)) @@ -3492,9 +3726,9 @@ With prefix arg COPY-ONLY the current entry to (setcdr (nthcdr (1- bibtex-entry-kill-ring-max) bibtex-entry-kill-ring) nil)) - (setq bibtex-entry-kill-ring-yank-pointer bibtex-entry-kill-ring) - (unless copy-only - (delete-region beg end)))) + (setq bibtex-entry-kill-ring-yank-pointer bibtex-entry-kill-ring) + (unless copy-only + (delete-region beg end)))) (setq bibtex-last-kill-command 'entry)) (defun bibtex-copy-entry-as-kill () @@ -3584,7 +3818,7 @@ At end of the cleaning process, the functions in ;; (bibtex-format-preamble) (error "No clean up of @Preamble entries")) ((bibtex-string= entry-type "string")) - ;; (bibtex-format-string) + ;; (bibtex-format-string) (t (bibtex-format-entry))) ;; set key (when (or new-key (not key)) @@ -3597,7 +3831,7 @@ At end of the cleaning process, the functions in (delete-region (match-beginning bibtex-key-in-head) (match-end bibtex-key-in-head))) (insert key)) - ;; sorting + (unless called-by-reformat (let* ((start (bibtex-beginning-of-entry)) (end (progn (bibtex-end-of-entry) @@ -3606,9 +3840,12 @@ At end of the cleaning process, the functions in (goto-char (match-beginning 0))) (point))) (entry (buffer-substring start end)) - (index (progn (goto-char start) - (bibtex-entry-index))) + ;; include the crossref key in index + (index (let ((bibtex-maintain-sorted-entries 'crossref)) + (goto-char start) + (bibtex-entry-index))) error) + ;; sorting (if (and bibtex-maintain-sorted-entries (not (and bibtex-sort-ignore-string-entries (bibtex-string= entry-type "string")))) @@ -3623,17 +3860,37 @@ At end of the cleaning process, the functions in (setq error (or (/= (point) start) (bibtex-find-entry key end)))) (if error - (error "New inserted entry yields duplicate key")))) - ;; final clean up - (unless called-by-reformat - (save-excursion - (save-restriction - (bibtex-narrow-to-entry) - ;; Only update the list of keys if it has been built already. - (cond ((bibtex-string= entry-type "string") - (if (listp bibtex-strings) (bibtex-parse-strings t))) - ((listp bibtex-reference-keys) (bibtex-parse-keys t))) - (run-hooks 'bibtex-clean-entry-hook)))))) + (error "New inserted entry yields duplicate key")) + (dolist (buffer (bibtex-files-expand)) + (with-current-buffer buffer + (if (cdr (assoc-string key bibtex-reference-keys)) + (error "Duplicate key in %s" (buffer-file-name))))) + + ;; Only update the list of keys if it has been built already. + (cond ((bibtex-string= entry-type "string") + (if (and (listp bibtex-strings) + (not (assoc key bibtex-strings))) + (push (list key) bibtex-strings))) + ;; We have a normal entry. + ((listp bibtex-reference-keys) + (cond ((not (assoc key bibtex-reference-keys)) + (push (cons key t) bibtex-reference-keys)) + ((not (cdr (assoc key bibtex-reference-keys))) + ;; Turn a crossref key into a header key + (setq bibtex-reference-keys + (cons (cons key t) + (delete (list key) bibtex-reference-keys))))) + ;; Handle crossref key. + (if (and (nth 1 index) + (not (assoc (nth 1 index) bibtex-reference-keys))) + (push (list (nth 1 index)) bibtex-reference-keys))))) + + ;; final clean up + (if bibtex-clean-entry-hook + (save-excursion + (save-restriction + (bibtex-narrow-to-entry) + (run-hooks 'bibtex-clean-entry-hook))))))) (defun bibtex-fill-field-bounds (bounds justify &optional move) "Fill BibTeX field delimited by BOUNDS. @@ -3705,13 +3962,24 @@ If `bibtex-align-at-equal-sign' is non-nil, align equal signs, too." "Realign BibTeX entries such that they are separated by one blank line." (goto-char (point-min)) (let ((case-fold-search t)) + ;; No blank lines prior to the first valid entry if there no + ;; non-white characters in front of it. (when (looking-at bibtex-valid-entry-whitespace-re) (replace-match "\\1")) + ;; Valid entries are separated by one blank line. (while (re-search-forward bibtex-valid-entry-whitespace-re nil t) - (replace-match "\n\n\\1")))) + (replace-match "\n\n\\1")) + ;; One blank line past the last valid entry if it is followed by + ;; non-white characters, no blank line otherwise. + (beginning-of-line) + (when (re-search-forward bibtex-valid-entry-re nil t) + (bibtex-end-of-entry) + (bibtex-delete-whitespace) + (open-line (if (eobp) 1 2))))) (defun bibtex-reformat (&optional read-options) "Reformat all BibTeX entries in buffer or region. +Without prefix argument, reformatting is based on `bibtex-entry-format'. With prefix argument, read options for reformatting from minibuffer. With \\[universal-argument] \\[universal-argument] prefix argument, reuse previous answers (if any) again. If mark is active reformat entries in region, if not in whole buffer." @@ -3722,55 +3990,54 @@ If mark is active reformat entries in region, if not in whole buffer." (or bibtex-reformat-previous-options bibtex-reformat-previous-reference-keys))) (bibtex-entry-format - (if read-options - (if use-previous-options - bibtex-reformat-previous-options - (setq bibtex-reformat-previous-options - (mapcar (lambda (option) - (if (y-or-n-p (car option)) (cdr option))) - `(("Realign entries (recommended)? " . 'realign) - ("Remove empty optional and alternative fields? " . 'opts-or-alts) - ("Remove delimiters around pure numerical fields? " . 'numerical-fields) - (,(concat (if bibtex-comma-after-last-field "Insert" "Remove") - " comma at end of entry? ") . 'last-comma) - ("Replace double page dashes by single ones? " . 'page-dashes) - ("Force delimiters? " . 'delimiters) - ("Unify case of entry types and field names? " . 'unify-case))))) - '(realign))) + (cond (read-options + (if use-previous-options + bibtex-reformat-previous-options + (setq bibtex-reformat-previous-options + (mapcar (lambda (option) + (if (y-or-n-p (car option)) (cdr option))) + `(("Realign entries (recommended)? " . 'realign) + ("Remove empty optional and alternative fields? " . 'opts-or-alts) + ("Remove delimiters around pure numerical fields? " . 'numerical-fields) + (,(concat (if bibtex-comma-after-last-field "Insert" "Remove") + " comma at end of entry? ") . 'last-comma) + ("Replace double page dashes by single ones? " . 'page-dashes) + ("Inherit booktitle? " . 'inherit-booktitle) + ("Force delimiters? " . 'delimiters) + ("Unify case of entry types and field names? " . 'unify-case)))))) + ;; Do not include required-fields because `bibtex-reformat' + ;; cannot handle the error messages of `bibtex-format-entry'. + ;; Use `bibtex-validate' to check for required fields. + ((eq t bibtex-entry-format) + '(realign opts-or-alts numerical-fields delimiters + last-comma page-dashes unify-case inherit-booktitle)) + (t + (remove 'required-fields (push 'realign bibtex-entry-format))))) (reformat-reference-keys (if read-options (if use-previous-options bibtex-reformat-previous-reference-keys (setq bibtex-reformat-previous-reference-keys (y-or-n-p "Generate new reference keys automatically? "))))) - (start-point (if (bibtex-mark-active) - (region-beginning) - (point-min))) - (end-point (if (bibtex-mark-active) - (region-end) - (point-max))) (bibtex-sort-ignore-string-entries t) bibtex-autokey-edit-before-use) (save-restriction - (narrow-to-region start-point end-point) + (narrow-to-region (if mark-active (region-beginning) (point-min)) + (if mark-active (region-end) (point-max))) (if (memq 'realign bibtex-entry-format) - (bibtex-realign)) - (goto-char start-point) + (bibtex-realign)) (bibtex-progress-message "Formatting" 1) (bibtex-map-entries (lambda (key beg end) (bibtex-progress-message) (bibtex-clean-entry reformat-reference-keys t))) - (when (memq 'realign bibtex-entry-format) - (bibtex-delete-whitespace) - (open-line (if (eobp) 1 2))) (bibtex-progress-message 'done)) - (when (and reformat-reference-keys - bibtex-maintain-sorted-entries) - (bibtex-progress-message "Sorting" 1) - (bibtex-sort-buffer) + (when reformat-reference-keys (kill-local-variable 'bibtex-reference-keys) - (bibtex-progress-message 'done)) + (when bibtex-maintain-sorted-entries + (bibtex-progress-message "Sorting" 1) + (bibtex-sort-buffer) + (bibtex-progress-message 'done))) (goto-char pnt))) (defun bibtex-convert-alien (&optional read-options) @@ -3837,21 +4104,23 @@ signaled if point is outside key or BibTeX field." ;; key completion (setq choose-completion-string-functions (lambda (choice buffer mini-p base-size) - (bibtex-choose-completion-string choice buffer mini-p base-size) + (let ((choose-completion-string-functions nil)) + (choose-completion-string choice buffer base-size)) (bibtex-complete-key-cleanup choice) ;; return t (required by choose-completion-string-functions) t)) - (bibtex-complete-key-cleanup (bibtex-complete-internal + (bibtex-complete-key-cleanup (bibtex-complete-internal bibtex-reference-keys))) (compl ;; string completion (setq choose-completion-string-functions `(lambda (choice buffer mini-p base-size) - (bibtex-choose-completion-string choice buffer mini-p base-size) - (bibtex-complete-string-cleanup choice ',compl) - ;; return t (required by choose-completion-string-functions) - t)) + (let ((choose-completion-string-functions nil)) + (choose-completion-string choice buffer base-size)) + (bibtex-complete-string-cleanup choice ',compl) + ;; return t (required by choose-completion-string-functions) + t)) (bibtex-complete-string-cleanup (bibtex-complete-internal compl) compl)) @@ -3960,80 +4229,56 @@ signaled if point is outside key or BibTeX field." "\n") (goto-char endpos))) -(defun bibtex-url (&optional event) - "Browse a URL for the BibTeX entry at position PNT. +(defun bibtex-url (&optional pos) + "Browse a URL for the BibTeX entry at point. +Optional POS is the location of the BibTeX entry. The URL is generated using the schemes defined in `bibtex-generate-url-list' \(see there\). Then the URL is passed to `browse-url'." - (interactive (list last-input-event)) + (interactive) (save-excursion - (if event (posn-set-point (event-end event))) + (if pos (goto-char pos)) (bibtex-beginning-of-entry) (let ((fields-alist (bibtex-parse-entry)) + ;; Always ignore case, (case-fold-search t) (lst bibtex-generate-url-list) + (delim-regexp "\\`[{\"]\\(.*\\)[}\"]\\'") field url scheme) - (while (setq scheme (car lst)) + (while (setq scheme (pop lst)) (when (and (setq field (cdr (assoc-string (caar scheme) fields-alist t))) - (progn - (if (string-match "\\`[{\"]\\(.*\\)[}\"]\\'" field) - (setq field (match-string 1 field))) - (string-match (cdar scheme) field))) - (setq lst nil) + ;; Always remove field delimiters + (progn (if (string-match delim-regexp field) + (setq field (match-string 1 field))) + (string-match (cdar scheme) field))) + (setq lst nil) (if (null (cdr scheme)) (setq url (match-string 0 field))) (dolist (step (cdr scheme)) - (cond ((stringp step) - (setq url (concat url step))) - ((setq field (assoc-string (car step) fields-alist t)) - ;; always remove field delimiters - (let* ((text (if (string-match "\\`[{\"]\\(.*\\)[}\"]\\'" - (cdr field)) - (match-string 1 (cdr field)) - (cdr field))) - (str (if (string-match (nth 1 step) text) - (cond - ((functionp (nth 2 step)) - (funcall (nth 2 step) text)) - ((numberp (nth 2 step)) - (match-string (nth 2 step) text)) - (t - (replace-match (nth 2 step) nil nil text))) - ;; If the scheme is set up correctly, - ;; we should never reach this point - (error "Match failed: %s" text)))) - (setq url (concat url str)))) - ;; If the scheme is set up correctly, - ;; we should never reach this point - (t (error "Step failed: %s" step)))) - (message "%s" url) - (browse-url url)) - (setq lst (cdr lst))) - (unless url (message "No URL known."))))) - -(defun bibtex-font-lock-url (bound) - "Font-lock for URLs." - (let ((case-fold-search t) - (bounds (bibtex-enclosing-field t)) - (pnt (point)) - found field) - ;; We use start-of-field as syntax-begin - (goto-char (if bounds (bibtex-start-of-field bounds) pnt)) - (while (and (not found) - (prog1 (re-search-forward bibtex-font-lock-url-regexp bound t) - (setq field (match-string-no-properties 1))) - (setq bounds (bibtex-parse-field-text)) - (>= bound (car bounds)) - (>= (car bounds) pnt)) - (let ((lst bibtex-generate-url-list) url) - (goto-char (car bounds)) - (while (and (not found) - (setq url (caar lst))) - (when (bibtex-string= field (car url)) - (setq found (re-search-forward (cdr url) (cdr bounds) t))) - (setq lst (cdr lst)))) - (goto-char (cdr bounds))) - found)) + (cond ((stringp step) + (setq url (concat url step))) + ((setq field (cdr (assoc-string (car step) fields-alist t))) + ;; Always remove field delimiters + (if (string-match delim-regexp field) + (setq field (match-string 1 field))) + (if (string-match (nth 1 step) field) + (setq field (cond + ((functionp (nth 2 step)) + (funcall (nth 2 step) field)) + ((numberp (nth 2 step)) + (match-string (nth 2 step) field)) + (t + (replace-match (nth 2 step) nil nil field)))) + ;; If the scheme is set up correctly, + ;; we should never reach this point + (error "Match failed: %s" field)) + (setq url (concat url field))) + ;; If the scheme is set up correctly, + ;; we should never reach this point + (t (error "Step failed: %s" step)))) + (message "%s" url) + (browse-url url))) + (unless url (message "No URL known."))))) ;; Make BibTeX a Feature diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 8e5b94114a3..54c9d6ad7db 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -1,7 +1,7 @@ ;;; texinfo.el --- major mode for editing Texinfo files -;; Copyright (C) 1985,88,89,90,91,92,93,96,97,2000,01,03,04 -;; Free Software Foundation, Inc. +;; Copyright (C) 1985, 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, +;; 2000, 2001, 2003, 2004 Free Software Foundation, Inc. ;; Author: Robert J. Chassell ;; Date: [See date below for texinfo-version] diff --git a/lisp/thumbs.el b/lisp/thumbs.el index 13970e59ee8..b6a68df33c4 100644 --- a/lisp/thumbs.el +++ b/lisp/thumbs.el @@ -30,8 +30,8 @@ ;;; Commentary: ;; This package create two new mode: thumbs-mode and -;; thumbs-view-image-mode. It is used for images browsing and viewing -;; from within emacs. Minimal image manipulation functions are also +;; thumbs-view-image-mode. It is used for images browsing and viewing +;; from within Emacs. Minimal image manipulation functions are also ;; available via external programs. ;; ;; The 'convert' program from 'ImageMagick' @@ -62,6 +62,7 @@ (defgroup thumbs nil "Thumbnails previewer." + :version "21.4" :group 'multimedia) (defcustom thumbs-thumbsdir @@ -416,7 +417,7 @@ and SAME-WINDOW to show thumbs in the same window." (defalias 'thumbs 'thumbs-show-all-from-dir) (defun thumbs-find-image (img &optional num otherwin) - (funcall + (funcall (if otherwin 'switch-to-buffer-other-window 'switch-to-buffer) (concat "*Image: " (file-name-nondirectory img) " - " (number-to-string (or num 0)) "*")) diff --git a/lisp/toolbar/diropen.pbm b/lisp/toolbar/diropen.pbm Binary files differnew file mode 100644 index 00000000000..0f1996db78c --- /dev/null +++ b/lisp/toolbar/diropen.pbm diff --git a/lisp/toolbar/diropen.xpm b/lisp/toolbar/diropen.xpm new file mode 100644 index 00000000000..bdc0b19d7dd --- /dev/null +++ b/lisp/toolbar/diropen.xpm @@ -0,0 +1,215 @@ +/* XPM */ +static char * diropen_xpm[] = { +"24 24 188 2", +" c None", +". c #000000", +"+ c #010100", +"@ c #B5B8A5", +"# c #E4E7D2", +"$ c #878A76", +"% c #33342B", +"& c #0B0B0B", +"* c #E2E5CF", +"= c #CFD4AF", +"- c #CED3AE", +"; c #B2B696", +"> c #2D2D25", +", c #23241D", +"' c #9D9F90", +") c #C6CAA6", +"! c #C4C9A5", +"~ c #C6CBA7", +"{ c #C7CCA8", +"] c #C9CEA9", +"^ c #555847", +"/ c #1A1B15", +"( c #20201A", +"_ c #D4D6C2", +": c #BEC2A0", +"< c #B3B896", +"[ c #B0B595", +"} c #B3B797", +"| c #B6BB99", +"1 c #BBC09E", +"2 c #BCC19F", +"3 c #81856C", +"4 c #3E3F32", +"5 c #010101", +"6 c #DADDC8", +"7 c #AFB494", +"8 c #AAAF8F", +"9 c #A3A789", +"0 c #A6AA8B", +"a c #A9AD8E", +"b c #A7AB8D", +"c c #A4A88A", +"d c #A1A588", +"e c #AAAD96", +"f c #B3B5A5", +"g c #B8BBAA", +"h c #BABCAB", +"i c #40413B", +"j c #CACDBB", +"k c #BABDA8", +"l c #0C0C09", +"m c #DDDFCB", +"n c #969B7E", +"o c #9DA286", +"p c #95987C", +"q c #96997E", +"r c #9A9D81", +"s c #999D80", +"t c #9DA184", +"u c #A5AA8B", +"v c #A4A98A", +"w c #A3A889", +"x c #A2A588", +"y c #33352B", +"z c #9B9E83", +"A c #898D74", +"B c #D8DBC9", +"C c #84866E", +"D c #7D8169", +"E c #151612", +"F c #D7DAC9", +"G c #797D67", +"H c #3D3F34", +"I c #E0E0D9", +"J c #EBEDDD", +"K c #E8EBD9", +"L c #D8DBCA", +"M c #1A1A18", +"N c #0A0A09", +"O c #6E7067", +"P c #8D8F84", +"Q c #4A4B45", +"R c #2C2D29", +"S c #4B4C46", +"T c #E7EAD8", +"U c #E3E6D4", +"V c #DEE1D0", +"W c #DADCCC", +"X c #DADCD1", +"Y c #2B2C28", +"Z c #D7DAC6", +"` c #6F735E", +" . c #0D0D0D", +".. c #F4F4EC", +"+. c #606251", +"@. c #92957B", +"#. c #4A4C3E", +"$. c #434438", +"%. c #CACFAB", +"&. c #C6CBA8", +"*. c #C2C6A4", +"=. c #ABB091", +"-. c #23251E", +";. c #494B3D", +">. c #DCDCD4", +",. c #EAECDD", +"'. c #CDD2AD", +"). c #20201B", +"!. c #1C1C17", +"~. c #A4A88B", +"{. c #414337", +"]. c #BABF9D", +"^. c #B5B999", +"/. c #81836C", +"(. c #070806", +"_. c #D5D8C4", +":. c #161616", +"<. c #F2F2EA", +"[. c #CACFAA", +"}. c #050504", +"|. c #3C3D32", +"1. c #C9CEAA", +"2. c #C8CDA9", +"3. c #BFC4A2", +"4. c #3E4035", +"5. c #BCC09F", +"6. c #B6BB9A", +"7. c #B0B494", +"8. c #9DA185", +"9. c #535445", +"0. c #B6B8A7", +"a. c #747470", +"b. c #ECECE2", +"c. c #C3C8A5", +"d. c #C2C7A4", +"e. c #393B30", +"f. c #BFC4A1", +"g. c #BDC2A0", +"h. c #C0C5A2", +"i. c #3A3B31", +"j. c #A9AD8F", +"k. c #A3A78A", +"l. c #80836D", +"m. c #020201", +"n. c #A6A998", +"o. c #B8BC9B", +"p. c #1B1C17", +"q. c #181814", +"r. c #AFB394", +"s. c #ACB091", +"t. c #878A72", +"u. c #9B9F83", +"v. c #9A9D82", +"w. c #8A8D75", +"x. c #4F5243", +"y. c #070705", +"z. c #9E9F91", +"A. c #E5E6DA", +"B. c #ADB192", +"C. c #A6AA8C", +"D. c #A5A98C", +"E. c #4B4D3F", +"F. c #70735F", +"G. c #9FA286", +"H. c #999D81", +"I. c #35362D", +"J. c #2D2E26", +"K. c #8A8D74", +"L. c #71735F", +"M. c #080908", +"N. c #E3E5D9", +"O. c #C0C3AF", +"P. c #94987C", +"Q. c #8F9379", +"R. c #8B8F75", +"S. c #8A8E74", +"T. c #888C73", +"U. c #7D816A", +"V. c #0E0F0C", +"W. c #3E4034", +"X. c #4E5042", +"Y. c #282922", +"Z. c #121310", +"`. c #24251F", +" + c #71745F", +".+ c #6A6D59", +"++ c #434538", +"@+ c #080907", +" ", +" ", +" ", +" . . . . . . . ", +" + @ # # # # # $ % ", +" & * = = = - - ; > ", +", ' * ) ! ~ { ] ] ^ / . . ", +"( _ : < [ } | 1 2 3 4 5 . . . . . . . ", +", 6 7 8 9 0 8 a b c d e f g h . i j k . ", +"l m n o p q r s q t u v w x 9 . y z A . ", +". B C D E . . . . . . . . . . . . . . . 5 5 ", +". F G H I J K K L M N O P Q R . S T U V W X Y ", +". Z ` ...= = = +.. @.= = = #.. $.%.&.*.1 =.-. ", +". Z ;.>.,.'.- - ).!.'.'.'.'.~.. {.&.*.].^./.(. ", +". _.:.<.%.[.%.[.}.|.1.{ 2.2.3.. 4.5.6.7.8.9.l ", +". 0.a.b.c.d.d.*.}.e.f.g.h.g.} . i.[ j.k.l.m. ", +". n.>.o.o.^.} } p.q.r.r.r.s.t.. % u.v.w.x.y. ", +". z.A.B.j.C.D.k.E.. F.G.u.H.I.. J.K.K.L.M. ", +". N.O.P.Q.R.S.T.U.V.}.W.X.Y.Z.. `. +.+++@+ ", +" . . . . . . . . . . . . . . . . . . }. ", +" ", +" ", +" ", +" "}; diff --git a/lisp/toolbar/tool-bar.el b/lisp/toolbar/tool-bar.el index bf1c229ccb9..f22d84cafaf 100644 --- a/lisp/toolbar/tool-bar.el +++ b/lisp/toolbar/tool-bar.el @@ -223,7 +223,8 @@ MAP must contain appropriate binding for `[menu-bar]' which holds a keymap." ;; might inadvertently click that button. ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit") (tool-bar-add-item-from-menu 'find-file "new") - (tool-bar-add-item-from-menu 'dired "open") + (tool-bar-add-item-from-menu 'find-file-existing "open") + (tool-bar-add-item-from-menu 'dired "diropen") (tool-bar-add-item-from-menu 'kill-this-buffer "close") (tool-bar-add-item-from-menu 'save-buffer "save" nil :visible '(or buffer-file-name diff --git a/lisp/type-break.el b/lisp/type-break.el index 253e1406f06..ec96ab09fe2 100644 --- a/lisp/type-break.el +++ b/lisp/type-break.el @@ -1005,8 +1005,8 @@ FRAC should be the inverse of the fractional value; for example, a value of (setcar type-break-keystroke-threshold lower) (setcdr type-break-keystroke-threshold upper) (if (interactive-p) - (message "min threshold: %d\tmax threshold: %d" lower upper) - type-break-keystroke-threshold))) + (message "min threshold: %d\tmax threshold: %d" lower upper)) + type-break-keystroke-threshold)) ;;; misc functions @@ -1103,37 +1103,12 @@ With optional non-nil ALL, force redisplay of all mode-lines." (defun type-break-run-at-time (time repeat function) (condition-case nil (or (require 'timer) (require 'itimer)) (error nil)) - (cond ((fboundp 'run-at-time) - (run-at-time time repeat function)) - ((fboundp 'start-timer) - (let ((name (if (symbolp function) - (symbol-name function) - "type-break"))) - (start-timer name function time repeat))) - ((fboundp 'start-itimer) - (let ((name (if (symbolp function) - (symbol-name function) - "type-break"))) - (start-itimer name function time repeat))))) + (run-at-time time repeat function)) (defvar timer-dont-exit) (defun type-break-cancel-function-timers (function) - (cond ((fboundp 'cancel-function-timers) - (let ((timer-dont-exit t)) - (cancel-function-timers function))) - ((fboundp 'delete-timer) - (let ((list timer-list)) - (while list - (and (eq (funcall 'timer-function (car list)) function) - (delete-timer (car list))) - (setq list (cdr list))))) - ((fboundp 'delete-itimer) - (with-no-warnings - (let ((list itimer-list)) - (while list - (and (eq (funcall 'itimer-function (car list)) function) - (delete-itimer (car list))) - (setq list (cdr list)))))))) + (let ((timer-dont-exit t)) + (cancel-function-timers function))) ;;; Demo wrappers diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 053984fcaeb..261635d51e2 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,15 @@ +2004-11-02 Masatake YAMATO <jet@gyve.org> + + * url-imap.el (url-imap-open-host): Don't use + `string-to-int'. The port returned by `url-port' + is expected to be an integer. + + * url-irc.el (url-irc): Ditto. + + * url-news.el (url-news-open-host): Ditto. + + * url-nfs.el (url-nfs-build-filename): Ditto. + 2004-10-20 John Paul Wallington <jpw@gnu.org> * url-gw.el (url-gateway-nslookup-host): diff --git a/lisp/url/url-imap.el b/lisp/url/url-imap.el index 79b53e5d012..7b8f9deb19d 100644 --- a/lisp/url/url-imap.el +++ b/lisp/url/url-imap.el @@ -47,8 +47,6 @@ (let ((imap-username user) (imap-password pass) (authenticator (if user 'login 'anonymous))) - (if (stringp port) - (setq port (string-to-int port))) (nnimap-open-server host `((nnimap-server-port ,port) (nnimap-stream 'network) diff --git a/lisp/url/url-irc.el b/lisp/url/url-irc.el index 8b54b6d9222..31254dee451 100644 --- a/lisp/url/url-irc.el +++ b/lisp/url/url-irc.el @@ -61,7 +61,7 @@ PASSWORD - What password to use" ;;;###autoload (defun url-irc (url) (let* ((host (url-host url)) - (port (string-to-int (url-port url))) + (port (url-port url)) (pass (url-password url)) (user (url-user url)) (chan (url-filename url))) diff --git a/lisp/url/url-news.el b/lisp/url/url-news.el index 432c81f5d44..9d7f64bb4a4 100644 --- a/lisp/url/url-news.el +++ b/lisp/url/url-news.el @@ -38,7 +38,7 @@ (defun url-news-open-host (host port user pass) (if (fboundp 'nnheader-init-server-buffer) (nnheader-init-server-buffer)) - (nntp-open-server host (list (string-to-int port))) + (nntp-open-server host (list port)) (if (and user pass) (progn (nntp-send-command "^.*\r?\n" "AUTHINFO USER" user) diff --git a/lisp/url/url-nfs.el b/lisp/url/url-nfs.el index 3b834bba75f..ff36c1bdae9 100644 --- a/lisp/url/url-nfs.el +++ b/lisp/url/url-nfs.el @@ -62,7 +62,7 @@ Each can be used any number of times.") (defun url-nfs-build-filename (url) (let* ((host (url-host url)) - (port (string-to-int (url-port url))) + (port (url-port url)) (pass (url-password url)) (user (url-user url)) (file (url-filename url))) diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index 0c1e6bc1745..45ff233eb86 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el @@ -5,7 +5,7 @@ ;; Author: FSF (see vc.el for full credits) ;; Maintainer: Andre Spiegel <spiegel@gnu.org> -;; $Id: vc-cvs.el,v 1.67 2004/01/20 17:41:18 uid65624 Exp $ +;; $Id$ ;; This file is part of GNU Emacs. @@ -89,12 +89,12 @@ and past information to determine the current status of a file. The value can also be a regular expression or list of regular expressions to match against the host name of a repository; then VC only stays local for hosts that match it. Alternatively, the value -can be a list of regular expressions where the first element is the -symbol `except'; then VC always stays local except for hosts matched +can be a list of regular expressions where the first element is the +symbol `except'; then VC always stays local except for hosts matched by these regular expressions." :type '(choice (const :tag "Always stay local" t) (const :tag "Don't stay local" nil) - (list :format "\nExamine hostname and %v" :tag "Examine hostname ..." + (list :format "\nExamine hostname and %v" :tag "Examine hostname ..." (set :format "%v" :inline t (const :format "%t" :tag "don't" except)) (regexp :format " stay local,\n%t: %v" :tag "if it matches") (repeat :format "%v%i\n" :inline t (regexp :tag "or")))) @@ -152,12 +152,6 @@ See also variable `vc-cvs-sticky-date-format-string'." ;;; Internal variables ;;; -(defvar vc-cvs-local-month-numbers - '(("Jan" . 1) ("Feb" . 2) ("Mar" . 3) ("Apr" . 4) - ("May" . 5) ("Jun" . 6) ("Jul" . 7) ("Aug" . 8) - ("Sep" . 9) ("Oct" . 10) ("Nov" . 11) ("Dec" . 12)) - "Local association list of month numbers.") - ;;; ;;; State-querying functions @@ -590,7 +584,11 @@ The changes are between FIRST-VERSION and SECOND-VERSION." (defun vc-cvs-annotate-command (file buffer &optional version) "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER. Optional arg VERSION is a version to annotate from." - (vc-cvs-command buffer 0 file "annotate" (if version (concat "-r" version)))) + (vc-cvs-command buffer 0 file "annotate" (if version (concat "-r" version))) + (with-current-buffer buffer + (goto-char (point-min)) + (re-search-forward "^[0-9]") + (delete-region (point-min) (1- (point))))) (defun vc-cvs-annotate-current-time () "Return the current time, based at midnight of the current day, and @@ -601,29 +599,36 @@ encoded as fractional days." (defun vc-cvs-annotate-time () "Return the time of the next annotation (as fraction of days) systime, or nil if there is none." - (let ((time-stamp - "^\\S-+\\s-+\\S-+\\s-+\\([0-9]+\\)-\\(\\sw+\\)-\\([0-9]+\\)): ")) - (if (looking-at time-stamp) - (progn - (let* ((day (string-to-number (match-string 1))) - (month (cdr (assoc (match-string 2) - vc-cvs-local-month-numbers))) - (year-tmp (string-to-number (match-string 3))) - ;; Years 0..68 are 2000..2068. - ;; Years 69..99 are 1969..1999. - (year (+ (cond ((> 69 year-tmp) 2000) - ((> 100 year-tmp) 1900) - (t 0)) - year-tmp))) - (goto-char (match-end 0)) ; Position at end makes for nicer overlay result - (vc-annotate-convert-time (encode-time 0 0 0 day month year)))) - ;; If we did not look directly at an annotation, there might be - ;; some further down. This is the case if we are positioned at - ;; the very top of the buffer, for instance. - (if (re-search-forward time-stamp nil t) - (progn - (beginning-of-line nil) - (vc-cvs-annotate-time)))))) + (let* ((bol (point)) + (cache (get-text-property bol 'vc-cvs-annotate-time)) + buffer-read-only) + (cond + (cache) + ((looking-at + "^\\S-+\\s-+\\S-+\\s-+\\([0-9]+\\)-\\(\\sw+\\)-\\([0-9]+\\)): ") + (let ((day (string-to-number (match-string 1))) + (month (cdr (assq (intern (match-string 2)) + '((Jan . 1) (Feb . 2) (Mar . 3) + (Apr . 4) (May . 5) (Jun . 6) + (Jul . 7) (Aug . 8) (Sep . 9) + (Oct . 10) (Nov . 11) (Dec . 12))))) + (year (let ((tmp (string-to-number (match-string 3)))) + ;; Years 0..68 are 2000..2068. + ;; Years 69..99 are 1969..1999. + (+ (cond ((> 69 tmp) 2000) + ((> 100 tmp) 1900) + (t 0)) + tmp)))) + (put-text-property + bol (1+ bol) 'vc-cvs-annotate-time + (setq cache (cons + ;; Position at end makes for nicer overlay result. + (match-end 0) + (vc-annotate-convert-time + (encode-time 0 0 0 day month year)))))))) + (when cache + (goto-char (car cache)) ; fontify from here to eol + (cdr cache)))) ; days (float) (defun vc-cvs-annotate-extract-revision-at-line () (save-excursion @@ -839,7 +844,7 @@ CVS/Entries should only be accessed through this function." (let ((coding-system-for-read (or file-name-coding-system default-file-name-coding-system))) (vc-insert-file (expand-file-name "CVS/Entries" dir)))) - + (defun vc-cvs-valid-symbolic-tag-name-p (tag) "Return non-nil if TAG is a valid symbolic tag name." ;; According to the CVS manual, a valid symbolic tag must start with @@ -929,7 +934,7 @@ is non-nil." "\\(.*\\)")) ;Sticky tag (vc-file-setprop file 'vc-workfile-version (match-string 1)) (vc-file-setprop file 'vc-cvs-sticky-tag - (vc-cvs-parse-sticky-tag (match-string 4) + (vc-cvs-parse-sticky-tag (match-string 4) (match-string 5))) ;; Compare checkout time and modification time. ;; This is intentionally different from the algorithm that CVS uses diff --git a/lisp/vc-mcvs.el b/lisp/vc-mcvs.el index d2ac776170f..ea577489239 100644 --- a/lisp/vc-mcvs.el +++ b/lisp/vc-mcvs.el @@ -26,9 +26,9 @@ ;;; Commentary: ;; The home page of the Meta-CVS version control system is at -;; +;; ;; http://users.footprints.net/~kaz/mcvs.html -;; +;; ;; This is derived from vc-cvs.el as follows: ;; - cp vc-cvs.el vc-mcvs.el ;; - Replace CVS/ with MCVS/CVS/ @@ -478,7 +478,11 @@ Optional arg VERSION is a version to annotate from." (vc-mcvs-command buffer (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) - file "annotate" (if version (concat "-r" version)))) + file "annotate" (if version (concat "-r" version))) + (with-current-buffer buffer + (goto-char (point-min)) + (re-search-forward "^[0-9]") + (delete-region (point-min) (1- (point))))) (defalias 'vc-mcvs-annotate-current-time 'vc-cvs-annotate-current-time) (defalias 'vc-mcvs-annotate-time 'vc-cvs-annotate-time) diff --git a/lisp/vc.el b/lisp/vc.el index 15d0258e85d..5aac27e31a4 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -2896,9 +2896,9 @@ if present. The current time is used as the offset." (defun vc-annotate-display-autoscale (&optional full) "Highlight the output of \\[vc-annotate] using an autoscaled color map. Autoscaling means that the map is scaled from the current time to the -oldest annotation in the buffer, or, with argument FULL non-nil, to +oldest annotation in the buffer, or, with prefix argument FULL, to cover the range from the oldest annotation to the newest." - (interactive) + (interactive "P") (let ((newest 0.0) (oldest 999999.) ;Any CVS users at the founding of Rome? (current (vc-annotate-convert-time (current-time))) @@ -2907,7 +2907,9 @@ cover the range from the oldest annotation to the newest." ;; Run through this file and find the oldest and newest dates annotated. (save-excursion (goto-char (point-min)) - (while (setq date (vc-call-backend vc-annotate-backend 'annotate-time)) + (while (setq date (prog1 (vc-call-backend vc-annotate-backend + 'annotate-time) + (forward-line 1))) (if (> date newest) (setq newest date)) (if (< date oldest) diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el index 0f9237f3409..f2b081fdcc5 100644 --- a/lisp/x-dnd.el +++ b/lisp/x-dnd.el @@ -47,6 +47,7 @@ The function shall return nil to reject the drop or a cons with two values, the wanted action as car and the wanted type as cdr. The wanted action can be copy, move, link, ask or private. The default value for this variable is `x-dnd-default-test-function'." + :version "21.4" :type 'symbol :group 'x) @@ -69,6 +70,7 @@ Insertion of text is not handeled by these functions, see `x-dnd-types-alist' for that. The function shall return the action done (move, copy, link or private) if some action was made, or nil if the URL is ignored." + :version "21.4" :type 'alist :group 'x) @@ -96,11 +98,13 @@ this drop (copy, move, link, private or ask) as determined by a previous call to `x-dnd-test-function'. DATA is the drop data. The function shall return the action used (copy, move, link or private) if drop is successful, nil if not." + :version "21.4" :type 'alist :group 'x) (defcustom x-dnd-open-file-other-window nil "If non-nil, always use find-file-other-window to open dropped files." + :version "21.4" :type 'boolean :group 'x) @@ -120,6 +124,7 @@ is successful, nil if not." ) "The types accepted by default for dropped data. The types are chosen in the order they appear in the list." + :version "21.4" :type '(repeat string) :group 'x ) |