diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 126 | ||||
-rw-r--r-- | lisp/ChangeLog.8 | 4 | ||||
-rw-r--r-- | lisp/calendar/timeclock.el | 65 | ||||
-rw-r--r-- | lisp/dabbrev.el | 12 | ||||
-rw-r--r-- | lisp/diff-mode.el | 18 | ||||
-rw-r--r-- | lisp/diff.el | 10 | ||||
-rw-r--r-- | lisp/emacs-lisp/advice.el | 22 | ||||
-rw-r--r-- | lisp/emacs-lisp/sregex.el | 4 | ||||
-rw-r--r-- | lisp/longlines.el | 43 | ||||
-rw-r--r-- | lisp/man.el | 4 | ||||
-rw-r--r-- | lisp/newcomment.el | 115 | ||||
-rw-r--r-- | lisp/progmodes/compile.el | 19 | ||||
-rw-r--r-- | lisp/progmodes/python.el | 19 | ||||
-rw-r--r-- | lisp/t-mouse.el | 48 | ||||
-rw-r--r-- | lisp/textmodes/sgml-mode.el | 88 | ||||
-rw-r--r-- | lisp/textmodes/tex-mode.el | 2 | ||||
-rw-r--r-- | lisp/vc-hooks.el | 9 | ||||
-rw-r--r-- | lisp/vc.el | 10 | ||||
-rw-r--r-- | lisp/version.el | 2 | ||||
-rw-r--r-- | lisp/xt-mouse.el | 4 |
20 files changed, 407 insertions, 217 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 74870e8fe7e..3eb974292d9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,8 +1,15 @@ -2007-05-10 Edward O'Connor <hober0@gmail.com> (tiny change) +2007-05-12 Chong Yidong <cyd@stupidchicken.com> - * progmodes/python.el (python-font-lock-keywords) - (python-open-block-statement-p, python-mode): Add support for the new - "with" keyword. + * longlines.el (longlines-mode): Make longlines-auto-wrap + buffer-local. Add hooks unconditionally. + (longlines-auto-wrap): Toggle wrapping. + (longlines-after-change-function) + (longlines-post-command-function): Check longlines-auto-wrap. + +2007-05-12 Nick Roberts <nickrob@snap.net.nz> + + * xt-mouse.el (xterm-mouse-debug-buffer): New variable. + (xterm-mouse-translate): Use it. 2007-05-10 Richard Stallman <rms@gnu.org> @@ -23,11 +30,60 @@ (set-auto-mode): Handle file-start-mode-alist. A little cleanup of structure. -2007-05-10 Davis Herring <herring@lanl.gov> +2007-05-10 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> - * calendar/timeclock.el (timeclock-in): Fix non-interactive - workday specifications. - (timeclock-log): Don't kill the log buffer if it already existed. + * man.el (Man-next-section): Don't consider the last line of the page + as being part of any section. + +2007-05-10 Stefan Monnier <monnier@iro.umontreal.ca> + + * textmodes/sgml-mode.el (sgml-value): Fix handling of attributes which + can take any number of values. + +2007-05-09 Stefan Monnier <monnier@iro.umontreal.ca> + + * textmodes/tex-mode.el (tex-font-lock-keywords-2): Add citet and citep + to the list of citation commands. + +2007-05-09 Stefan Monnier <monnier@iro.umontreal.ca> + + * vc-hooks.el (vc-find-root): Stop searching when the user changes. + +2007-05-09 Edward O'Connor <hober0@gmail.com> (tiny change) + + * progmodes/python.el (python-font-lock-keywords) + (python-open-block-statement-p, python-mode): Add support for the new + "with" keyword. + +2007-05-08 Stefan Monnier <monnier@iro.umontreal.ca> + + * diff-mode.el (diff-apply-hunk, diff-test-hunk): Don't do by default + the exact opposite of diff-goto-source. + + * emacs-lisp/advice.el (ad-special-forms): Remove. + (ad-special-form-p): Use subr-arity. + + * newcomment.el (comment-search-forward): Make sure we search forward. + (comment-enter-backward): Try and distinguish the non-matching case at + EOB from the non-matching case with a missing comment-end-skip for + a 2-char comment ender. + (comment-choose-indent): New function extracted from comment-indent. + Improve the alignment algorithm. + (comment-indent): Use it. + + * textmodes/sgml-mode.el (sgml-lexical-context): Add handling of + XML style Processing Instructions. + (sgml-parse-tag-backward): Handle XML-style PIs. Also ensure progress. + (sgml-calculate-indent): Handle `pi' context. + + * vc.el: Ensure that update-changelog issues an error when used with + a backend that does not implement it. + (vc-update-changelog-rcs2log): Rename from vc-default-update-changelog. + Remove `backend' argument. Use expand-file-name. + (vc-cvs-update-changelog, vc-rcs-update-changelog): New aliases. + + * progmodes/python.el (python-end-of-block): Revert last change. + (python-end-of-statement): Make sure we move *forward*. 2007-05-08 Richard Stallman <rms@gnu.org> @@ -48,6 +104,29 @@ * emacs-lisp/eldoc.el (turn-on-eldoc-mode): Doc fix. +2007-05-05 Stefan Monnier <monnier@iro.umontreal.ca> + + * diff.el (diff): Use buffer-local vars diff-old-file and diff-new-file + rather than storing their value in the revert-buffer function. + +2007-05-04 Nick Roberts <nickrob@snap.net.nz> + + * t-mouse.el (t-mouse-mode): Do nothing on a graphical display + when disabling t-mouse-mode. + +2007-05-01 Davis Herring <herring@lanl.gov> + + * calendar/timeclock.el: Update version number. + (timeclock-modeline-display): Mention timeclock-use-display-time + in explanatory message. + (timeclock-in): Fix non-interactive workday specifications. + (timeclock-log): Don't kill the log buffer if it already existed. + Suppress warnings when finding the log. Don't check for a nil + project twice. Run hooks after killing the buffer (if applicable). + (timeclock-geometric-mean): Rename to `timeclock-mean' (it never + was geometric). All uses changed. + (timeclock-generate-report): Support prefix argument. + 2007-05-03 Ryan Yeske <rcyeske@gmail.com> * net/rcirc.el (rcirc-timeout-seconds): Increase to prevent unwanted @@ -57,11 +136,6 @@ * dired-x.el: Revert 2007-04-06 change. -2007-04-30 Nick Roberts <nickrob@snap.net.nz> - - * progmodes/gud.el (gud-menu-map): Pdb can't handle SIGINT so - don't put stop on toolbar. - 2007-04-29 Stephen Berman <Stephen.Berman@gmx.net> * find-dired.el (find-dired-filter): Propertize all text down to eob. @@ -79,6 +153,11 @@ * progmodes/sh-script.el (sh-mode): Recognize .profile as sh style. +2007-04-28 Nick Roberts <nickrob@snap.net.nz> + + * progmodes/gud.el (gud-menu-map): Pdb can't handle SIGINT so + don't put stop on toolbar. + 2007-04-28 Stefan Monnier <monnier@iro.umontreal.ca> * vc-hooks.el (vc-ignore-dir-regexp): Add /.../ for the DFS filesystem. @@ -88,8 +167,6 @@ * makefile.w32-in ($(lisp)/mh-e/mh-loaddefs.el): Use ./mh-e instead of $(lisp)/mh-e. - * textmodes/fill.el (fill-paragraph): Doc fix. - 2007-04-28 Glenn Morris <rgm@gnu.org> * image-dired.el (image-dired-cmd-create-thumbnail-options) @@ -101,10 +178,13 @@ * textmodes/flyspell.el (flyspell-auto-correct-previous-word): Use window-start and window-end. -2007-04-26 Glenn Morris <rgm@gnu.org> +2007-04-27 Andreas Schwab <schwab@suse.de> - * progmodes/python.el: Restore file pending consideration of legal - status. + * emacs-lisp/sregex.el (sregexq): Fix doc string quoting. + +2007-04-27 Eli Zaretskii <eliz@gnu.org> + + * textmodes/fill.el (fill-paragraph): Doc fix. 2007-04-26 Luc Teirlinck <teirllm@dms.auburn.edu> @@ -115,6 +195,8 @@ * button.el (button): Use underline if supported, else fall back to color. + * version.el (emacs-version): Increase to 22.1.50. + 2007-04-25 Richard Stallman <rms@gnu.org> * hi-lock.el (hi-lock-file-patterns-policy): Default to `ask'. @@ -135,10 +217,6 @@ * custom.el (defface): Doc fix. -2007-04-24 Chong Yidong <cyd@stupidchicken.com> - - * progmodes/python.el: Remove due to unclear legal issues. - 2007-04-24 J.D. Smith <jdsmith@as.arizona.edu> * progmodes/idlw-shell.el (idlwave-shell-clear-all-bp): @@ -13682,8 +13760,8 @@ 2006-01-29 Edward O'Connor <ted@oconnor.cx> - * emulation/viper.el (viper-major-mode-modifier-list): Add - insert-state and vi-state entries for erc-mode. + * emulation/viper.el (viper-major-mode-modifier-list): + Add insert-state and vi-state entries for erc-mode. (viper-go-away, viper-set-hooks): Add and remove viper-comint-mode-hook from erc-mode-hook as appropriate. diff --git a/lisp/ChangeLog.8 b/lisp/ChangeLog.8 index 4dfb876c086..21ccff71d6f 100644 --- a/lisp/ChangeLog.8 +++ b/lisp/ChangeLog.8 @@ -5354,12 +5354,12 @@ * international/mule.el (auto-coding-alist): Add .tgz. -1999-05-2 Eli Zaretskii <eliz@is.elta.co.il> +1999-05-02 Eli Zaretskii <eliz@is.elta.co.il> * international/codepage.el (cp-coding-system-for-codepage-1): Make the magnification parameter for the -dos encoder be 2. -1999-05-2 Andrew Innes <andrewi@gnu.org> +1999-05-02 Andrew Innes <andrewi@gnu.org> * term/w32-win.el (w32-drag-n-drop): Select file in window where it is dropped, rather than current window. diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index 4e6e4120404..edadd2ceaea 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el @@ -5,7 +5,7 @@ ;; Author: John Wiegley <johnw@gnu.org> ;; Created: 25 Mar 1999 -;; Version: 2.6 +;; Version: 2.6.1 ;; Keywords: calendar data ;; This file is part of GNU Emacs. @@ -304,8 +304,8 @@ display (non-nil means on)." ;; Update immediately so there is a visible change ;; on calling this function. (if display-time-mode (timeclock-update-modeline) - (message "Activate `display-time-mode' to see \ -timeclock information")) + (message "Activate `display-time-mode' or turn off \ +`timeclock-use-display-time' to see timeclock information")) (add-hook 'display-time-hook 'timeclock-update-modeline)) (setq timeclock-update-timer (run-at-time nil 60 'timeclock-update-modeline)))) @@ -589,6 +589,38 @@ relative only to the time worked today, and not to past time." (message "%s" string) string))) +(defun timeclock-make-hours-explicit (old-default) + "Specify all workday lengths in `timeclock-file'. +OLD-DEFAULT hours are set for every day that has no number indicated." + (interactive "P") + (if old-default (setq old-default (prefix-numeric-value old-default)) + (error "timelog-make-hours-explicit requires an explicit argument")) + (let ((extant-timelog (find-buffer-visiting timeclock-file)) + current-date) + (with-current-buffer (find-file-noselect timeclock-file t) + (unwind-protect + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (while (progn (skip-chars-forward "\n") (not (eobp))) + ;; This is just a variant of `timeclock-moment-regexp'. + (unless (looking-at + (concat "^\\([bhioO]\\) \\([0-9]+/[0-9]+/[0-9]+\\) " + "\\([0-9]+:[0-9]+:[0-9]+\\)")) + (error "Can't parse `%s'" timeclock-file)) + (let ((this-date (match-string 2))) + (unless (or (and current-date + (string= this-date current-date)) + (string= (match-string 1) "h")) + (insert (format "h %s %s %s\n" (match-string 2) + (match-string 3) old-default))) + (if (string-match "^[ih]" (match-string 1)) ; ignore logouts + (setq current-date this-date))) + (forward-line)) + (save-buffer))) + (unless extant-timelog (kill-buffer (current-buffer))))))) + ;;; Internal Functions: (defvar timeclock-project-list nil) @@ -653,7 +685,7 @@ that variable's documentation." If PROJECT is a string, it represents the project which the event is being logged for. Normally only \"in\" events specify a project." (let ((extant-timelog (find-buffer-visiting timeclock-file))) - (with-current-buffer (find-file-noselect timeclock-file) + (with-current-buffer (find-file-noselect timeclock-file t) (save-excursion (save-restriction (widen) @@ -663,8 +695,7 @@ being logged for. Normally only \"in\" events specify a project." (let ((now (current-time))) (insert code " " (format-time-string "%Y/%m/%d %H:%M:%S" now) - (or (and project - (stringp project) + (or (and (stringp project) (> (length project) 0) (concat " " project)) "") @@ -679,8 +710,8 @@ being logged for. Normally only \"in\" events specify a project." timeclock-last-period))) (setq timeclock-last-event (list code now project))))) (save-buffer) - (run-hooks 'timeclock-event-hook) - (unless extant-timelog (kill-buffer (current-buffer)))))) + (unless extant-timelog (kill-buffer (current-buffer))))) + (run-hooks 'timeclock-event-hook)) (defvar timeclock-moment-regexp (concat "\\([bhioO]\\)\\s-+" @@ -1152,8 +1183,8 @@ If optional argument TIME is non-nil, use that instead of the current time." (setcar (nthcdr 2 decoded) 0) (apply 'encode-time decoded))) -(defun timeclock-geometric-mean (l) - "Compute the geometric mean of the values in the list L." +(defun timeclock-mean (l) + "Compute the arithmetic mean of the values in the list L." (let ((total 0) (count 0)) (while l @@ -1168,7 +1199,7 @@ If optional argument TIME is non-nil, use that instead of the current time." "Generate a summary report based on the current timelog file. By default, the report is in plain text, but if the optional argument HTML-P is non-nil, HTML markup is added." - (interactive) + (interactive "P") (let ((log (timeclock-log-data)) (today (timeclock-day-base))) (if html-p (insert "<p>")) @@ -1300,14 +1331,10 @@ HTML-P is non-nil, HTML markup is added." ;; average statistics (let ((i 0) (l 5)) (while (< i l) - (aset time-in i (timeclock-geometric-mean - (cdr (aref time-in i)))) - (aset time-out i (timeclock-geometric-mean - (cdr (aref time-out i)))) - (aset breaks i (timeclock-geometric-mean - (cdr (aref breaks i)))) - (aset workday i (timeclock-geometric-mean - (cdr (aref workday i)))) + (aset time-in i (timeclock-mean (cdr (aref time-in i)))) + (aset time-out i (timeclock-mean (cdr (aref time-out i)))) + (aset breaks i (timeclock-mean (cdr (aref breaks i)))) + (aset workday i (timeclock-mean (cdr (aref workday i)))) (setq i (1+ i)))) ;; Output the HTML table (insert "<tr>\n") diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index ae16b52ee7d..1cfad105a95 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el @@ -128,7 +128,7 @@ Set this to nil if no characters should be skipped." (const :tag "off" nil)) :group 'dabbrev) -(defcustom dabbrev--eliminate-newlines t +(defcustom dabbrev-eliminate-newlines t "*Non-nil means dabbrev should not insert newlines. Instead it converts them to spaces." :type 'boolean @@ -913,10 +913,12 @@ to record whether we upcased the expansion, downcased it, or did neither." ((equal abbrev (downcase abbrev)) 'downcase))))) ;; Convert whitespace to single spaces. - (if dabbrev--eliminate-newlines - ;; Start searching at end of ABBREV so that any whitespace - ;; carried over from the existing text is not changed. - (let ((pos (length abbrev))) + (if dabbrev-eliminate-newlines + (let ((pos + (if (equal abbrev " ") 0 (length abbrev)))) + ;; If ABBREV is real, search after the end of it. + ;; If ABBREV is space and we are copying successive words, + ;; search starting at the front. (while (string-match "[\n \t]+" expansion pos) (setq pos (1+ (match-beginning 0))) (setq expansion (replace-match " " nil nil expansion))))) diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 3cd2fb37dbb..87fade841ca 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -72,7 +72,7 @@ :group 'diff-mode) (defcustom diff-jump-to-old-file nil - "*Non-nil means `diff-goto-source' jumps to the old file. + "Non-nil means `diff-goto-source' jumps to the old file. Else, it jumps to the new file." :type 'boolean :group 'diff-mode) @@ -1276,7 +1276,7 @@ Whitespace differences are ignored." (if (> (- (car forw) orig) (- orig (car back))) back forw) (or back forw)))) -(defsubst diff-xor (a b) (if a (not b) b)) +(defsubst diff-xor (a b) (if a (if (not b) a) b)) (defun diff-find-source-location (&optional other-file reverse) "Find out (BUF LINE-OFFSET POS SRC DST SWITCHED). @@ -1358,8 +1358,15 @@ the value of this variable when given an appropriate prefix argument). With a prefix argument, REVERSE the hunk." (interactive "P") (destructuring-bind (buf line-offset pos old new &optional switched) - ;; If REVERSE go to the new file, otherwise go to the old. - (diff-find-source-location (not reverse) reverse) + ;; Sometimes we'd like to have the following behavior: if REVERSE go + ;; to the new file, otherwise go to the old. But that means that by + ;; default we use the old file, which is the opposite of the default + ;; for diff-goto-source, and is thus confusing. Also when you don't + ;; know about it it's pretty surprising. + ;; TODO: make it possible to ask explicitly for this behavior. + ;; + ;; This is duplicated in diff-test-hunk. + (diff-find-source-location nil reverse) (cond ((null line-offset) (error "Can't find the text to patch")) @@ -1403,8 +1410,7 @@ With a prefix argument, REVERSE the hunk." With a prefix argument, try to REVERSE the hunk." (interactive "P") (destructuring-bind (buf line-offset pos src dst &optional switched) - ;; If REVERSE go to the new file, otherwise go to the old. - (diff-find-source-location (not reverse) reverse) + (diff-find-source-location nil reverse) (set-window-point (display-buffer buf) (+ (car pos) (cdr src))) (diff-hunk-status-msg line-offset (diff-xor reverse switched) t))) diff --git a/lisp/diff.el b/lisp/diff.el index 83de826bd03..7149ef0d150 100644 --- a/lisp/diff.el +++ b/lisp/diff.el @@ -124,9 +124,13 @@ With prefix arg, prompt for diff switches." (erase-buffer)) (buffer-enable-undo (current-buffer)) (diff-mode) + ;; Use below 2 vars for backward-compatibility. + (set (make-local-variable 'diff-old-file) old) + (set (make-local-variable 'diff-new-file) new) + (set (make-local-variable 'diff-extra-args) (list switches no-async)) (set (make-local-variable 'revert-buffer-function) - `(lambda (ignore-auto noconfirm) - (diff ',old ',new ',switches ',no-async))) + (lambda (ignore-auto noconfirm) + (apply 'diff diff-old-file diff-new-file diff-extra-args))) (set (make-local-variable 'diff-old-temp-file) old-alt) (set (make-local-variable 'diff-new-temp-file) new-alt) (setq default-directory thisdir) @@ -186,5 +190,5 @@ With prefix arg, prompt for diff switches." (provide 'diff) -;;; arch-tag: 7de2c29b-7ea5-4b85-9b9d-72dd860de2bd +;; arch-tag: 7de2c29b-7ea5-4b85-9b9d-72dd860de2bd ;;; diff.el ends here diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index fe4639cf01a..8023bc58a53 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el @@ -2467,23 +2467,11 @@ will clear the cache." "Take a macro function DEFINITION and make a lambda out of it." `(cdr ,definition)) -;; There is no way to determine whether some subr is a special form or not, -;; hence we need this list (which is probably out of date): -(defvar ad-special-forms - (let ((tem '(and catch cond condition-case defconst defmacro - defun defvar function if interactive let let* - or prog1 prog2 progn quote save-current-buffer - save-excursion save-restriction save-window-excursion - setq setq-default unwind-protect while - with-output-to-temp-buffer))) - ;; track-mouse could be void in some configurations. - (if (fboundp 'track-mouse) - (push 'track-mouse tem)) - (mapcar 'symbol-function tem))) - -(defmacro ad-special-form-p (definition) - ;;"non-nil if DEFINITION is a special form." - (list 'memq definition 'ad-special-forms)) +(defun ad-special-form-p (definition) + "Non-nil iff DEFINITION is a special form." + (if (and (symbolp definition) (fboundp definition)) + (setq definition (indirect-function definition))) + (and (subrp definition) (eq (cdr (subr-arity definition)) 'unevalled))) (defmacro ad-interactive-p (definition) ;;"non-nil if DEFINITION can be called interactively." diff --git a/lisp/emacs-lisp/sregex.el b/lisp/emacs-lisp/sregex.el index 8041aefc077..67824c40632 100644 --- a/lisp/emacs-lisp/sregex.el +++ b/lisp/emacs-lisp/sregex.el @@ -436,11 +436,11 @@ Here are the clauses allowed in an `sregex' or `sregexq' expression: or end of a word. - the symbol `bow' - Stands for \"\\\\\\=<\", matching the empty string at the beginning of a + Stands for \"\\\\=\\<\", matching the empty string at the beginning of a word. - the symbol `eow' - Stands for \"\\\\\\=>\", matching the empty string at the end of a word. + Stands for \"\\\\=\\>\", matching the empty string at the end of a word. - the symbol `wordchar' Stands for the regex \"\\\\w\", matching a word-constituent character diff --git a/lisp/longlines.el b/lisp/longlines.el index e8ab4fbdd88..f39d31e69f0 100644 --- a/lisp/longlines.el +++ b/lisp/longlines.el @@ -110,6 +110,7 @@ are indicated with a symbol." (add-hook 'change-major-mode-hook 'longlines-mode-off nil t) (add-hook 'before-revert-hook 'longlines-before-revert-hook nil t) (make-local-variable 'buffer-substring-filters) + (make-local-variable 'longlines-auto-wrap) (set (make-local-variable 'isearch-search-fun-function) 'longlines-search-function) (add-to-list 'buffer-substring-filters 'longlines-encode-string) @@ -149,12 +150,10 @@ are indicated with a symbol." (add-to-list 'message-indent-citation-function 'longlines-decode-region t))) + (add-hook 'after-change-functions 'longlines-after-change-function nil t) + (add-hook 'post-command-hook 'longlines-post-command-function nil t) (when longlines-auto-wrap - (auto-fill-mode 0) - (add-hook 'after-change-functions - 'longlines-after-change-function nil t) - (add-hook 'post-command-hook - 'longlines-post-command-function nil t))) + (auto-fill-mode 0))) ;; Turn off longlines mode (setq buffer-file-format (delete 'longlines buffer-file-format)) (if longlines-showing @@ -365,29 +364,27 @@ Hard newlines are left intact." ;; Auto wrap (defun longlines-auto-wrap (&optional arg) - "Turn on automatic line wrapping, and wrap the entire buffer. -With optional argument ARG, turn off line wrapping." + "Toggle automatic line wrapping. +With optional argument ARG, turn on line wrapping if and only if ARG is positive. +If automatic line wrapping is turned on, wrap the entire buffer." (interactive "P") - (remove-hook 'after-change-functions 'longlines-after-change-function t) - (remove-hook 'post-command-hook 'longlines-post-command-function t) - (if arg - (progn (setq longlines-auto-wrap nil) - (message "Auto wrap disabled.")) - (setq longlines-auto-wrap t) - (add-hook 'after-change-functions - 'longlines-after-change-function nil t) - (add-hook 'post-command-hook - 'longlines-post-command-function nil t) - (let ((mod (buffer-modified-p))) - (longlines-wrap-region (point-min) (point-max)) - (set-buffer-modified-p mod)) - (message "Auto wrap enabled."))) + (and (null arg) + (null longlines-auto-wrap) + (setq arg 1)) + (if (> (prefix-numeric-value arg) 0) + (let ((mod (buffer-modified-p))) + (setq longlines-auto-wrap t) + (longlines-wrap-region (point-min) (point-max)) + (set-buffer-modified-p mod) + (message "Auto wrap enabled.")) + (setq longlines-auto-wrap nil) + (message "Auto wrap disabled."))) (defun longlines-after-change-function (beg end len) "Update `longlines-wrap-beg' and `longlines-wrap-end'. This is called by `after-change-functions' to keep track of the region that has changed." - (unless undo-in-progress + (when (and longlines-auto-wrap (not undo-in-progress)) (setq longlines-wrap-beg (if longlines-wrap-beg (min longlines-wrap-beg beg) beg)) (setq longlines-wrap-end @@ -396,7 +393,7 @@ that has changed." (defun longlines-post-command-function () "Perform line wrapping on the parts of the buffer that have changed. This is called by `post-command-hook' after each command." - (when longlines-wrap-beg + (when (and longlines-auto-wrap longlines-wrap-beg) (if (or (eq this-command 'yank) (eq this-command 'yank-pop)) (longlines-decode-region (point) (mark t))) diff --git a/lisp/man.el b/lisp/man.el index 0484c032e34..e74f9734e51 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1296,7 +1296,9 @@ The following key bindings are currently in effect in the buffer: (forward-line 1)) (if (re-search-forward Man-heading-regexp (point-max) t n) (beginning-of-line) - (goto-char (point-max))))) + (goto-char (point-max)) + ;; The last line doesn't belong to any section. + (forward-line -1)))) (defun Man-previous-section (n) "Move point to Nth previous section (default 1)." diff --git a/lisp/newcomment.el b/lisp/newcomment.el index b0a166465fa..55f96d21464 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -97,10 +97,10 @@ Major modes should set this variable.") ;;;###autoload (defcustom comment-column 32 "Column to indent right-margin comments to. -Each mode establishes a different default value for this variable; you +Each mode may establish a different default value for this variable; you can set the value for a particular mode using that mode's hook. -Comments might be indented to a value smaller than this in order -not to go beyond `comment-fill-column'." +Comments might be indented to a different value in order not to go beyond +`comment-fill-column' or in order to align them with surrounding comments." :type 'integer :group 'comment) (make-variable-buffer-local 'comment-column) @@ -491,16 +491,24 @@ Point is assumed to be just at the end of a comment." (goto-char (point-min)) (re-search-forward (concat comment-end-skip "\\'") nil t)) (goto-char (match-beginning 0))) - ;; comment-end-skip not found. Maybe we're at EOB which implicitly - ;; closes the comment. - ((eobp) (skip-syntax-backward " ")) - (t - ;; else comment-end-skip was not found probably because it was not - ;; set right. Since \\s> should catch the single-char case, we'll - ;; blindly assume we're at the end of a two-char comment-end. + ;; comment-end-skip not found probably because it was not set + ;; right. Since \\s> should catch the single-char case, let's + ;; check that we're looking at a two-char comment ender. + ((not (or (<= (- (point-max) (line-beginning-position)) 1) + (zerop (logand (car (syntax-after (- (point) 1))) + ;; Here we take advantage of the fact that + ;; the syntax class " " is encoded to 0, + ;; so " 4" gives us just the 4 bit. + (car (string-to-syntax " 4")))) + (zerop (logand (car (syntax-after (- (point) 2))) + (car (string-to-syntax " 3")))))) (backward-char 2) (skip-chars-backward (string (char-after))) - (skip-syntax-backward " "))))) + (skip-syntax-backward " ")) + ;; No clue what's going on: maybe we're really not right after the + ;; end of a comment. Maybe we're at the "end" because of EOB rather + ;; than because of a marker. + (t (skip-syntax-backward " "))))) ;;;; ;;;; Commands @@ -516,6 +524,58 @@ Point is assumed to be just at the end of a comment." (and (> comment-add 0) (looking-at "\\s<\\(\\S<\\|\\'\\)"))) comment-column))) +(defun comment-choose-indent (&optional indent) + "Choose the indentation to use for a right-hand-side comment. +The criteria are (in this order): +- try to keep the comment's text within `comment-fill-column'. +- try to align with surrounding comments. +- prefer INDENT (or `comment-column' if nil). +Point is expected to be at the start of the comment." + (unless indent (setq indent comment-column)) + ;; Avoid moving comments past the fill-column. + (let ((max (+ (current-column) + (- (or comment-fill-column fill-column) + (save-excursion (end-of-line) (current-column))))) + (other nil) + (min (save-excursion (skip-chars-backward " \t") + (1+ (current-column))))) + ;; Fix up the range. + (if (< max min) (setq max min)) + ;; Don't move past the fill column. + (if (<= max indent) (setq indent max)) + ;; We can choose anywhere between min..max. + ;; Let's try to align to a comment on the previous line. + (save-excursion + (when (and (zerop (forward-line -1)) + (setq other (comment-search-forward + (line-end-position) t))) + (goto-char other) (setq other (current-column)))) + (if (and other (<= other max) (>= other min)) + ;; There is a comment and it's in the range: bingo! + other + ;; Can't align to a previous comment: let's try to align to comments + ;; on the following lines, then. These have not been re-indented yet, + ;; so we can't directly align ourselves with them. All we do is to try + ;; and choose an indentation point with which they will be able to + ;; align themselves. + (save-excursion + (while (and (zerop (forward-line 1)) + (setq other (comment-search-forward + (line-end-position) t))) + (goto-char other) + (let ((omax (+ (current-column) + (- (or comment-fill-column fill-column) + (save-excursion (end-of-line) (current-column))))) + (omin (save-excursion (skip-chars-backward " \t") + (1+ (current-column))))) + (if (and (>= omax min) (<= omin max)) + (progn (setq min (max omin min)) + (setq max (min omax max))) + ;; Can't align with this anyway, so exit the loop. + (goto-char (point-max)))))) + ;; Return the closest point to indent within min..max. + (max min (min max indent))))) + ;;;###autoload (defun comment-indent (&optional continue) "Indent this line's comment to `comment-column', or insert an empty comment. @@ -569,38 +629,9 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any." (if (not indent) ;; comment-indent-function refuses: delegate to line-indent. (indent-according-to-mode) - ;; If the comment is at the left of code, adjust the indentation. + ;; If the comment is at the right of code, adjust the indentation. (unless (save-excursion (skip-chars-backward " \t") (bolp)) - ;; Avoid moving comments past the fill-column. - (let ((max (+ (current-column) - (- (or comment-fill-column fill-column) - (save-excursion (end-of-line) (current-column)))))) - (if (<= max indent) - (setq indent max) ;Don't move past the fill column. - ;; We can choose anywhere between indent..max. - ;; Let's try to align to a comment on the previous line. - (let ((other nil) - (min (max indent - (save-excursion (skip-chars-backward " \t") - (1+ (current-column)))))) - (save-excursion - (when (and (zerop (forward-line -1)) - (setq other (comment-search-forward - (line-end-position) t))) - (goto-char other) (setq other (current-column)))) - (if (and other (<= other max) (>= other min)) - ;; There is a comment and it's in the range: bingo. - (setq indent other) - ;; Let's try to align to a comment on the next line, then. - (let ((other nil)) - (save-excursion - (when (and (zerop (forward-line 1)) - (setq other (comment-search-forward - (line-end-position) t))) - (goto-char other) (setq other (current-column)))) - (if (and other (<= other max) (> other min)) - ;; There is a comment and it's in the range: bingo. - (setq indent other)))))))) + (setq indent (comment-choose-indent indent))) ;; Update INDENT to leave at least one space ;; after other nonwhite text on the line. (save-excursion diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 23e4f176fee..1613fd8f976 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1860,7 +1860,24 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." (let* ((name (read-file-name (format "Find this %s in (default %s): " compilation-error filename) - spec-dir filename t nil)) + spec-dir filename t nil + ;; The predicate below is fine when called from + ;; minibuffer-complete-and-exit, but it's too + ;; restrictive otherwise, since it also prevents the + ;; user from completing "fo" to "foo/" when she + ;; wants to enter "foo/bar". + ;; + ;; Try to make sure the user can only select + ;; a valid answer. This predicate may be ignored, + ;; tho, so we still have to double-check afterwards. + ;; TODO: We should probably fix read-file-name so + ;; that it never ignores this predicate, even when + ;; using popup dialog boxes. + ;; (lambda (name) + ;; (if (file-directory-p name) + ;; (setq name (expand-file-name filename name))) + ;; (file-exists-p name)) + )) (origname name)) (cond ((not (file-exists-p name)) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index cc8c44a4676..d2e913f2315 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -883,10 +883,13 @@ On a comment line, go to end of line." nil) ((eq 'string (syntax-ppss-context s)) ;; Go to start of string and skip it. - (goto-char (nth 8 s)) - (condition-case () ; beware invalid syntax - (progn (forward-sexp) t) - (error (end-of-line)))) + (let ((pos (point))) + (goto-char (nth 8 s)) + (condition-case () ; beware invalid syntax + (progn (forward-sexp) t) + ;; If there's a mismatched string, make sure + ;; we still overall move *forward*. + (error (goto-char pos) (end-of-line))))) ((python-skip-out t s)))) (end-of-line)) (unless comment @@ -981,15 +984,11 @@ don't move and return nil. Otherwise return t." (_ (if (python-comment-line-p) (python-skip-comments/blanks t))) (ci (current-indentation)) - (open (python-open-block-statement-p)) - opoint) + (open (python-open-block-statement-p))) (if (and (zerop ci) (not open)) (not (goto-char point)) (catch 'done - (setq opoint (point)) - (while (and (zerop (python-next-statement)) - (not (= opoint (point)))) - (setq opoint (point)) + (while (zerop (python-next-statement)) (when (or (and open (<= (current-indentation) ci)) (< (current-indentation) ci)) (python-skip-comments/blanks t) diff --git a/lisp/t-mouse.el b/lisp/t-mouse.el index 15521decd90..ba774e68443 100644 --- a/lisp/t-mouse.el +++ b/lisp/t-mouse.el @@ -275,32 +275,32 @@ With prefix arg, turn t-mouse mode on iff arg is positive. Turn it on to use Emacs mouse commands, and off to use t-mouse commands." nil " Mouse" nil :global t - (if t-mouse-mode - ;; Turn it on - (unless window-system - ;; Starts getting a stream of mouse events from an asynchronous process. - ;; Only works if Emacs is running on a virtual terminal without a window system. + (unless window-system + (if t-mouse-mode + ;; Turn it on. Starts getting a stream of mouse events from an + ;; asynchronous process. Only works if Emacs is running on a virtual + ;; terminal without a window system. (progn - (setq mouse-position-function #'t-mouse-mouse-position-function) - (let ((tty (t-mouse-tty)) - (process-connection-type t)) - (if (not (stringp tty)) - (error "Cannot find a virtual terminal")) - (setq t-mouse-process - (start-process "t-mouse" nil - "mev" "-i" "-E" "-C" tty - (if t-mouse-swap-alt-keys - "-M-leftAlt" "-M-rightAlt") - "-e-move" - "-dall" "-d-hard" - "-f"))) - (setq t-mouse-filter-accumulator "") - (set-process-filter t-mouse-process 't-mouse-process-filter) - (set-process-query-on-exit-flag t-mouse-process nil))) + (setq mouse-position-function #'t-mouse-mouse-position-function) + (let ((tty (t-mouse-tty)) + (process-connection-type t)) + (if (not (stringp tty)) + (error "Cannot find a virtual terminal")) + (setq t-mouse-process + (start-process "t-mouse" nil + "mev" "-i" "-E" "-C" tty + (if t-mouse-swap-alt-keys + "-M-leftAlt" "-M-rightAlt") + "-e-move" + "-dall" "-d-hard" + "-f"))) + (setq t-mouse-filter-accumulator "") + (set-process-filter t-mouse-process 't-mouse-process-filter) + (set-process-query-on-exit-flag t-mouse-process nil)) ;; Turn it off - (setq mouse-position-function nil) - (delete-process t-mouse-process) - (setq t-mouse-process nil))) + (setq mouse-position-function nil) + (delete-process t-mouse-process) + (setq t-mouse-process nil)))) (provide 't-mouse) diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 5e599ea10e6..51ff5e48a34 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -45,12 +45,12 @@ :group 'languages) (defcustom sgml-basic-offset 2 - "*Specifies the basic indentation level for `sgml-indent-line'." + "Specifies the basic indentation level for `sgml-indent-line'." :type 'integer :group 'sgml) (defcustom sgml-transformation-function 'identity - "*Default value for `skeleton-transformation-function' in SGML mode." + "Default value for `skeleton-transformation-function' in SGML mode." :type 'function :group 'sgml) @@ -166,7 +166,7 @@ This takes effect when first loading the `sgml-mode' library.") "Syntax table used to parse SGML tags.") (defcustom sgml-name-8bit-mode nil - "*When non-nil, insert non-ASCII characters as named entities." + "When non-nil, insert non-ASCII characters as named entities." :type 'boolean :group 'sgml) @@ -225,7 +225,7 @@ Currently, only Latin-1 characters are supported.") ;; The -s option suppresses output. (defcustom sgml-validate-command "nsgmls -s" ; replaced old `sgmls' - "*The command to validate an SGML document. + "The command to validate an SGML document. The file name of current buffer file name will be appended to this, separated by a space." :type 'string @@ -238,7 +238,7 @@ separated by a space." ;; I doubt that null end tags are used much for large elements, ;; so use a small distance here. (defcustom sgml-slash-distance 1000 - "*If non-nil, is the maximum distance to search for matching `/'." + "If non-nil, is the maximum distance to search for matching `/'." :type '(choice (const nil) integer) :group 'sgml) @@ -318,7 +318,7 @@ When more these are fontified together with `sgml-font-lock-keywords'.") ("!doctype") ("!element") ("!entity")) - "*Alist of tag names for completing read and insertion rules. + "Alist of tag names for completing read and insertion rules. This alist is made up as ((\"tag\" . TAGRULE) @@ -348,15 +348,14 @@ an optional alist of possible values." ("!doctype" . "Document type (DTD) declaration") ("!element" . "Tag declaration") ("!entity" . "Entity (macro) declaration")) - "*Alist of tag name and short description." + "Alist of tag name and short description." :type '(repeat (cons (string :tag "Tag Name") (string :tag "Description"))) :group 'sgml) (defcustom sgml-xml-mode nil - "*When non-nil, tag insertion functions will be XML-compliant. -If this variable is customized, the custom value is used always. -Otherwise, it is set to be buffer-local when the file has + "When non-nil, tag insertion functions will be XML-compliant. +It is set to be buffer-local when the file has a DOCTYPE or an XML declaration." :type 'boolean :version "22.1" @@ -937,7 +936,7 @@ and move to the line in the SGML document that caused it." (defun sgml-lexical-context (&optional limit) "Return the lexical context at point as (TYPE . START). START is the location of the start of the lexical element. -TYPE is one of `string', `comment', `tag', `cdata', or `text'. +TYPE is one of `string', `comment', `tag', `cdata', `pi', or `text'. Optional argument LIMIT is the position to start parsing from. If nil, start from a preceding tag at indentation." @@ -964,12 +963,19 @@ If nil, start from a preceding tag at indentation." (let ((cdata-start (point))) (unless (search-forward "]]>" pos 'move) (list 0 nil nil 'cdata nil nil nil nil cdata-start)))) + ((and sgml-xml-mode (looking-at "<\\?")) + ;; Processing Instructions. + ;; In SGML, it's basically a normal tag of the form + ;; <?NAME ...> but in XML, it takes the form <? ... ?>. + (let ((pi-start (point))) + (unless (search-forward "?>" pos 'move) + (list 0 nil nil 'pi nil nil nil nil pi-start)))) (t ;; We've reached a tag. Parse it. ;; FIXME: Handle net-enabling start-tags (parse-partial-sexp (point) pos 0)))))) (cond - ((eq (nth 3 state) 'cdata) (cons 'cdata (nth 8 state))) + ((memq (nth 3 state) '(cdata pi)) (cons (nth 3 state) (nth 8 state))) ((nth 3 state) (cons 'string (nth 8 state))) ((nth 4 state) (cons 'comment (nth 8 state))) ((and state (> (nth 0 state) 0)) (cons 'tag (nth 1 state))) @@ -1003,8 +1009,10 @@ See `sgml-tag-alist' for info about attribute rules." (insert alist ?\") (delete-backward-char 2))) (insert "=\"") - (when alist - (insert (skeleton-read '(completing-read "Value: " alist)))) + (if (cdr alist) + (insert (skeleton-read '(completing-read "Value: " alist))) + (when (null alist) + (insert (skeleton-read '(read-string "Value: "))))) (insert ?\")))) (defun sgml-quote (start end &optional unquotep) @@ -1093,9 +1101,15 @@ Leave point at the beginning of the tag." (when (eq (char-after) ?<) ;; Oops!! Looks like we were not in a textual context after all!. ;; Let's try to recover. + ;; Remember the tag-start so we don't need to look for it later. + ;; This is not just an optimization but also makes sure we don't get + ;; stuck in infloops in cases where "looking back for <" would not go + ;; back far enough. + (setq tag-start (point)) (with-syntax-table sgml-tag-syntax-table (let ((pos (point))) (condition-case nil + ;; FIXME: This does not correctly skip over PI an CDATA tags. (forward-sexp) (scan-error ;; This < seems to be just a spurious one, let's ignore it. @@ -1110,33 +1124,41 @@ Leave point at the beginning of the tag." (cond ((sgml-looking-back-at "--") ; comment (setq tag-type 'comment - tag-start (search-backward "<!--" nil t))) + tag-start (or tag-start (search-backward "<!--" nil t)))) ((sgml-looking-back-at "]]") ; cdata (setq tag-type 'cdata - tag-start (re-search-backward "<!\\[[A-Z]+\\[" nil t))) + tag-start (or tag-start + (re-search-backward "<!\\[[A-Z]+\\[" nil t)))) + ((sgml-looking-back-at "?") ; XML processing-instruction + (setq tag-type 'pi + ;; IIUC: SGML processing instructions take the form <?foo ...> + ;; i.e. a "normal" tag, handled below. In XML this is changed + ;; to <?foo ... ?> where "..." can contain < and > and even <? + ;; but not ?>. This means that when parsing backward, there's + ;; no easy way to make sure that we find the real beginning of + ;; the PI. + tag-start (or tag-start (search-backward "<?" nil t)))) (t - (setq tag-start - (with-syntax-table sgml-tag-syntax-table - (goto-char tag-end) - (condition-case nil - (backward-sexp) - (scan-error - ;; This > isn't really the end of a tag. Skip it. - (goto-char (1- tag-end)) - (throw 'found (sgml-parse-tag-backward limit)))) - (point))) + (unless tag-start + (setq tag-start + (with-syntax-table sgml-tag-syntax-table + (goto-char tag-end) + (condition-case nil + (backward-sexp) + (scan-error + ;; This > isn't really the end of a tag. Skip it. + (goto-char (1- tag-end)) + (throw 'found (sgml-parse-tag-backward limit)))) + (point)))) (goto-char (1+ tag-start)) (case (char-after) - (?! ; declaration - (setq tag-type 'decl)) - (?? ; processing-instruction - (setq tag-type 'pi)) + (?! (setq tag-type 'decl)) ; declaration + (?? (setq tag-type 'pi)) ; processing-instruction + (?% (setq tag-type 'jsp)) ; JSP tags (?/ ; close-tag (forward-char 1) (setq tag-type 'close name (sgml-parse-tag-name))) - (?% ; JSP tags - (setq tag-type 'jsp)) (t ; open or empty tag (setq tag-type 'open name (sgml-parse-tag-name)) @@ -1331,6 +1353,8 @@ LCON is the lexical context, if any." ;; We don't know how to indent it. Let's be honest about it. (cdata nil) + ;; We don't know how to indent it. Let's be honest about it. + (pi nil) (tag (goto-char (1+ (cdr lcon))) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index b5ca77e5853..5757100468b 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -527,6 +527,8 @@ An alternative value is \" . \", if you use a font with a narrow period." (citations (regexp-opt '("label" "ref" "pageref" "vref" "eqref" "cite" "nocite" "index" "glossary" "bibitem" + ;; natbib's two variants of \cite: + "citep" "citet" ;; These are text, rather than citations. ;; "caption" "footnote" "footnotemark" "footnotetext" ) diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index d67a0262d88..1bde704790b 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el @@ -315,10 +315,17 @@ If WITNESS if not found, return nil, otherwise return the root." ;; Represent /home/luser/foo as ~/foo so that we don't try to look for ;; witnesses in /home or in /. (setq file (abbreviate-file-name file)) - (let ((root nil)) + (let ((root nil) + (user (nth 2 (file-attributes file)))) (while (not (or root (equal file (setq file (file-name-directory file))) (null file) + ;; As a heuristic, we stop looking up the hierarchy of + ;; directories as soon as we find a directory belonging + ;; to another user. This should save us from looking in + ;; things like /net and /afs. This assumes that all the + ;; files inside a project belong to the same user. + (not (equal user (file-attributes file))) (string-match vc-ignore-dir-regexp file))) (if (file-exists-p (expand-file-name witness file)) (setq root file) diff --git a/lisp/vc.el b/lisp/vc.el index 450bfb3c938..a65e698669e 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -2909,7 +2909,11 @@ log entries should be gathered." (vc-call-backend (vc-responsible-backend default-directory) 'update-changelog args)) -(defun vc-default-update-changelog (backend files) +(defalias 'vc-cvs-update-changelog 'vc-update-changelog-rcs2log) +(defalias 'vc-rcs-update-changelog 'vc-update-changelog-rcs2log) +;; FIXME: This should probably be moved to vc-rcs.el and replaced in +;; vc-cvs.el by code using cvs2cl. +(defun vc-update-changelog-rcs2log (files) "Default implementation of update-changelog. Uses `rcs2log' which only works for RCS and CVS." ;; FIXME: We (c|sh)ould add support for cvs2cl @@ -2950,9 +2954,7 @@ Uses `rcs2log' which only works for RCS and CVS." (mapcar (lambda (f) (file-relative-name - (if (file-name-absolute-p f) - f - (concat odefault f)))) + (expand-file-name f odefault))) files))) "done" (pop-to-buffer (get-buffer-create "*vc*")) diff --git a/lisp/version.el b/lisp/version.el index 91feeff5cea..0ed3927d0fc 100644 --- a/lisp/version.el +++ b/lisp/version.el @@ -27,7 +27,7 @@ ;;; Code: -(defconst emacs-version "22.0.99" "\ +(defconst emacs-version "22.1.50" "\ Version numbers of this version of Emacs.") (defconst emacs-major-version diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 8ae79903d51..3a7c8fd553a 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -43,6 +43,8 @@ ;;; Code: +(defvar xterm-mouse-debug-buffer nil) + (define-key function-key-map "\e[M" 'xterm-mouse-translate) (defvar xterm-mouse-last) @@ -95,6 +97,8 @@ (list (intern (format "drag-mouse-%d" (+ 1 xterm-mouse-last))) down-data click-data))))) + (if xterm-mouse-debug-buffer + (print unread-command-events xterm-mouse-debug-buffer)) (if (and (symbolp down-where) (consp down-where)) (vector (list down-where down-data) down) |