From cf4c92718e21b66b9e76d6e3f72fc3c25a973764 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 14 Jul 2004 00:03:11 +0000 Subject: [PATCH 01/46] *** empty log message *** --- etc/TODO | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/etc/TODO b/etc/TODO index 1a191df5b69..281674e230e 100644 --- a/etc/TODO +++ b/etc/TODO @@ -273,8 +273,14 @@ to the FSF. the definition of `file-attributes' and `directory-files-and-attributes' and from the calls. -** Re-design language environment handling so that Emacs can fit - better to a users locale (e.g. ja_JP.UTF-8). +** Make language-info-alist customizable. Currently a user can customize + only the variable `current-language-environment'. + +** Improve language environment handling so that Emacs can fit + better to a users locale. Currently Emacs uses utf-8 language + environment for all utf-8 locales, thus a user in ja_JP.UTF-8 locale + are also put in utf-8 lang. env. In such a case, it is + better to use Japanese lang. env. but prefer utf-8 coding system. ** Eliminate the current restriction on header printing by ps-print. Currently, a header can contain only single 1-byte charset in @@ -291,9 +297,10 @@ to the FSF. ** Enhance word boundary detection for such a script that doesn't use space at word boundary (e.g. Thai). -** Include a better Japanese input method in the distribution. - Currently, most Japanese users are using external packages - (e.g. tamago, anthy) or an input method via XIM. +** Implement interface programs with major Japanese conversion server + in lib-src so that they can be used from the input method + "japanese". Currently, most Japanese users are using external + packages (e.g. tamago, anthy) or an input method via XIM. * Internal changes From 3a052bd3eed1620576b1ecdc75210f3c783b224c Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Wed, 14 Jul 2004 03:14:19 +0000 Subject: [PATCH 02/46] Various changes in addition to: (Splitting Windows): Add `split-window-keep-point'. --- lispref/ChangeLog | 5 +++ lispref/windows.texi | 104 +++++++++++++++++++++++++++++-------------- 2 files changed, 76 insertions(+), 33 deletions(-) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index cdf120e7a41..4ad59d3fe9a 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,8 @@ +2004-07-13 Luc Teirlinck + + * windows.texi: Various changes in addition to: + (Splitting Windows): Add `split-window-keep-point'. + 2004-07-09 Richard M. Stallman * frames.texi (Input Focus): Minor fix. diff --git a/lispref/windows.texi b/lispref/windows.texi index 01d7d3bfb4b..92eb6cbc85d 100644 --- a/lispref/windows.texi +++ b/lispref/windows.texi @@ -158,7 +158,6 @@ This function splits @var{window} into two windows. The original window @var{window} remains the selected window, but occupies only part of its former screen area. The rest is occupied by a newly created window which is returned as the value of this function. -This function returns the newly created window. If @var{horizontal} is non-@code{nil}, then @var{window} splits into two side by side windows. The original window @var{window} keeps the @@ -272,12 +271,34 @@ This function splits the selected window into two windows, one above the other, leaving the upper of the two windows selected, with @var{size} lines. (If @var{size} is negative, then the lower of the two windows gets @minus{} @var{size} lines and the upper window gets the rest, but -the upper window is still the one selected.) +the upper window is still the one selected.) However, if +@code{split-window-keep-point} (see below) is @code{nil}, then either +window can be selected. + +In other respects, this function is similar to @code{split-window}. +In particular, the upper window is the original one and the return +value is the new, lower window. @end deffn +@defopt split-window-keep-point +If this variable is non-@code{nil} (the default), then +@code{split-window-vertically} behaves as described above. + +If it is @code{nil}, then @code{split-window-vertically} adjusts point +in each of the two windows to avoid scrolling. (This is useful on +slow terminals.) It selects whichever window contains the screen line +that point was previously on. + +This variable only affects the behavior of @code{split-window-vertically}. +It has no effect on the other functions described here. +@end defopt + @deffn Command split-window-horizontally &optional size This function splits the selected window into two windows -side-by-side, leaving the selected window with @var{size} columns. +side-by-side, leaving the selected window on the left with @var{size} +columns. If @var{size} is negative, the rightmost window gets +@minus{} @var{size} columns, but the leftmost window still remains +selected. This function is basically an interface to @code{split-window}. You could define a simplified version of the function like this: @@ -364,17 +385,19 @@ deleting the other windows in that frame. If @var{window} is omitted or The return value is @code{nil}. @end deffn -@deffn Command delete-windows-on buffer &optional frame -This function deletes all windows showing @var{buffer}. If there are -no windows showing @var{buffer}, it does nothing. +@deffn Command delete-windows-on buffer-or-name &optional frame +This function deletes all windows showing @var{buffer-or-name}. If +there are no windows showing @var{buffer-or-name}, it does nothing. +@var{buffer-or-name} must be a buffer or the name of an existing +buffer. @code{delete-windows-on} operates frame by frame. If a frame has several windows showing different buffers, then those showing -@var{buffer} are removed, and the others expand to fill the space. If -all windows in some frame are showing @var{buffer} (including the case -where there is only one window), then the frame reverts to having a -single window showing another buffer chosen with @code{other-buffer}. -@xref{The Buffer List}. +@var{buffer-or-name} are removed, and the others expand to fill the +space. If all windows in some frame are showing @var{buffer-or-name} +(including the case where there is only one window), then the frame +winds up with a single window showing another buffer chosen with +@code{other-buffer}. @xref{The Buffer List}. The argument @var{frame} controls which frames to operate on. This function does not use it in quite the same way as the other functions @@ -412,8 +435,9 @@ which the cursor appears and to which many commands apply. @defun select-window window &optional norecord This function makes @var{window} the selected window. The cursor then -appears in @var{window} (on redisplay). The buffer being displayed in -@var{window} is immediately designated the current buffer. +appears in @var{window} (on redisplay). Unless @var{window} was +already selected, @code{select-window} makes @var{window}'s buffer the +current buffer. Normally @var{window}'s selected buffer is moved to the front of the buffer list, but if @var{norecord} is non-@code{nil}, the buffer list @@ -431,14 +455,18 @@ The return value is @var{window}. @end defun @defmac save-selected-window forms@dots{} -This macro records the selected window of each frame, executes -@var{forms} in sequence, then restores the earlier selected windows. +This macro records the selected window, as well as the selected window +of each frame, executes @var{forms} in sequence, then restores the +earlier selected windows. It returns the value of the last form in +@var{forms}. This macro does not save or restore anything about the sizes, arrangement or contents of windows; therefore, if the @var{forms} change them, the change persists. If the previously selected window -of some frame is no longer live at the time of exit from this form, -that frame's selected window is left alone. +of some frame is no longer live at the time of exit from @var{forms}, +that frame's selected window is left alone. If the previously +selected window is no longer live, then whatever window is selected at +the end of @var{forms} remains selected. @end defmac @defmac with-selected-window window forms@dots{} @@ -446,7 +474,7 @@ This macro selects @var{window} (without changing the buffer list), executes @var{forms} in sequence, then restores the previously selected window (unless that window is no longer alive). It is similar to @code{save-selected-window} except that it explicitly selects -@var{window} and that it does not alter the buffer list sequence. +@var{window}, without altering the buffer list sequence. @end defmac @cindex finding windows @@ -556,7 +584,9 @@ are the possible values and their meanings: @table @asis @item @code{nil} Consider all the windows in @var{window}'s frame, plus the minibuffer -used by that frame even if it lies in some other frame. +used by that frame even if it lies in some other frame. If the +minibuffer counts (as determined by @var{minibuf}), then all windows on +all frames that share that minibuffer count too. @item @code{t} Consider all windows in all existing frames. @@ -658,9 +688,10 @@ when you need complete control. @defun set-window-buffer window buffer-or-name &optional keep-margins This function makes @var{window} display @var{buffer-or-name} as its -contents. It returns @code{nil}. This is the fundamental primitive -for changing which buffer is displayed in a window, and all ways -of doing that call this function. +contents. It returns @code{nil}. @var{buffer-or-name} must be a +buffer, or the name of an existing buffer. This is the fundamental +primitive for changing which buffer is displayed in a window, and all +ways of doing that call this function. @example @group @@ -770,7 +801,8 @@ the current buffer but does not display it in the selected window. If @var{buffer-or-name} does not identify an existing buffer, then a new buffer by that name is created. The major mode for the new buffer is set according to the variable @code{default-major-mode}. @xref{Auto -Major Mode}. +Major Mode}. If @var{buffer-or-name} is @code{nil}, +@code{switch-to-buffer} chooses a buffer using @code{other-buffer}. Normally the specified buffer is put at the front of the buffer list (both the selected frame's buffer list and the frame-independent buffer @@ -783,6 +815,9 @@ the binding of @kbd{C-x b}. It is also used frequently in programs. It returns the buffer that it switched to. @end deffn +The next two functions are similar to @code{switch-to-buffer}, except +for the described features. + @deffn Command switch-to-buffer-other-window buffer-or-name &optional norecord This function makes @var{buffer-or-name} the current buffer and displays it in a window not currently selected. It then selects that @@ -842,12 +877,12 @@ This function updates the buffer list just like @code{switch-to-buffer} unless @var{norecord} is non-@code{nil}. @end defun -@deffn Command replace-buffer-in-windows buffer -This function replaces @var{buffer} with some other buffer in all -windows displaying it. The other buffer used is chosen with +@deffn Command replace-buffer-in-windows buffer-or-name +This function replaces @var{buffer-or-name} with some other buffer in all +windows displaying it. It chooses the other buffer with @code{other-buffer}. In the usual applications of this function, you don't care which other buffer is used; you just want to make sure that -@var{buffer} is no longer displayed. +@var{buffer-or-name} is no longer displayed. This function returns @code{nil}. @end deffn @@ -864,7 +899,8 @@ functions and commands use this subroutine. Here we describe how to use This command makes @var{buffer-or-name} appear in some window, like @code{pop-to-buffer}, but it does not select that window and does not make the buffer current. The identity of the selected window is -unaltered by this function. +unaltered by this function. @var{buffer-or-name} must be a buffer, or +the name of an existing buffer. If @var{not-this-window} is non-@code{nil}, it means to display the specified buffer in a window other than the selected one, even if it is @@ -885,6 +921,7 @@ values of @var{frame}: @itemize @bullet @item If it is @code{nil}, consider windows on the selected frame. +(Actually, the last non-minibuffer frame.) @item If it is @code{t}, consider windows on all frames. @item @@ -1017,7 +1054,7 @@ create the frame. See above, under @code{special-display-buffer-names}. This function returns non-@code{nil} if displaying a buffer named @var{buffer-name} with @code{display-buffer} would create a special frame. The value is @code{t} if it would -use the default frame paramaters, or else the specified list +use the default frame parameters, or else the specified list of frame parameters. @end defun @@ -1030,11 +1067,12 @@ The default value of this variable is @code{special-display-popup-frame}. @end defvar -@defun special-display-popup-frame buffer &rest args +@defun special-display-popup-frame buffer &optional args This function makes @var{buffer} visible in a frame of its own. If @var{buffer} is already displayed in a window in some frame, it makes the frame visible and raises it, to use that window. Otherwise, it -creates a frame that will be dedicated to @var{buffer}. +creates a frame that will be dedicated to @var{buffer}. This +function returns the window it used. If @var{args} is an alist, it specifies frame parameters for the new frame. @@ -1080,9 +1118,9 @@ put it in the selected window. This variable is the most flexible way to customize the behavior of @code{display-buffer}. If it is non-@code{nil}, it should be a function that @code{display-buffer} calls to do the work. The function should -accept two arguments, the same two arguments that @code{display-buffer} +accept two arguments, the first two arguments that @code{display-buffer} received. It should choose or create a window, display the specified -buffer, and then return the window. +buffer in it, and then return the window. This hook takes precedence over all the other options and hooks described above. From eda20bd8c8221f7f90572aee6c386c6a863bf998 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 14 Jul 2004 07:44:37 +0000 Subject: [PATCH 03/46] Fix copyright notice. --- leim/Makefile.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/leim/Makefile.in b/leim/Makefile.in index daa5b550cf2..7f3c13dbe36 100644 --- a/leim/Makefile.in +++ b/leim/Makefile.in @@ -1,6 +1,11 @@ # Makefile for leim subdirectory in GNU Emacs. -# Copyright (C) 1997, 2004 Electrotechnical Laboratory, JAPAN. -# Licensed to the Free Software Foundation. +# Copyright (C) 1997,98,1999,2000,2001 Electrotechnical Laboratory, JAPAN. +# Licensed to the Free Software Foundation. +# Copyright (C) 1997,98,1999,2000,01,02,03,2004 +# Free Software Foundation, Inc. +# Copyright (C) 2001,02,03,2004 +# National Institute of Advanced Industrial Science and Technology (AIST) +# Registration Number H14PRO021 # This file is part of GNU Emacs. From d5c24489bda23bc04e39261f56c05837ecb89e12 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 14 Jul 2004 15:24:33 +0000 Subject: [PATCH 04/46] *** empty log message *** --- lisp/ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b860134af46..bba807ac21b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1475,6 +1475,14 @@ (timer-event-handler): Set triggered-p element non-nil while running the timer function. +2004-05-14 Stefan Monnier + + * descr-text.el (describe-char-unicode-data) + (describe-char-unicodedata-file): Re-enable the unicode code now that + the licensing issues have been cleared in the unicode-4 license. + (describe-text-properties-1): Remove unused `overlay' var. + (describe-char): Remove unused var `buffer'. + 2004-05-14 David Ponce * tree-widget.el: New file. From dddc748bec10c86dcb6f93e8f90dd318e93c13a0 Mon Sep 17 00:00:00 2001 From: Daniel Pfeiffer Date: Wed, 14 Jul 2004 21:06:39 +0000 Subject: [PATCH 05/46] (auto-revert-tail-mode, auto-revert-tail-mode-text, auto-revert-tail-pos): New vars. (auto-revert-mode): Turn off auto-revert-tail-mode, so we're not in both at the same time. (auto-revert-tail-mode): New command. (turn-on-auto-revert-tail-mode, auto-revert-tail-handler): New funs. (auto-revert-handler): Revert only either tail or whole file. --- lisp/autorevert.el | 140 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 115 insertions(+), 25 deletions(-) diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 7b786882cf6..596c7ff8997 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -62,8 +62,9 @@ ;; Usage: ;; -;; Go to the appropriate buffer and press: +;; Go to the appropriate buffer and press either of: ;; M-x auto-revert-mode RET +;; M-x auto-revert-tail-mode RET ;; ;; To activate Global Auto-Revert Mode, press: ;; M-x global-auto-revert-mode RET @@ -105,13 +106,18 @@ Global Auto-Revert Mode applies to all buffers." ;; Variables: -;; Autoload for the benefit of `make-mode-line-mouse-sensitive'. -;;;###autoload +;;; What's this?: ;; Autoload for the benefit of `make-mode-line-mouse-sensitive'. +;;; What's this?: ;;;###autoload (defvar auto-revert-mode nil "*Non-nil when Auto-Revert Mode is active. Never set this variable directly, use the command `auto-revert-mode' instead.") (put 'auto-revert-mode 'permanent-local t) +(defvar auto-revert-tail-mode nil + "*Non-nil when Auto-Revert Tail Mode is active. +Never set this variable directly, use the command `auto-revert-mode' instead.") +(put 'auto-revert-tail-mode 'permanent-local t) + (defvar auto-revert-timer nil "Timer used by Auto-Revert Mode.") @@ -153,6 +159,13 @@ When non-nil, a message is generated whenever a file is reverted." :group 'auto-revert :type 'string) +(defcustom auto-revert-tail-mode-text " Tail" + "String to display in the mode line when Auto-Revert Tail Mode is active. + +\(When the string is not empty, make sure that it has a leading space.)" + :group 'auto-revert + :type 'string) + (defcustom auto-revert-mode-hook nil "Functions to run when Auto-Revert Mode is activated." :tag "Auto Revert Mode Hook" ; To separate it from `global-...' @@ -190,7 +203,7 @@ For more information, see Info node `(emacs-xtra)Autorevert'." :type 'boolean :link '(info-link "(emacs-xtra)Autorevert")) -(defcustom global-auto-revert-ignore-modes '() +(defcustom global-auto-revert-ignore-modes () "List of major modes Global Auto-Revert Mode should not check." :group 'auto-revert :type '(repeat sexp)) @@ -230,7 +243,7 @@ This variable becomes buffer local when set in any fashion.") ;; Internal variables: -(defvar auto-revert-buffer-list '() +(defvar auto-revert-buffer-list () "List of buffers in Auto-Revert Mode. Note that only Auto-Revert Mode, never Global Auto-Revert Mode, adds @@ -239,9 +252,16 @@ buffers to this list. The timer function `auto-revert-buffers' is responsible for purging the list of old buffers.") -(defvar auto-revert-remaining-buffers '() +(defvar auto-revert-remaining-buffers () "Buffers not checked when user input stopped execution.") +(defvar auto-revert-tail-pos 0 + "Position of last known end of file.") + +(add-hook 'find-file-hook + (lambda () + (set (make-local-variable 'auto-revert-tail-pos) + (save-restriction (widen) (1- (point-max)))))) ;; Functions: @@ -251,7 +271,9 @@ the list of old buffers.") With arg, turn Auto Revert mode on if and only if arg is positive. This is a minor mode that affects only the current buffer. -Use `global-auto-revert-mode' to automatically revert all buffers." +Use `global-auto-revert-mode' to automatically revert all buffers. +Use `auto-revert-tail-mode' if you know that the file will only grow +without being changed in the part that is already in the buffer." nil auto-revert-mode-text nil (if auto-revert-mode (if (not (memq (current-buffer) auto-revert-buffer-list)) @@ -260,7 +282,8 @@ Use `global-auto-revert-mode' to automatically revert all buffers." (delq (current-buffer) auto-revert-buffer-list))) (auto-revert-set-timer) (when auto-revert-mode - (auto-revert-buffers))) + (auto-revert-buffers) + (setq auto-revert-tail-mode nil))) ;;;###autoload @@ -272,6 +295,52 @@ This function is designed to be added to hooks, for example: (auto-revert-mode 1)) +;;;###autoload +(define-minor-mode auto-revert-tail-mode + "Toggle reverting tail of buffer when file on disk grows. +With arg, turn Tail mode on iff arg is positive. + +When Tail mode is enabled, the tail of the file is constantly +followed, as with the shell command `tail -f'. This means that +whenever the file grows on disk (presumably because some +background process is appending to it from time to time), this is +reflected in the current buffer. + +You can edit the buffer and turn this mode off and on again as +you please. But make sure the background process has stopped +writing before you save the file! + +Use `auto-revert-mode' for changes other than appends!" + :group 'find-file :lighter auto-revert-tail-mode-text + (when auto-revert-tail-mode + (unless buffer-file-name + (auto-revert-tail-mode 0) + (error "This buffer is not visiting a file")) + (if (and (buffer-modified-p) + (not auto-revert-tail-pos) ; library was loaded only after finding file + (not (y-or-n-p "Buffer is modified, so tail offset may be wrong. Proceed? "))) + (auto-revert-tail-mode 0) + ;; else we might reappend our own end when we save + (add-hook 'before-save-hook (lambda () (auto-revert-tail-mode 0)) nil t) + (or (local-variable-p 'auto-revert-tail-pos) ; don't lose prior position + (set (make-variable-buffer-local 'auto-revert-tail-pos) + (save-restriction (widen) (1- (point-max))))) + ;; let auto-revert-mode set up the mechanism for us if it isn't already + (or auto-revert-mode + (let ((auto-revert-tail-mode t)) + (auto-revert-mode 1))) + (setq auto-revert-mode nil)))) + + +;;;###autoload +(defun turn-on-auto-revert-tail-mode () + "Turn on Auto-Revert Tail Mode. + +This function is designed to be added to hooks, for example: + (add-hook 'my-logfile-mode-hook 'turn-on-auto-revert-tail-mode)" + (auto-revert-tail-mode 1)) + + ;;;###autoload (define-minor-mode global-auto-revert-mode "Revert any buffer when file on disk changes. @@ -298,12 +367,12 @@ will use an up-to-date value of `auto-revert-interval'" (if (or global-auto-revert-mode auto-revert-buffer-list) (run-with-timer auto-revert-interval auto-revert-interval - 'auto-revert-buffers) - nil))) + 'auto-revert-buffers)))) (defun auto-revert-active-p () "Check if auto-revert is active (in current buffer or globally)." (or auto-revert-mode + auto-revert-tail-mode (and global-auto-revert-mode (not global-auto-revert-ignore-buffer) @@ -313,18 +382,20 @@ will use an up-to-date value of `auto-revert-interval'" (defun auto-revert-handler () "Revert current buffer, if appropriate. This is an internal function used by Auto-Revert Mode." - (unless (buffer-modified-p) - (let ((buffer (current-buffer)) revert eob eoblist) - (or (and buffer-file-name - (not (file-remote-p buffer-file-name)) - (file-readable-p buffer-file-name) - (not (verify-visited-file-modtime buffer)) - (setq revert t)) - (and (or auto-revert-mode global-auto-revert-non-file-buffers) - revert-buffer-function - (boundp 'buffer-stale-function) - (functionp buffer-stale-function) - (setq revert (funcall buffer-stale-function t)))) + (when (or auto-revert-tail-mode (not (buffer-modified-p))) + (let* ((buffer (current-buffer)) + (revert + (or (and buffer-file-name + (not (file-remote-p buffer-file-name)) + (file-readable-p buffer-file-name) + (not (verify-visited-file-modtime buffer))) + (and (or auto-revert-mode auto-revert-tail-mode + global-auto-revert-non-file-buffers) + revert-buffer-function + (boundp 'buffer-stale-function) + (functionp buffer-stale-function) + (funcall buffer-stale-function t)))) + eob eoblist) (when revert (when (and auto-revert-verbose (not (eq revert 'fast))) @@ -340,7 +411,9 @@ This is an internal function used by Auto-Revert Mode." (= (window-point window) (point-max)) (push window eoblist))) 'no-mini t)) - (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes) + (if auto-revert-tail-mode + (auto-revert-tail-handler) + (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes)) (when buffer-file-name (when eob (goto-char (point-max))) (dolist (window eoblist) @@ -350,6 +423,22 @@ This is an internal function used by Auto-Revert Mode." (when (or revert auto-revert-check-vc-info) (vc-find-file-hook))))) +(defun auto-revert-tail-handler () + (let ((size (nth 7 (file-attributes buffer-file-name))) + (modified (buffer-modified-p)) + buffer-read-only ; ignore + (file buffer-file-name) + buffer-file-name) ; ignore that file has changed + (when (> size auto-revert-tail-pos) + (save-restriction + (widen) + (save-excursion + (goto-char (point-max)) + (insert-file-contents file nil auto-revert-tail-pos size))) + (setq auto-revert-tail-pos size) + (set-buffer-modified-p modified))) + (set-visited-file-modtime)) + (defun auto-revert-buffers () "Revert buffers as specified by Auto-Revert and Global Auto-Revert Mode. @@ -376,8 +465,8 @@ the timer when no buffers need to be checked." (let ((bufs (if global-auto-revert-mode (buffer-list) auto-revert-buffer-list)) - (remaining '()) - (new '())) + (remaining ()) + (new ())) ;; Partition `bufs' into two halves depending on whether or not ;; the buffers are in `auto-revert-remaining-buffers'. The two ;; halves are then re-joined with the "remaining" buffers at the @@ -398,6 +487,7 @@ the timer when no buffers need to be checked." ;; Test if someone has turned off Auto-Revert Mode in a ;; non-standard way, for example by changing major mode. (if (and (not auto-revert-mode) + (not auto-revert-tail-mode) (memq buf auto-revert-buffer-list)) (setq auto-revert-buffer-list (delq buf auto-revert-buffer-list))) From c29a05c8f0f8a975f40f67de10795b4897de94c2 Mon Sep 17 00:00:00 2001 From: Daniel Pfeiffer Date: Wed, 14 Jul 2004 21:09:33 +0000 Subject: [PATCH 06/46] (mode-line-mode-menu): Fix alphabetical ordering and add auto-revert-tail-mode. --- lisp/ChangeLog | 13 +++++++++++++ lisp/bindings.el | 15 +++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bba807ac21b..c0ad8d83ce7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2004-07-14 Daniel Pfeiffer + + * autorevert.el (auto-revert-tail-mode) + (auto-revert-tail-mode-text, auto-revert-tail-pos): New vars. + (auto-revert-mode): Turn off auto-revert-tail-mode, so we're not + in both at the same time. + (auto-revert-tail-mode): New command. + (turn-on-auto-revert-tail-mode, auto-revert-tail-handler): New funs. + (auto-revert-handler): Revert only either tail or whole file. + + * bindings.el (mode-line-mode-menu): Fix alphabetical ordering and + add auto-revert-tail-mode. + 2004-07-12 Vinicius Jose Latorre * printing.el: Doc fix. Change name of some funs. diff --git a/lisp/bindings.el b/lisp/bindings.el index b3ea8e562ac..e13b2cab9a4 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -404,12 +404,12 @@ Menu of mode operations in the mode line.") (define-key mode-line-mode-menu [highlight-changes-mode] `(menu-item ,(purecopy "Highlight changes (Chg)") highlight-changes-mode :button (:toggle . highlight-changes-mode))) -(define-key mode-line-mode-menu [glasses-mode] - `(menu-item ,(purecopy "Glasses (o^o)") glasses-mode - :button (:toggle . (bound-and-true-p glasses-mode)))) (define-key mode-line-mode-menu [hide-ifdef-mode] `(menu-item ,(purecopy "Hide ifdef (Ifdef)") hide-ifdef-mode :button (:toggle . (bound-and-true-p hide-ifdef-mode)))) +(define-key mode-line-mode-menu [glasses-mode] + `(menu-item ,(purecopy "Glasses (o^o)") glasses-mode + :button (:toggle . (bound-and-true-p glasses-mode)))) (define-key mode-line-mode-menu [font-lock-mode] `(menu-item ,(purecopy "Font Lock") font-lock-mode :button (:toggle . font-lock-mode))) @@ -419,12 +419,15 @@ Menu of mode operations in the mode line.") (define-key mode-line-mode-menu [column-number-mode] `(menu-item ,(purecopy "Column number") column-number-mode :button (:toggle . column-number-mode))) -(define-key mode-line-mode-menu [auto-fill-mode] - `(menu-item ,(purecopy "Auto Fill (Fill)") auto-fill-mode - :button (:toggle . auto-fill-function))) +(define-key mode-line-mode-menu [auto-revert-tail-mode] + `(menu-item ,(purecopy "Auto revert tail (Tail)") auto-revert-tail-mode + :button (:toggle . auto-revert-tail-mode))) (define-key mode-line-mode-menu [auto-revert-mode] `(menu-item ,(purecopy "Auto revert (ARev)") auto-revert-mode :button (:toggle . auto-revert-mode))) +(define-key mode-line-mode-menu [auto-fill-mode] + `(menu-item ,(purecopy "Auto fill (Fill)") auto-fill-mode + :button (:toggle . auto-fill-function))) (define-key mode-line-mode-menu [abbrev-mode] `(menu-item ,(purecopy "Abbrev (Abbrev)") abbrev-mode :button (:toggle . abbrev-mode))) From 0f74bf4cde9db30a8bb263ea98b4f7304cd2c86f Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Wed, 14 Jul 2004 22:17:43 +0000 Subject: [PATCH 07/46] Tramp is now distributed with Emacs. --- etc/ChangeLog | 4 ++++ etc/MORE.STUFF | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 7546d17fd59..aa1550122d5 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2004-07-14 Luc Teirlinck + + * MORE.STUFF: Tramp is now distributed with Emacs. + 2004-07-12 Bill Wohler * NEWS, MH-E-NEWS: Upgraded to MH-E version 7.4.4. diff --git a/etc/MORE.STUFF b/etc/MORE.STUFF index ba514f2dbac..8cd1443d8c0 100644 --- a/etc/MORE.STUFF +++ b/etc/MORE.STUFF @@ -96,6 +96,9 @@ You might find bug-fixes or enhancements in these places. * Sregex: + * Tramp: Remote file access via rsh/ssh + + * Webjump: * Whitespace: @@ -215,9 +218,6 @@ Several are for Debian GNU/Linux in particular. Wnn6, SJ3 Ver.2 - * Tramp: Remote file access via rsh/ssh - - * VM (View Mail): Alternative mail reader. There is a VM newsgroup: From c426452f4ca948742cccd00c49cfaa3a3779b23d Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Wed, 14 Jul 2004 22:25:09 +0000 Subject: [PATCH 08/46] (grep): Doc fix. --- lisp/progmodes/grep.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index a871380d06f..5b678f26171 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -414,7 +414,7 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." (defun grep (command-args &optional highlight-regexp) "Run grep, with user-specified args, and collect output in a buffer. While grep runs asynchronously, you can use \\[next-error] (M-x next-error), -or \\\\[compile-goto-error] in the grep \ +or \\\\[compile-goto-error] in the grep \ output buffer, to go to the lines where grep found matches. From 366511da44322c6ee74c32948aaa8d3f5625cb01 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Wed, 14 Jul 2004 22:42:44 +0000 Subject: [PATCH 09/46] Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-455 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bash the dashes 2004-07-14 K,Ba(Broly L,Bu(Brentey * src/keyboard.c (echo_dash): Do nothing if there already is a dash at the end of the echo string. --- src/ChangeLog | 5 +++++ src/keyboard.c | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index b3a9386da86..e40abdc3daa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-07-14 K,Ba(Broly L,Bu(Brentey + + * keyboard.c (echo_dash): Do nothing if there already is a dash + at the end of the echo string. + 2004-07-12 Kim F. Storm * alloc.c (mark_object): Only look at Lisp_Misc_Save_Value diff --git a/src/keyboard.c b/src/keyboard.c index f016a1283e4..89706dc3dce 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -802,6 +802,21 @@ echo_dash () == SCHARS (current_kboard->echo_string)) return; + /* Do nothing if we have already put a dash at the end. */ + if (SCHARS (current_kboard->echo_string) > 1) + { + Lisp_Object last_char, prev_char, idx; + + idx = make_number (SCHARS (current_kboard->echo_string) - 2); + prev_char = Faref (current_kboard->echo_string, idx); + + idx = make_number (SCHARS (current_kboard->echo_string) - 1); + last_char = Faref (current_kboard->echo_string, idx); + + if (XINT (last_char) == '-' && XINT (prev_char) != ' ') + return; + } + /* Put a dash at the end of the buffer temporarily, but make it go away when the next character is added. */ current_kboard->echo_string = concat2 (current_kboard->echo_string, From e5fcddc8f856ed141b374a7b3787ef4cf2718a30 Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Wed, 14 Jul 2004 22:47:11 +0000 Subject: [PATCH 10/46] (Fvisited_file_modtime): Return a list of two integers, instead of a cons. --- src/fileio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index 6e4d5a81004..1615bca3781 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5628,13 +5628,17 @@ Next attempt to save will certainly not complain of a discrepancy. */) DEFUN ("visited-file-modtime", Fvisited_file_modtime, Svisited_file_modtime, 0, 0, 0, doc: /* Return the current buffer's recorded visited file modification time. -The value is a list of the form (HIGH . LOW), like the time values +The value is a list of the form (HIGH LOW), like the time values that `file-attributes' returns. If the current buffer has no recorded file modification time, this function returns 0. See Info node `(elisp)Modification Time' for more details. */) () { - return long_to_cons ((unsigned long) current_buffer->modtime); + Lisp_Object tcons; + tcons = long_to_cons ((unsigned long) current_buffer->modtime); + if (CONSP (tcons)) + return list2 (XCAR (tcons), XCDR (tcons)); + return tcons; } DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime, From ca02a7263d2e5f26ef975661638d0044b24fa9a3 Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Wed, 14 Jul 2004 22:59:08 +0000 Subject: [PATCH 11/46] (dired-directory-changed-p): `visited-file-modtime' now returns a list of two integers, instead of a cons. --- lisp/dired.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/dired.el b/lisp/dired.el index e5e23dfe2d6..43eec9408d4 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -620,8 +620,7 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh." (modtime (visited-file-modtime))) (or (eq modtime 0) (not (eq (car attributes) t)) - (and (= (car (nth 5 attributes)) (car modtime)) - (= (nth 1 (nth 5 attributes)) (cdr modtime))))))) + (equal (nth 5 attributes) modtime))))) (defun dired-buffer-stale-p (&optional noconfirm) "Return non-nil if current dired buffer needs updating. From 12cd6dfb8574eae2e92d73704b3101eb31f8468d Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Wed, 14 Jul 2004 23:04:14 +0000 Subject: [PATCH 12/46] (tramp-handle-verify-visited-file-modtime): `visited-file-modtime' now returns a list of two integers, instead of a cons. --- lisp/net/tramp.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 0414859c7eb..d9a8d14309a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2343,7 +2343,14 @@ If it doesn't exist, generate a new one." ;; (HIGH . LOW)? (let ((mt (visited-file-modtime))) (< (abs (tramp-time-diff - modtime (list (car mt) (cdr mt)))) 2))) + modtime + ;; For compatibility, deal with both the old + ;; (HIGH . LOW) and the new (HIGH LOW) + ;; return values of `visited-file-modtime'. + (if (atom (cdr mt)) + (list (car mt) (cdr mt)) + mt))) + 2))) (attr (save-excursion (tramp-send-command From ec9b5635fb83ae825ff15627043ff8fab16198b1 Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Wed, 14 Jul 2004 23:22:14 +0000 Subject: [PATCH 13/46] (calendar-time-from-absolute): Return a list of two integers, instead of a cons. --- lisp/calendar/cal-dst.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el index 68943b77b28..034e8e28523 100644 --- a/lisp/calendar/cal-dst.el +++ b/lisp/calendar/cal-dst.el @@ -70,14 +70,14 @@ absolute date ABS-DATE is the equivalent moment to X." (defun calendar-time-from-absolute (abs-date s) "Time of absolute date ABS-DATE, S seconds after midnight. -Returns the pair (HIGH . LOW) where HIGH and LOW are the high and low +Returns the list (HIGH LOW) where HIGH and LOW are the high and low 16 bits, respectively, of the number of seconds 1970-01-01 00:00:00 UTC, ignoring leap seconds, that is the equivalent moment to S seconds after midnight UTC on absolute date ABS-DATE." (let* ((a (- abs-date calendar-system-time-basis)) (u (+ (* 163 (mod a 512)) (floor s 128)))) ;; Overflow is a terrible thing! - (cons + (list ;; floor((60*60*24*a + s) / 2^16) (+ a (* 163 (floor a 512)) (floor u 512)) ;; (60*60*24*a + s) mod 2^16 From 386c8f42f7e23cf32baceca17a96533476a052aa Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Wed, 14 Jul 2004 23:35:30 +0000 Subject: [PATCH 14/46] *** empty log message *** --- lisp/ChangeLog | 13 +++++++++++++ src/ChangeLog | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c0ad8d83ce7..bc4e75be761 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2004-07-14 Luc Teirlinck + + * calendar/cal-dst.el (calendar-time-from-absolute): Return a list + of two integers, instead of a cons. + + * net/tramp.el (tramp-handle-verify-visited-file-modtime): + `visited-file-modtime' now returns a list of two integers, instead + of a cons. + + * dired.el (dired-directory-changed-p): Ditto. + + * progmodes/grep.el (grep): Doc fix. + 2004-07-14 Daniel Pfeiffer * autorevert.el (auto-revert-tail-mode) diff --git a/src/ChangeLog b/src/ChangeLog index e40abdc3daa..dbb10e305a5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-07-14 Luc Teirlinck + + * fileio.c (Fvisited_file_modtime): Return a list of two integers, + instead of a cons. + 2004-07-14 K,Ba(Broly L,Bu(Brentey * keyboard.c (echo_dash): Do nothing if there already is a dash From 5d1c69b12ec18af87117a6983eecdee3f1e9f586 Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Thu, 15 Jul 2004 00:09:09 +0000 Subject: [PATCH 15/46] (Modification Time): `visited-file-modtime' now returns a list of two integers, instead of a cons. --- lispref/buffers.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lispref/buffers.texi b/lispref/buffers.texi index 8391159c088..d39a0746fe1 100644 --- a/lispref/buffers.texi +++ b/lispref/buffers.texi @@ -625,9 +625,9 @@ file should not be done. @c Emacs 19 feature @defun visited-file-modtime This function returns the current buffer's recorded last file -modification time, as a list of the form @code{(@var{high} . -@var{low})}. (This is the same format that @code{file-attributes} -uses to return time values; see @ref{File Attributes}.) +modification time, as a list of the form @code{(@var{high} @var{low})}. +(This is the same format that @code{file-attributes} uses to return +time values; see @ref{File Attributes}.) The function returns zero if the buffer has no recorded last modification time, which can happen, for instance, if the record has From cbbfedb29d34e44c6c20c14761cb85ffe79e91c8 Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Thu, 15 Jul 2004 00:38:38 +0000 Subject: [PATCH 16/46] *** empty log message *** --- etc/NEWS | 6 +++++- lispref/ChangeLog | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index bc00a408a34..82778db7be8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2178,7 +2178,11 @@ configuration files. * Lisp Changes in Emacs 21.4 -** If a command sets transient-mark-mode to `only', that ++++ +** `visited-file-modtime' and `calendar-time-from-absolute' now return +a list of two integers, instead of a cons. + +** If a command sets transient-mark-mode to `only', that enables Transient Mark mode for the following command only. During that following command, the value of transient-mark-mode is `identity'. If it is still `identity' at the end of the command, diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 4ad59d3fe9a..65202b371ae 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,8 @@ +2004-07-14 Luc Teirlinck + + * buffers.texi (Modification Time): `visited-file-modtime' now + returns a list of two integers, instead of a cons. + 2004-07-13 Luc Teirlinck * windows.texi: Various changes in addition to: From 0f6af2545f26f1f0acb25abf72262fc113056ada Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Thu, 15 Jul 2004 03:01:08 +0000 Subject: [PATCH 17/46] (syms_of_search): staticpro `saved_last_thing_searched'. Apparently fixes an abort condition. --- src/ChangeLog | 5 +++++ src/search.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index dbb10e305a5..e8eb8caeda2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-07-15 David Kastrup + + * search.c (syms_of_search): staticpro + `saved_last_thing_searched'. Apparently fixes an abort condition. + 2004-07-14 Luc Teirlinck * fileio.c (Fvisited_file_modtime): Return a list of two integers, diff --git a/src/search.c b/src/search.c index 169baf05d55..0375f353dd2 100644 --- a/src/search.c +++ b/src/search.c @@ -2974,6 +2974,9 @@ syms_of_search () last_thing_searched = Qnil; staticpro (&last_thing_searched); + saved_last_thing_searched = Qnil; + staticpro (&saved_last_thing_searched); + defsubr (&Slooking_at); defsubr (&Sposix_looking_at); defsubr (&Sstring_match); From bb40cb8e6b2ca6c5e7a890c6bbcea5bf2dfb3e92 Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Thu, 15 Jul 2004 19:57:05 +0000 Subject: [PATCH 18/46] (Fx_file_dialog): Encode strings in system coding system before passing them to OS functions for display. --- src/w32fns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/w32fns.c b/src/w32fns.c index b12bd7be28b..d5ba6e9b078 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -7735,14 +7735,14 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) /* Create the dialog with PROMPT as title, using DIR as initial directory and using "*" as pattern. */ dir = Fexpand_file_name (dir, Qnil); - strncpy (init_dir, SDATA (dir), MAX_PATH); + strncpy (init_dir, SDATA (ENCODE_SYSTEM (dir)), MAX_PATH); init_dir[MAX_PATH] = '\0'; unixtodos_filename (init_dir); if (STRINGP (default_filename)) { char *file_name_only; - char *full_path_name = SDATA (default_filename); + char *full_path_name = SDATA (ENCODE_SYSTEM (default_filename)); unixtodos_filename (full_path_name); From 62eb6ca914174c2335db53666cd15681ca06cb0c Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Thu, 15 Jul 2004 20:14:09 +0000 Subject: [PATCH 19/46] *** empty log message *** --- src/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index e8eb8caeda2..7c720d73653 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-07-15 KOBAYASHI Yasuhiro (tiny change) + + * w32fns.c (Fx_file_dialog): Encode strings in system coding + system before passing them to OS functions for display. + 2004-07-15 David Kastrup * search.c (syms_of_search): staticpro From a416e7ef563a0a40050b61615dcdb8ae43be641c Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 16 Jul 2004 10:42:00 +0000 Subject: [PATCH 20/46] (inhibit-mark-movement): New defvar. (beginning-of-buffer, end-of-buffer): Do not push mark if inhibit-mark-movement is non-nil or C-u prefix is given. --- lisp/simple.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 4e7628fe66e..9d61a390575 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -562,9 +562,13 @@ If BACKWARD-ONLY is non-nil, only delete spaces before point." (skip-chars-forward " \t") (constrain-to-field nil orig-pos t))))) +(defvar inhibit-mark-movement nil + "If non-nil, \\[beginning-of-buffer] and \\[end-of-buffer] does not set the mark.") + (defun beginning-of-buffer (&optional arg) "Move point to the beginning of the buffer; leave mark at previous position. -With arg N, put point N/10 of the way from the beginning. +With \\[universal-argument] prefix, do not set mark at previous position. +With numeric arg N, put point N/10 of the way from the beginning. If the buffer is narrowed, this command uses the beginning and size of the accessible part of the buffer. @@ -572,9 +576,10 @@ of the accessible part of the buffer. Don't use this command in Lisp programs! \(goto-char (point-min)) is faster and avoids clobbering the mark." (interactive "P") - (push-mark) + (unless (or inhibit-mark-movement (consp arg)) + (push-mark)) (let ((size (- (point-max) (point-min)))) - (goto-char (if arg + (goto-char (if (and arg (not (consp arg))) (+ (point-min) (if (> size 10000) ;; Avoid overflow for large buffer sizes! @@ -586,7 +591,8 @@ Don't use this command in Lisp programs! (defun end-of-buffer (&optional arg) "Move point to the end of the buffer; leave mark at previous position. -With arg N, put point N/10 of the way from the end. +With \\[universal-argument] prefix, do not set mark at previous position. +With numeric arg N, put point N/10 of the way from the end. If the buffer is narrowed, this command uses the beginning and size of the accessible part of the buffer. @@ -594,9 +600,10 @@ of the accessible part of the buffer. Don't use this command in Lisp programs! \(goto-char (point-max)) is faster and avoids clobbering the mark." (interactive "P") - (push-mark) + (unless (or inhibit-mark-movement (consp arg)) + (push-mark)) (let ((size (- (point-max) (point-min)))) - (goto-char (if arg + (goto-char (if (and arg (not (consp arg))) (- (point-max) (if (> size 10000) ;; Avoid overflow for large buffer sizes! From ff99642792644ad61f3d1749a1b81f80d9a660b1 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 16 Jul 2004 10:42:26 +0000 Subject: [PATCH 21/46] (cua--preserve-mark-commands): New defvar. Init to beginning-of-buffer and end-of-buffer. (cua--undo-push-mark): New defvar. (cua--pre-command-handler): Set inhibit-mark-movement if mark is already active and command is in cua--preserve-mark-commands. Also fix check for shift modifier on non-window systems. (cua--post-command-handler): Clear inhibit-mark-movement if set. --- lisp/emulation/cua-base.el | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index 51b47b104d0..b39945c7712 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el @@ -974,6 +974,13 @@ Extra commands should be added to `cua-movement-commands'") (defvar cua-movement-commands nil "User may add additional movement commands to this list.") +(defvar cua--preserve-mark-commands + '(end-of-buffer beginning-of-buffer) + "List of movement commands that move the mark. +CUA will preserve the previous mark position if a mark is already +active before one of these commands is executed.") + +(defvar cua--undo-push-mark nil) ;;; Scrolling commands which does not signal errors at top/bottom ;;; of buffer at first key-press (instead moves to top/bottom @@ -1062,8 +1069,15 @@ If ARG is the atom `-', scroll upward by nearly full screen." ;; If rectangle is active, expand rectangle in specified direction and ignore the movement. (if movement (cond - ((memq 'shift (event-modifiers (aref (this-single-command-raw-keys) 0))) - (unless mark-active + ((memq 'shift (event-modifiers + (aref (if window-system + (this-single-command-raw-keys) + (this-single-command-keys)) 0))) + (if mark-active + (if (and (memq this-command cua--preserve-mark-commands) + (not inhibit-mark-movement)) + (setq cua--undo-push-mark t + inhibit-mark-movement t)) (push-mark-command nil t)) (setq cua--last-region-shifted t) (setq cua--explicit-region-start nil)) @@ -1110,6 +1124,9 @@ If ARG is the atom `-', scroll upward by nearly full screen." (defun cua--post-command-handler () (condition-case nil (progn + (when cua--undo-push-mark + (setq cua--undo-push-mark nil + inhibit-mark-movement nil)) (when cua--global-mark-active (cua--global-mark-post-command)) (when (fboundp 'cua--rectangle-post-command) From f9253326af7800854e57e82d0a4b66529664dc2c Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 16 Jul 2004 10:42:43 +0000 Subject: [PATCH 22/46] *** empty log message *** --- lisp/ChangeLog | 14 ++++++++++++++ src/ChangeLog | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bc4e75be761..8bd1b75edf3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2004-07-16 Kim F. Storm + + * simple.el (inhibit-mark-movement): New defvar. + (beginning-of-buffer, end-of-buffer): Do not push mark if + inhibit-mark-movement is non-nil or C-u prefix is given. + + * emulation/cua-base.el (cua--preserve-mark-commands): New defvar. + Init to beginning-of-buffer and end-of-buffer. + (cua--undo-push-mark): New defvar. + (cua--pre-command-handler): Set inhibit-mark-movement if mark is + already active and command is in cua--preserve-mark-commands. + Also fix check for shift modifier on non-window systems. + (cua--post-command-handler): Clear inhibit-mark-movement if set. + 2004-07-14 Luc Teirlinck * calendar/cal-dst.el (calendar-time-from-absolute): Return a list diff --git a/src/ChangeLog b/src/ChangeLog index 7c720d73653..1dfaa3f9ce4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,8 +5,8 @@ 2004-07-15 David Kastrup - * search.c (syms_of_search): staticpro - `saved_last_thing_searched'. Apparently fixes an abort condition. + * search.c (syms_of_search): Staticpro `saved_last_thing_searched'. + Apparently fixes an abort condition. 2004-07-14 Luc Teirlinck From b6fdd1efe6c347beda90d7d37bda4daf2b612727 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 16 Jul 2004 13:15:09 +0000 Subject: [PATCH 23/46] (list-buffers-noselect): Append the buffer's process status to its mode name. --- lisp/ChangeLog | 5 +++++ lisp/buff-menu.el | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8bd1b75edf3..6b2d3eb4145 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2004-07-16 Stephan Stahl (tiny change) + + * buff-menu.el (list-buffers-noselect): Append the buffer's + process status to its mode name. + 2004-07-16 Kim F. Storm * simple.el (inhibit-mark-movement): New defvar. diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index da1c8ed586e..1ccaab1c6a3 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -613,7 +613,7 @@ For more information, see the function `buffer-menu'." " " (Buffer-menu-make-sort-button "Mode" 4) mode-end (Buffer-menu-make-sort-button "File" 5) "\n")) - list desired-point name file) + list desired-point name mode file) (when Buffer-menu-use-header-line (let ((pos 0)) ;; Turn spaces in the header into stretch specs so they work @@ -638,8 +638,14 @@ For more information, see the function `buffer-menu'." (mapcar (lambda (buffer) (with-current-buffer buffer - (setq name (buffer-name) - file (buffer-file-name)) + (save-window-excursion + (setq name (buffer-name) + mode (progn + (set-window-buffer (selected-window) buffer) + (concat (format-mode-line mode-name) + (if mode-line-process + (format-mode-line mode-line-process)))) + file (buffer-file-name))) (cond ;; Don't mention internal buffers. ((and (string= (substring name 0 1) " ") (null file))) @@ -665,7 +671,7 @@ For more information, see the function `buffer-menu'." ?% ? ) ;; Identify modified buffers. (if (buffer-modified-p) ?* ? )) - name (buffer-size) mode-name file))))) + name (buffer-size) mode file))))) (buffer-list)))) (dolist (buffer (if Buffer-menu-sort-column From aa0e4da88dc6c85dee2ca78cbf1dfdf5f43c557d Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Fri, 16 Jul 2004 16:05:28 +0000 Subject: [PATCH 24/46] (Images): Fix Texinfo usage. --- lispref/ChangeLog | 4 ++++ lispref/display.texi | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 65202b371ae..2c02841fae7 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,7 @@ +2004-07-16 Juanma Barranquero + + * display.texi (Images): Fix Texinfo usage. + 2004-07-14 Luc Teirlinck * buffers.texi (Modification Time): `visited-file-modtime' now diff --git a/lispref/display.texi b/lispref/display.texi index b6fd015beba..e77edc88aa1 100644 --- a/lispref/display.texi +++ b/lispref/display.texi @@ -2907,7 +2907,7 @@ To know which image types are really available, use This in an alist of image types vs external libraries needed to display them. -Each element is a list @code{(@var{IMAGE-TYPE} @var{LIBRARY}...)}, +Each element is a list @code{(@var{image-type} @var{library}...)}, where the car is a supported image format from @code{image-types}, and the rest are strings giving alternate filenames for the corresponding external libraries to load. @@ -2924,9 +2924,10 @@ into Emacs. @defun image-type-available-p type @findex image-type-available-p -This function returns non-nil if image type @var{TYPE} is available, -i.e., if images of this type can be loaded and displayed in Emacs. -@var{TYPE} should be one of the types contained in @code{image-types}. +This function returns non-@code{nil} if image type @var{type} is +available, i.e., if images of this type can be loaded and displayed in +Emacs. @var{type} should be one of the types contained in +@code{image-types}. For image types whose support libraries are statically linked, this function always returns @code{t}; for other image types, it returns From 9a7e97c6fb5ad76aacf0f75a6b30503f29fddd54 Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Fri, 16 Jul 2004 18:38:38 +0000 Subject: [PATCH 25/46] (Regexp Backslash): Document new \_< and \_> operators. From Jim Blandy. --- lispref/ChangeLog | 5 +++++ lispref/searching.texi | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 2c02841fae7..a8c9c295a83 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,8 @@ +2004-07-16 Jim Blandy + + * searching.texi (Regexp Backslash): Document new \_< and \_> + operators. + 2004-07-16 Juanma Barranquero * display.texi (Images): Fix Texinfo usage. diff --git a/lispref/searching.texi b/lispref/searching.texi index 4a2703fd640..fd0d0e172a0 100644 --- a/lispref/searching.texi +++ b/lispref/searching.texi @@ -666,6 +666,19 @@ word-constituent character follows. matches the empty string, but only at the end of a word. @samp{\>} matches at the end of the buffer (or string) only if the contents end with a word-constituent character. + +@item \_< +@cindex @samp{\_<} in regexp +matches the empty string, but only at the beginning of a symbol. A +symbol is a sequence of one or more word or symbol constituent +characters. @samp{\_<} matches at the beginning of the buffer (or +string) only if a symbol-constituent character follows. + +@item \_> +@cindex @samp{\_>} in regexp +matches the empty string, but only at the end of a symbol. @samp{\_>} +matches at the end of the buffer (or string) only if the contents end +with a symbol-constituent character. @end table @kindex invalid-regexp From dd0a3ea36a52518f4fcd2dea97859cfba63158f8 Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Fri, 16 Jul 2004 18:55:01 +0000 Subject: [PATCH 26/46] Mention new \_< and \_> operators. (From Jim Blandy.) --- etc/NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 82778db7be8..adbe4f41c51 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -95,6 +95,12 @@ types any more. Add -DUSE_LISP_UNION_TYPE if you want union types. * Changes in Emacs 21.4 ++++ +** There are now two new regular expression operators, \_< and \_>, +for matching the beginning and end of a symbol. A symbol is a +non-empty sequence of either word or symbol constituent characters, as +specified by the syntax table. + ** Passing resources on the command line now works on MS Windows. You can use --xrm to pass resource settings to Emacs, overriding any existing values. For example: From 7778781072f91c4603b4e0516c64ff3a5c76c298 Mon Sep 17 00:00:00 2001 From: Daniel Pfeiffer Date: Sat, 17 Jul 2004 08:10:28 +0000 Subject: [PATCH 27/46] (which-func-keymap): New var. (which-func-face): New face. (which-func-format): Use them. --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/which-func.el | 28 +++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6b2d3eb4145..c45bd6987b9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2004-07-14 Daniel Pfeiffer + + * progmodes/which-func.el (which-func-keymap): New var. + (which-func-face): New face. + (which-func-format): Use them. + 2004-07-16 Stephan Stahl (tiny change) * buff-menu.el (list-buffers-noselect): Append the buffer's diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index fef159d850f..87df0769314 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -99,7 +99,33 @@ Zero means compute the Imenu menu regardless of size." :group 'which-func :type 'integer) -(defcustom which-func-format '("[" which-func-current "]") +(defvar which-func-keymap + (let ((map (make-sparse-keymap))) + (define-key map [mode-line mouse-1] 'beginning-of-defun) + (define-key map [mode-line mouse-2] + (lambda () + (interactive) + (if (eq (point-min) 1) + (narrow-to-defun) + (widen)))) + (define-key map [mode-line mouse-3] 'end-of-defun) + map) + "Keymap to display on mode line which-func.") + +(defface which-func-face + '((t (:inherit font-lock-function-name-face))) + "Face used to highlight mode line function names. +Defaults to `font-lock-function-name-face' if font-lock is loaded." + :group 'which-func) + +(defcustom which-func-format + `("[" + (:propertize which-func-current + local-map ,which-func-keymap + face which-func-face + ;;mouse-face highlight ; currently not evaluated :-( + help-echo "mouse-1: go to beginning, mouse-2: toggle rest visibility, mouse-3: go to end") + "]") "Format for displaying the function in the mode line." :group 'which-func :type 'sexp) From 06382b71871b14694e85d36eb8384b6ecda2750e Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 11:57:13 +0000 Subject: [PATCH 28/46] *** empty log message *** --- etc/TODO | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/etc/TODO b/etc/TODO index 281674e230e..4efeada3aa0 100644 --- a/etc/TODO +++ b/etc/TODO @@ -87,7 +87,9 @@ to the FSF. latin-1-prefix and latin-1-postfix. ** Implement a clean way to use different major modes for - different parts of a buffer. + different parts of a buffer. This could be useful in editing + Bison input files, for instance, or other kinds of text + where one language is embedded in another language. ** Give start-process the ability to direct standard-error output to a different filter. @@ -107,8 +109,8 @@ to the FSF. See the Gnus development sources for assigned code concerning GPG use with mail, which is probably a good start.] -** Save undo information in files, and reload it when needed - for undoing. +** Save undo information in special temporary files, and reload it + when needed for undoing. This could extend undo capacity. ** Merge the Emacs regex.c with the Glibc regex.c. They split off a few years ago through negligence. From d1b2b8cc72806e2049b5fd694b6f7017fd254f74 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 12:00:10 +0000 Subject: [PATCH 29/46] Minor cleanups in text. --- etc/NEWS | 70 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index adbe4f41c51..7bb0ac87263 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -150,7 +150,7 @@ The new commands `comint-kill-whole-line' and `comint-kill-region' support editing comint buffers with read-only prompts. `comint-kill-whole-line' is like `kill-whole-line', but ignores both -read-only and field properties. Hence, it will always kill entire +read-only and field properties. Hence, it always kill entire lines, including any prompts. `comint-kill-region' is like `kill-region', except that it ignores @@ -164,7 +164,7 @@ kill-ring, but does not delete it. ** You can now use next-error (C-x `) and previous-error to advance to the next/previous matching line found by M-x occur. -** Telnet will now prompt you for a port number with C-u M-x telnet. +** Telnet now prompts you for a port number with C-u M-x telnet. +++ ** New command line option -Q. @@ -183,9 +183,9 @@ supplied. This behavior is analogous to `write-file'. ** You can now use Auto Revert mode to `tail' a file. If point is at the end of a file buffer before reverting, Auto Revert mode keeps it at the end after reverting. Similarly if point is -displayed at the end of a file buffer in any window, it will stay at +displayed at the end of a file buffer in any window, it stays at the end of the buffer in that window. This allows to tail a file: -just put point at the end of the buffer and it will stay there. This +just put point at the end of the buffer and it stays there. This rule applies to file buffers. For non-file buffers, the behavior may be mode dependent. @@ -193,7 +193,7 @@ be mode dependent. other potential problems when deciding which non-file buffers to revert. This matters especially if Global Auto Revert mode is enabled and `global-auto-revert-non-file-buffers' is non-nil. Auto Revert -mode will only revert a non-file buffer if the buffer has a non-nil +mode only reverts a non-file buffer if the buffer has a non-nil `revert-buffer-function' and a non-nil `buffer-stale-function', which decides whether the buffer should be reverted. Currently, this means that auto reverting works for Dired buffers (although this may not @@ -231,7 +231,7 @@ The new file etc/compilation.txt gives examples of each type of message. ** M-x grep has been adapted to new compile Hits are fontified in green, and hits in binary files in orange. Grep buffers -can be saved and will again be loaded with the new `grep-mode'. +can be saved and automatically revisited with the new Grep mode. ** M-x diff uses diff-mode instead of compilation-mode. @@ -433,7 +433,7 @@ with special modes such as Tar mode. ** Enhancements to apropos commands: -*** The apropos commands will now accept a list of words to match. +*** The apropos commands now accept a list of words to match. When more than one word is specified, at least two of those words must be present for an item to match. Regular expression matching is still available. @@ -612,7 +612,7 @@ XIM by default, the X resource useXIM can be used to turn it on. `file|dir1' and `file|dir2' to `file|dir1/subdir' and `file|dir2/subdir'. ** If the user visits a file larger than `large-file-warning-threshold', -Emacs will prompt her for confirmation. +Emacs prompts her for confirmation. ** A UTF-7 coding system is available in the library `utf-7'. @@ -689,8 +689,8 @@ directory is used for auto-save files of mail buffers. It defaults to +++ ** When you are root, and you visit a file whose modes specify read-only, the Emacs buffer is now read-only too. Type C-x C-q if you -want to make the buffer writable. (As root, you will in fact be able -to alter the file.) +want to make the buffer writable. (As root, you can in fact alter the +file.) ** The new command `revert-buffer-with-coding-system' (C-x RET r) revisits the current file using a coding system that you specify. @@ -712,7 +712,7 @@ in the menu dropped down when you click "Buffers" from the menu bar. `buffers-menu-show-directories' controls whether the menu displays leading directories as part of the file name visited by the buffer. -If its value is `unless-uniquify', the default, directories will be +If its value is `unless-uniquify', the default, directories are shown unless uniquify-buffer-name-style' is non-nil. The value of nil and t turn the display of directories off and on, respectively. @@ -791,7 +791,7 @@ sets plus some other 8-bit sets, but can be extended. For instance, translation works amongst the Emacs ...-iso8859-... charsets and the mule-unicode-... ones. -By default this translation will happen automatically on encoding. +By default this translation happens automatically on encoding. Self-inserting characters are translated to make the input conformant with the encoding of the buffer in which it's being used, where possible. @@ -869,7 +869,7 @@ the window edge point is allowed to get before automatic hscrolling will horizontally scroll the window. The default value is 5. The variable `hscroll-step' determines how many columns automatic -hscrolling will scroll the window when point gets too close to the +hscrolling scrolls the window when point gets too close to the window edge. If its value is zero, the default, Emacs scrolls the window so as to center point. If its value is an integer, it says how many columns to scroll. If the value is a floating-point number, it @@ -1117,8 +1117,8 @@ remove `turn-on-font-lock' from `Info-mode-hook'. +++ ** M-x grep now tries to avoid appending `/dev/null' to the command line -by using GNU grep `-H' option instead. M-x grep will automatically -detect whether this is possible or not the first time it is invoked. +by using GNU grep `-H' option instead. M-x grep automatically +detects whether this is possible or not the first time it is invoked. When `-H' is used, the grep command line supplied by the user is passed unchanged to the system to execute, which allows more complicated command lines to be used than was possible before. @@ -1182,7 +1182,7 @@ counter to the specified source line (the one where point is). *** The STARTTLS elisp wrapper (starttls.el) can now use GNUTLS instead of the OpenSSL based "starttls" tool. For backwards -compatibility, it will prefer "starttls", but you can toggle +compatibility, it prefers "starttls", but you can toggle `starttls-use-gnutls' to switch to GNUTLS (or simply remove the "starttls" tool). @@ -1217,10 +1217,10 @@ refontification takes place. +++ ** Marking commands extend the region when invoked multiple times. If you hit M-C-SPC (mark-sexp), M-@ (mark-word), M-h (mark-paragraph), or -C-M-h (mark-defun) repeatedly, the marked region will now be extended -each time, so you can mark the next two sexps with M-C-SPC M-C-SPC, -for example. This feature also works for mark-end-of-sentence, if you -bind that to a key. +C-M-h (mark-defun) repeatedly, the marked region extends each time, so +you can mark the next two sexps with M-C-SPC M-C-SPC, for example. +This feature also works for mark-end-of-sentence, if you bind that to +a key. +++ ** Some commands do something special in Transient Mark mode when the @@ -1242,7 +1242,7 @@ C-g. +++ ** A prefix argument is no longer required to repeat a jump to a -previous mark, i.e. C-u C-SPC C-SPC C-SPC ... will cycle through the +previous mark, i.e. C-u C-SPC C-SPC C-SPC ... cycles through the mark ring. Use C-u C-u C-SPC to set the mark immediately after a jump. +++ @@ -1449,7 +1449,7 @@ writes tags pointing to the source file. *** New option --parse-stdin=FILE. This option is mostly useful when calling etags from programs. It can be used (only once) in place of a file name on the command line. Etags -will read from standard input and mark the produced tags as belonging to +reads from standard input and mark the produced tags as belonging to the file FILE. +++ @@ -1757,8 +1757,8 @@ fill-single-word-nobreak-p and fill-french-nobreak-p. +++ ** New user option `add-log-always-start-new-record'. -When this option is enabled, M-x add-change-log-entry will always -start a new record regardless of when the last record is. +When this option is enabled, M-x add-change-log-entry always +starts a new record regardless of when the last record is. +++ ** SGML mode has indentation and supports XML syntax. @@ -1910,13 +1910,13 @@ pass them to Windows to be handled with system-wide functions. --- ** Emacs takes note of colors defined in Control Panel on MS-Windows. -The Control Panel defines some default colors for applications in -much the same way as wildcard X Resources do on X. Emacs now -adds these colors to the colormap prefixed by System (eg SystemMenu -for the default Menu background, SystemMenuText for the foreground), -and uses some of them to initialize some of the default faces. -`list-colors-display' will show the list of System color names if you -wish to use them in other faces. +The Control Panel defines some default colors for applications in much +the same way as wildcard X Resources do on X. Emacs now adds these +colors to the colormap prefixed by System (eg SystemMenu for the +default Menu background, SystemMenuText for the foreground), and uses +some of them to initialize some of the default faces. +`list-colors-display' shows the list of System color names, in case +you wish to use them in other faces. +++ ** Under X11, it is possible to swap Alt and Meta (and Super and Hyper). @@ -2084,7 +2084,7 @@ this behaviour via the variable kmacro-call-repeat-key and kmacro-call-repeat-with-arg. Keyboard macros can now be debugged and edited interactively. -C-x C-k SPC will step through the last keyboard macro one key sequence +C-x C-k SPC steps through the last keyboard macro one key sequence at a time, prompting for the actions to take. --- @@ -3577,9 +3577,9 @@ it in that buffer. properties from surrounding text. +++ -** `(match-data t)' will append the buffer as a final element of the -match data if the last match was on a buffer. `set-match-data' will -accept this for restoring the match state. +** The list returned by `(match-data t)' now has the buffer as a final +element, if the last match was on a buffer. `set-match-data' +accepts such a list for restoring the match state. +++ ** New function `buffer-local-value'. From cf0fad845abeff2e295e50eb08085cda1d711b66 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:27:24 +0000 Subject: [PATCH 30/46] (quote_file_name): Pass COPY thru %s to output it. --- lib-src/emacsclient.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 0698691bf13..24dcdffff2c 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -203,7 +203,7 @@ quote_file_name (name, stream) } *q++ = 0; - fprintf (stream, copy); + fprintf (stream, "%s", copy); free (copy); } From 5ac714934dc99c9c210ba66762ffd3e91a3d9663 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:30:33 +0000 Subject: [PATCH 31/46] (font-lock-add-keywords, font-lock-remove-keywords): Compile font-lock-keywords, not KEYWORDS. (lisp-font-lock-keywords-2): Add multiple-value-prog1, go. Add warn, check-type. Handle cerror like error. --- lisp/font-lock.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/font-lock.el b/lisp/font-lock.el index ce2548cc84d..36dac14f6a9 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -693,7 +693,7 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types', ;; If the keywords were compiled before, compile them again. (if was-compiled (set (make-local-variable 'font-lock-keywords) - (font-lock-compile-keywords keywords t))))))) + (font-lock-compile-keywords font-lock-keywords t))))))) (defun font-lock-update-removed-keyword-alist (mode keywords append) ;; Update `font-lock-removed-keywords-alist' when adding new @@ -801,7 +801,7 @@ subtle problems due to details of the implementation." ;; If the keywords were compiled before, compile them again. (if was-compiled (set (make-local-variable 'font-lock-keywords) - (font-lock-compile-keywords keywords t))))))) + (font-lock-compile-keywords font-lock-keywords t))))))) ;;; Font Lock Support mode. @@ -1944,12 +1944,12 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item." '("when" "unless" "case" "ecase" "typecase" "etypecase" "ccase" "ctypecase" "handler-case" "handler-bind" "restart-bind" "restart-case" "in-package" - "cerror" "break" "ignore-errors" + "break" "ignore-errors" "loop" "do" "do*" "dotimes" "dolist" "the" "locally" "proclaim" "declaim" "declare" "symbol-macrolet" "lexical-let" "lexical-let*" "flet" "labels" "compiler-let" - "destructuring-bind" "macrolet" "tagbody" "block" - "multiple-value-bind" + "destructuring-bind" "macrolet" "tagbody" "block" "go" + "multiple-value-bind" "multiple-value-prog1" "return" "return-from" "with-accessors" "with-compilation-unit" "with-condition-restarts" "with-hash-table-iterator" @@ -1967,7 +1967,7 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item." '(2 font-lock-constant-face nil t)) ;; ;; Erroneous structures. - '("(\\(abort\\|assert\\|error\\|signal\\)\\>" 1 font-lock-warning-face) + '("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|error\\|signal\\)\\>" 1 font-lock-warning-face) ;; ;; Words inside \\[] tend to be for `substitute-command-keys'. '("\\\\\\\\\\[\\(\\sw+\\)]" 1 font-lock-constant-face prepend) From c4dc7971b9d96dcc80762ed3d6a9b218652b5772 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:31:27 +0000 Subject: [PATCH 32/46] (footnote-section-tag): Use defcustom. --- lisp/mail/footnote.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el index 4644d36ad25..b5ec6f02260 100644 --- a/lisp/mail/footnote.el +++ b/lisp/mail/footnote.el @@ -87,8 +87,11 @@ If nil, no blank line will be inserted." ;;; Interface variables that probably shouldn't be changed -(defconst footnote-section-tag "Footnotes: " - "*Tag inserted at beginning of footnote section.") +(defcustom footnote-section-tag "Footnotes: " + "*Tag inserted at beginning of footnote section." + :version "21.4" + :type 'string + :group 'footnote) (defcustom footnote-section-tag-regexp "Footnotes\\(\\[.\\]\\)?: " "*Regexp which indicates the start of a footnote section. From 442a68c7f15f7c3eafec34a66db6d3d25f7d3046 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:34:42 +0000 Subject: [PATCH 33/46] (occur-read-primary-args): Pass default to read-from-minibuffer. --- lisp/replace.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/replace.el b/lisp/replace.el index 60c28d6c48a..f81c6f53914 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -786,7 +786,8 @@ If the value is nil, don't highlight the buffer names specially." nil nil nil - 'regexp-history))) + 'regexp-history + default))) (if (equal input "") default input)) From 9206efb955c708b66c688f29a5eb15507b9f2405 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:39:11 +0000 Subject: [PATCH 34/46] (Abbrev Expansion): Clarify pre-abbrev-expand-hook, fix example. --- lispref/abbrevs.texi | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lispref/abbrevs.texi b/lispref/abbrevs.texi index ff6cdf77c2e..d586d0bbc13 100644 --- a/lispref/abbrevs.texi +++ b/lispref/abbrevs.texi @@ -335,10 +335,9 @@ abbrev lookup happens. @end defvar The following sample code shows a simple use of -@code{pre-abbrev-expand-hook}. If the user terminates an abbrev with a -punctuation character, the hook function asks for confirmation. Thus, -this hook allows the user to decide whether to expand the abbrev, and -aborts expansion if it is not confirmed. +@code{pre-abbrev-expand-hook}. If the user terminates an abbrev with +a punctuation character, the hook function asks for confirmation. It +aborts expansion if the user does not confirm. @smallexample (add-hook 'pre-abbrev-expand-hook 'query-if-not-space) @@ -350,12 +349,10 @@ aborts expansion if it is not confirmed. ;; @r{user entered some other character, this function asks whether} ;; @r{expansion should continue.} -;; @r{If the user answers the prompt with @kbd{y}, the function returns} -;; @r{@code{nil} (because of the @code{not} function), but that is} -;; @r{acceptable; the return value has no effect on expansion.} +;; @r{The function's return value makes no difference.} (defun query-if-not-space () - (if (/= ?\s (preceding-char)) + (if (/= ?\s last-command-char) (if (not (y-or-n-p "Do you want to expand this abbrev? ")) (error "Not expanding this abbrev")))) @end smallexample From 11cd6064013b858f9238999b37157a952eaa9405 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:40:22 +0000 Subject: [PATCH 35/46] (Overlay Properties): Adding `evaporate' prop deletes empty overlay immediately. --- lispref/display.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lispref/display.texi b/lispref/display.texi index e77edc88aa1..fb9d7c79e0e 100644 --- a/lispref/display.texi +++ b/lispref/display.texi @@ -1165,9 +1165,9 @@ sense---only on the screen. @item evaporate @kindex evaporate @r{(overlay property)} If this property is non-@code{nil}, the overlay is deleted automatically -if it becomes empty (i.e., if its length becomes zero). However, -if the overlay is @emph{already} empty, @code{evaporate} does not -delete it. +if it becomes empty (i.e., if its length becomes zero). If you give +an empty overlay a non-@code{nil} @code{evaporate} property, that deletes +it immediately. @item local-map @cindex keymap of character (and overlays) From b3264fd2a8803c90ddb0a21b675b25f5d6ff72f4 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:43:49 +0000 Subject: [PATCH 36/46] (syms_of_buffer) : Doc fix. --- src/buffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/buffer.c b/src/buffer.c index c5783ade2a0..f55ae7983f4 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5861,7 +5861,10 @@ all windows or just the selected window. If the value is `lambda', that enables Transient Mark mode temporarily until the next buffer modification. If a command sets the value to `only', -that enables Transient Mark mode for the following command only. */); +that enables Transient Mark mode for the following command only. +During that following command, the value of `transient-mark-mode' +is `identity'. If it is still `identity' at the end of that command, +it changes to nil. */); Vtransient_mark_mode = Qnil; DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only, From 8ceb7434dfcad287b590e4493f94db48bf88afd1 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:45:01 +0000 Subject: [PATCH 37/46] (Fdelete_frame): If we're in single_bboard_state on this kboard, and we delete its last frame, go to any_kboard_state. --- src/frame.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/frame.c b/src/frame.c index 934c11d98bc..691ff8c44d5 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1327,6 +1327,36 @@ The functions are run with one arg, the frame to be deleted. */) } } + /* If there's no other frame on the same kboard, get out of + single-kboard state if we're in it for this kboard. */ + { + Lisp_Object frames; + /* Some frame we found on the same kboard, or nil if there are none. */ + Lisp_Object frame_on_same_kboard; + + frame_on_same_kboard = Qnil; + + for (frames = Vframe_list; + CONSP (frames); + frames = XCDR (frames)) + { + Lisp_Object this; + struct frame *f1; + + this = XCAR (frames); + if (!FRAMEP (this)) + abort (); + f1 = XFRAME (this); + + if (FRAME_KBOARD (f) == FRAME_KBOARD (f1)) + frame_on_same_kboard = this; + } + + if (NILP (frame_on_same_kboard)) + not_single_kboard_state (FRAME_KBOARD (f)); + } + + /* If we've deleted this keyboard's default_minibuffer_frame, try to find another one. Prefer minibuffer-only frames, but also notice frames with other windows. */ From 0c1c1b936d4f9043639b88e5e8b209db6e290408 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:50:58 +0000 Subject: [PATCH 38/46] (not_single_kboard_state): New function. (stuff_buffered_input): Now no-op only if no SIGTSTP. --- src/keyboard.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 89706dc3dce..aa2bdbddf5a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1089,6 +1089,17 @@ single_kboard_state () #endif } +/* If we're in single_kboard state for kboard KBOARD, + get out of it. */ + +void +not_single_kboard_state (kboard) + KBOARD *kboard; +{ + if (kboard == current_kboard) + single_kboard = 0; +} + /* Maintain a stack of kboards, so other parts of Emacs can switch temporarily to the kboard of a given frame and then revert to the previous status. */ @@ -10175,9 +10186,7 @@ void stuff_buffered_input (stuffstring) Lisp_Object stuffstring; { -/* stuff_char works only in BSD, versions 4.2 and up. */ -#ifdef BSD_SYSTEM -#ifndef BSD4_1 +#ifdef SIGTSTP /* stuff_char is defined if SIGTSTP. */ register unsigned char *p; if (STRINGP (stuffstring)) @@ -10193,7 +10202,10 @@ stuff_buffered_input (stuffstring) /* Anything we have read ahead, put back for the shell to read. */ /* ?? What should this do when we have multiple keyboards?? - Should we ignore anything that was typed in at the "wrong" kboard? */ + Should we ignore anything that was typed in at the "wrong" kboard? + + rms: we should stuff everything back into the kboard + it came from. */ for (; kbd_fetch_ptr != kbd_store_ptr; kbd_fetch_ptr++) { @@ -10206,8 +10218,7 @@ stuff_buffered_input (stuffstring) } input_pending = 0; -#endif -#endif /* BSD_SYSTEM and not BSD4_1 */ +#endif /* SIGTSTP */ } void From 15479e8b2fc5944d3b9254edbec69c4d2f3bb86c Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:54:56 +0000 Subject: [PATCH 39/46] (print_preprocess): Test for print_depth at limit before entering in being_printed. --- src/print.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/print.c b/src/print.c index 0abd30b5ce0..5a0f7fe6220 100644 --- a/src/print.c +++ b/src/print.c @@ -1284,6 +1284,11 @@ print_preprocess (obj) int loop_count = 0; Lisp_Object halftail; + /* Give up if we go so deep that print_object will get an error. */ + /* See similar code in print_object. */ + if (print_depth >= PRINT_CIRCLE) + return; + /* Avoid infinite recursion for circular nested structure in the case where Vprint_circle is nil. */ if (NILP (Vprint_circle)) @@ -1294,11 +1299,6 @@ print_preprocess (obj) being_printed[print_depth] = obj; } - /* Give up if we go so deep that print_object will get an error. */ - /* See similar code in print_object. */ - if (print_depth >= PRINT_CIRCLE) - return; - print_depth++; halftail = obj; From 403de3b40ec8402fd2c24dc73b8ff4596921cd64 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 14:59:02 +0000 Subject: [PATCH 40/46] (coordinates_in_window): Inside the window but outside its box to the L or R, return ON_VERTICAL_BORDER. (window_list_1): Rotate the list to start with WINDOW. --- src/window.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/window.c b/src/window.c index c09eaab85ba..907cc113916 100644 --- a/src/window.c +++ b/src/window.c @@ -670,7 +670,7 @@ coordinates_in_window (w, x, y) /* Outside any interesting column? */ if (*x < left_x || *x > right_x) - return ON_NOTHING; + return ON_VERTICAL_BORDER; lmargin_width = window_box_width (w, LEFT_MARGIN_AREA); rmargin_width = window_box_width (w, RIGHT_MARGIN_AREA); @@ -1799,7 +1799,7 @@ static Lisp_Object window_list_1 (window, minibuf, all_frames) Lisp_Object window, minibuf, all_frames; { - Lisp_Object tail, list; + Lisp_Object tail, list, rest; decode_next_window_args (&window, &minibuf, &all_frames); list = Qnil; @@ -1808,7 +1808,17 @@ window_list_1 (window, minibuf, all_frames) if (candidate_window_p (XCAR (tail), window, minibuf, all_frames)) list = Fcons (XCAR (tail), list); - return Fnreverse (list); + /* Rotate the list to start with WINDOW. */ + list = Fnreverse (list); + rest = Fmemq (window, list); + if (!NILP (rest) && !EQ (rest, list)) + { + for (tail = list; XCDR (tail) != rest; tail = XCDR (tail)) + ; + XSETCDR (tail, Qnil); + list = nconc2 (rest, list); + } + return list; } From 3751eb00d78a352422c67fc2285eb38ee5c56b92 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Jul 2004 15:00:22 +0000 Subject: [PATCH 41/46] *** empty log message *** --- lib-src/ChangeLog | 4 ++++ lisp/ChangeLog | 11 +++++++++++ lispref/ChangeLog | 8 ++++++++ src/ChangeLog | 17 +++++++++++++++++ 4 files changed, 40 insertions(+) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 9f3fcc13371..4764871fa54 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,7 @@ +2004-07-17 Richard M. Stallman + + * emacsclient.c (quote_file_name): Pass COPY thru %s to output it. + 2004-06-01 Juanma Barranquero * makefile.w32-in (obj): Add image.c. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c45bd6987b9..2b249918d7f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2004-07-17 Richard M. Stallman + + * replace.el (occur-read-primary-args): Pass default to read-from-minibuffer. + + * mail/footnote.el (footnote-section-tag): Use defcustom. + + * font-lock.el (font-lock-add-keywords, font-lock-remove-keywords): + Compile font-lock-keywords, not KEYWORDS. + (lisp-font-lock-keywords-2): Add multiple-value-prog1, go. + Add warn, check-type. Handle cerror like error. + 2004-07-14 Daniel Pfeiffer * progmodes/which-func.el (which-func-keymap): New var. diff --git a/lispref/ChangeLog b/lispref/ChangeLog index a8c9c295a83..3e8fc5df417 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,11 @@ +2004-07-17 Richard M. Stallman + + * display.texi (Overlay Properties): Adding `evaporate' prop + deletes empty overlay immediately. + + * abbrevs.texi (Abbrev Expansion): Clarify pre-abbrev-expand-hook, + fix example. + 2004-07-16 Jim Blandy * searching.texi (Regexp Backslash): Document new \_< and \_> diff --git a/src/ChangeLog b/src/ChangeLog index 1dfaa3f9ce4..253b3ce806f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2004-07-17 Richard M. Stallman + + * window.c (coordinates_in_window): Inside the window but outside + its box to the L or R, return ON_VERTICAL_BORDER. + (window_list_1): Rotate the list to start with WINDOW. + + * print.c (print_preprocess): Test for print_depth at limit + before entering in being_printed. + + * keyboard.c (not_single_kboard_state): New function. + (stuff_buffered_input): Now no-op only if no SIGTSTP. + + * frame.c (Fdelete_frame): If we're in single_bboard_state on + this kboard, and we delete its last frame, go to any_kboard_state. + + * buffer.c (syms_of_buffer) : Doc fix. + 2004-07-15 KOBAYASHI Yasuhiro (tiny change) * w32fns.c (Fx_file_dialog): Encode strings in system coding From 3e39672fd35c40e1dedc8213858a3ac424a31824 Mon Sep 17 00:00:00 2001 From: Jonathan Yavner Date: Sat, 17 Jul 2004 17:06:26 +0000 Subject: [PATCH 42/46] Added some additional functions to the `1-valued', `compose', and progn groups. Bugfix for marking up the definition for an empty function. New category "potentially-1valued" for functions that are not erroneous if either 1-valued or multi-valued. --- lisp/ChangeLog | 10 ++ lisp/emacs-lisp/testcover.el | 223 +++++++++++++++++++++++------------ 2 files changed, 160 insertions(+), 73 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2b249918d7f..cf0600b7605 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2004-07-17 Jonathan Yavner + + * emacs-lisp/testcover.el: New category "potentially-1valued" for + functions that are not erroneous if either 1-valued or + multi-valued. Detect functions in this class. + (testcover-1value-functions, testcover-compose-functions, + testcover-progn-functions) Added some additional functions to lists. + (testcover-mark): Bugfix when marking up the definition for an + empty function. + 2004-07-17 Richard M. Stallman * replace.el (occur-read-primary-args): Pass default to read-from-minibuffer. diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el index 547e2cbd32d..23e9a54b1bb 100644 --- a/lisp/emacs-lisp/testcover.el +++ b/lisp/emacs-lisp/testcover.el @@ -38,9 +38,9 @@ ;; instrumentation callbacks, then replace edebug's callbacks with ours. ;; * To show good coverage, we want to see two values for every form, except ;; functions that always return the same value and `defconst' variables -;; need show only value for good coverage. To avoid the brown splotch, the -;; definitions for constants and 1-valued functions must precede the -;; references. +;; need show only one value for good coverage. To avoid the brown +;; splotch, the definitions for constants and 1-valued functions must +;; precede the references. ;; * Use the macro `1value' in your Lisp code to mark spots where the local ;; code environment causes a function or variable to always have the same ;; value, but the function or variable is not intrinsically 1-valued. @@ -55,12 +55,14 @@ ;; call has the same value! Also, equal thinks two strings are the same ;; if they differ only in properties. ;; * Because we have only a "1value" class and no "always nil" class, we have -;; to treat as 1-valued any `and' whose last term is 1-valued, in case the -;; last term is always nil. Example: +;; to treat as potentially 1-valued any `and' whose last term is 1-valued, +;; in case the last term is always nil. Example: ;; (and (< (point) 1000) (forward-char 10)) -;; This form always returns nil. Similarly, `if' and `cond' are -;; treated as 1-valued if all clauses are, in case those values are -;; always nil. +;; This form always returns nil. Similarly, `or', `if', and `cond' are +;; treated as potentially 1-valued if all clauses are, in case those +;; values are always nil. Unlike truly 1-valued functions, it is not an +;; error if these "potentially" 1-valued forms actually return differing +;; values. (require 'edebug) (provide 'testcover) @@ -86,12 +88,14 @@ these. This list is quite incomplete!" (defcustom testcover-1value-functions '(backward-char barf-if-buffer-read-only beginning-of-line - buffer-disable-undo buffer-enable-undo current-global-map deactivate-mark - delete-char delete-region ding error forward-char function* insert - insert-and-inherit kill-all-local-variables lambda mapc narrow-to-region - noreturn push-mark put-text-property run-hooks set-text-properties signal - substitute-key-definition suppress-keymap throw undo use-local-map while - widen yank) + buffer-disable-undo buffer-enable-undo current-global-map + deactivate-mark delete-backward-char delete-char delete-region ding + forward-char function* insert insert-and-inherit kill-all-local-variables + kill-line kill-paragraph kill-region kill-sexp lambda + minibuffer-complete-and-exit narrow-to-region next-line push-mark + put-text-property run-hooks set-match-data signal + substitute-key-definition suppress-keymap undo use-local-map while widen + yank) "Functions that always return the same value. No brown splotch is shown for these. This list is quite incomplete! Notes: Nobody ever changes the current global map. The macro `lambda' is self-evaluating, hence always @@ -108,9 +112,9 @@ them as having returned nil just before calling them." :type 'hook) (defcustom testcover-compose-functions - '(+ - * / length list make-keymap make-sparse-keymap message propertize - replace-regexp-in-string run-with-idle-timer - set-buffer-modified-p) + '(+ - * / = append length list make-keymap make-sparse-keymap + mapcar message propertize replace-regexp-in-string + run-with-idle-timer set-buffer-modified-p) "Functions that are 1-valued if all their args are either constants or calls to one of the `testcover-1value-functions', so if that's true then no brown splotch is shown for these. This list is quite incomplete! Most @@ -119,16 +123,16 @@ side-effect-free functions should be here." :type 'hook) (defcustom testcover-progn-functions - '(define-key fset function goto-char or overlay-put progn save-current-buffer - save-excursion save-match-data save-restriction save-selected-window - save-window-excursion set set-default setq setq-default - with-output-to-temp-buffer with-syntax-table with-temp-buffer - with-temp-file with-temp-message with-timeout) + '(define-key fset function goto-char mapc overlay-put progn + save-current-buffer save-excursion save-match-data + save-restriction save-selected-window save-window-excursion + set set-default set-marker-insertion-type setq setq-default + with-current-buffer with-output-to-temp-buffer with-syntax-table + with-temp-buffer with-temp-file with-temp-message with-timeout) "Functions whose return value is the same as their last argument. No brown splotch is shown for these if the last argument is a constant or a call to one of the `testcover-1value-functions'. This list is probably -incomplete! Note: `or' is here in case the last argument is a function that -always returns nil." +incomplete!" :group 'testcover :type 'hook) @@ -140,6 +144,11 @@ call to one of the `testcover-1value-functions'." :group 'testcover :type 'hook) +(defcustom testcover-potentially-1value-functions + '(add-hook and beep or remove-hook unless when) + "Functions that are potentially 1-valued. No brown splotch if actually +1-valued, no error if actually multi-valued.") + (defface testcover-nohits-face '((t (:background "DeepPink2"))) "Face for forms that had no hits during coverage test" @@ -161,7 +170,11 @@ call to one of the `testcover-1value-functions'." (defvar testcover-module-1value-functions nil "Symbols declared with defun in the last file processed by -`testcover-start', whose functions always return the same value.") +`testcover-start', whose functions should always return the same value.") + +(defvar testcover-module-potentially-1value-functions nil + "Symbols declared with defun in the last file processed by +`testcover-start', whose functions might always return the same value.") (defvar testcover-vector nil "Locally bound to coverage vector for function in progress.") @@ -206,25 +219,32 @@ non-nil, byte-compiles each function after instrumenting." x)) (defun testcover-reinstrument (form) - "Reinstruments FORM to use testcover instead of edebug. This function -modifies the list that FORM points to. Result is non-nil if FORM will -always return the same value." + "Reinstruments FORM to use testcover instead of edebug. This +function modifies the list that FORM points to. Result is nil if +FORM should return multiple vlues, t if should always return same +value, 'maybe if either is acceptable." (let ((fun (car-safe form)) - id) + id val) (cond - ((not fun) ;Atom - (or (not (symbolp form)) - (memq form testcover-constants) - (memq form testcover-module-constants))) - ((consp fun) ;Embedded list + ((not fun) ;Atom + (when (or (not (symbolp form)) + (memq form testcover-constants) + (memq form testcover-module-constants)) + t)) + ((consp fun) ;Embedded list (testcover-reinstrument fun) (testcover-reinstrument-list (cdr form)) nil) ((or (memq fun testcover-1value-functions) (memq fun testcover-module-1value-functions)) - ;;Always return same value + ;;Should always return same value (testcover-reinstrument-list (cdr form)) t) + ((or (memq fun testcover-potentially-1value-functions) + (memq fun testcover-module-potentially-1value-functions)) + ;;Might always return same value + (testcover-reinstrument-list (cdr form)) + 'maybe) ((memq fun testcover-progn-functions) ;;1-valued if last argument is (testcover-reinstrument-list (cdr form))) @@ -233,11 +253,9 @@ always return the same value." (testcover-reinstrument-list (cddr form)) (testcover-reinstrument (cadr form))) ((memq fun testcover-compose-functions) - ;;1-valued if all arguments are - (setq id t) - (mapc #'(lambda (x) (setq id (or (testcover-reinstrument x) id))) - (cdr form)) - id) + ;;1-valued if all arguments are. Potentially 1-valued if all + ;;arguments are either definitely or potentially. + (testcover-reinstrument-compose (cdr form) 'testcover-reinstrument)) ((eq fun 'edebug-enter) ;;(edebug-enter 'SYM ARGS #'(lambda nil FORMS)) ;; => (testcover-enter 'SYM #'(lambda nil FORMS)) @@ -252,33 +270,44 @@ always return the same value." (aset testcover-vector (cadr (cadr form)) 'ok-coverage)) (setq id (nth 2 form)) (setcdr form (nthcdr 2 form)) + (setq val (testcover-reinstrument (nth 2 form))) + (if (eq val t) + (setcar form 'testcover-1value) + (setcar form 'testcover-after)) + (when val + ;;1-valued or potentially 1-valued + (aset testcover-vector id '1value)) (cond ((memq (car-safe (nth 2 form)) testcover-noreturn-functions) ;;This function won't return, so set the value in advance ;;(edebug-after (edebug-before XXX) YYY FORM) ;; => (progn (edebug-after YYY nil) FORM) + (setcar (cdr form) `(,(car form) ,id nil)) (setcar form 'progn) - (setcar (cdr form) `(testcover-after ,id nil))) + (aset testcover-vector id '1value) + (setq val t)) ((eq (car-safe (nth 2 form)) '1value) ;;This function is always supposed to return the same value - (setcar form 'testcover-1value)) - (t - (setcar form 'testcover-after))) - (when (testcover-reinstrument (nth 2 form)) - (aset testcover-vector id '1value))) + (setq val t) + (aset testcover-vector id '1value) + (setcar form 'testcover-1value))) + val) ((eq fun 'defun) - (if (testcover-reinstrument-list (nthcdr 3 form)) - (push (cadr form) testcover-module-1value-functions))) - ((eq fun 'defconst) + (setq val (testcover-reinstrument-list (nthcdr 3 form))) + (when (eq val t) + (push (cadr form) testcover-module-1value-functions)) + (when (eq val 'maybe) + (push (cadr form) testcover-module-potentially-1value-functions))) + ((memq fun '(defconst defcustom)) ;;Define this symbol as 1-valued (push (cadr form) testcover-module-constants) (testcover-reinstrument-list (cddr form))) ((memq fun '(dotimes dolist)) ;;Always returns third value from SPEC (testcover-reinstrument-list (cddr form)) - (setq fun (testcover-reinstrument-list (cadr form))) + (setq val (testcover-reinstrument-list (cadr form))) (if (nth 2 (cadr form)) - fun + val ;;No third value, always returns nil t)) ((memq fun '(let let*)) @@ -286,23 +315,23 @@ always return the same value." (mapc 'testcover-reinstrument-list (cadr form)) (testcover-reinstrument-list (cddr form))) ((eq fun 'if) - ;;1-valued if both THEN and ELSE clauses are + ;;Potentially 1-valued if both THEN and ELSE clauses are (testcover-reinstrument (cadr form)) (let ((then (testcover-reinstrument (nth 2 form))) (else (testcover-reinstrument-list (nthcdr 3 form)))) - (and then else))) - ((memq fun '(when unless and)) - ;;1-valued if last clause of BODY is - (testcover-reinstrument-list (cdr form))) + (and then else 'maybe))) ((eq fun 'cond) - ;;1-valued if all clauses are - (testcover-reinstrument-clauses (cdr form))) + ;;Potentially 1-valued if all clauses are + (when (testcover-reinstrument-compose (cdr form) + 'testcover-reinstrument-list) + 'maybe)) ((eq fun 'condition-case) - ;;1-valued if BODYFORM is and all HANDLERS are + ;;Potentially 1-valued if BODYFORM is and all HANDLERS are (let ((body (testcover-reinstrument (nth 2 form))) - (errs (testcover-reinstrument-clauses (mapcar #'cdr - (nthcdr 3 form))))) - (and body errs))) + (errs (testcover-reinstrument-compose + (mapcar #'cdr (nthcdr 3 form)) + 'testcover-reinstrument-list))) + (and body errs 'maybe))) ((eq fun 'quote) ;;Don't reinstrument what's inside! ;;This doesn't apply within a backquote @@ -317,16 +346,55 @@ always return the same value." (let ((testcover-1value-functions (remq 'quote testcover-1value-functions))) (testcover-reinstrument (cadr form)))) - ((memq fun '(1value noreturn)) + ((eq fun '1value) ;;Hack - pretend the arg is 1-valued here - (if (symbolp (cadr form)) ;A pseudoconstant variable - t + (cond + ((symbolp (cadr form)) + ;;A pseudoconstant variable + t) + ((and (eq (car (cadr form)) 'edebug-after) + (symbolp (nth 3 (cadr form)))) + ;;Reference to pseudoconstant + (aset testcover-vector (nth 2 (cadr form)) '1value) + (setcar (cdr form) `(testcover-1value ,(nth 2 (cadr form)) + ,(nth 3 (cadr form)))) + t) + (t (if (eq (car (cadr form)) 'edebug-after) (setq id (car (nth 3 (cadr form)))) (setq id (car (cadr form)))) (let ((testcover-1value-functions (cons id testcover-1value-functions))) - (testcover-reinstrument (cadr form))))) + (testcover-reinstrument (cadr form)))))) + ((eq fun 'noreturn) + ;;Hack - pretend the arg has no return + (cond + ((symbolp (cadr form)) + ;;A pseudoconstant variable + 'maybe) + ((and (eq (car (cadr form)) 'edebug-after) + (symbolp (nth 3 (cadr form)))) + ;;Reference to pseudoconstant + (aset testcover-vector (nth 2 (cadr form)) '1value) + (setcar (cdr form) `(progn (testcover-after ,(nth 2 (cadr form)) nil) + ,(nth 3 (cadr form)))) + 'maybe) + (t + (if (eq (car (cadr form)) 'edebug-after) + (setq id (car (nth 3 (cadr form)))) + (setq id (car (cadr form)))) + (let ((testcover-noreturn-functions + (cons id testcover-noreturn-functions))) + (testcover-reinstrument (cadr form)))))) + ((and (eq fun 'apply) + (eq (car-safe (cadr form)) 'quote) + (symbolp (cadr (cadr form)))) + ;;Apply of a constant symbol. Process as 1value or noreturn + ;;depending on symbol. + (setq fun (cons (cadr (cadr form)) (cddr form)) + val (testcover-reinstrument fun)) + (setcdr (cdr form) (cdr fun)) + val) (t ;Some other function or weird thing (testcover-reinstrument-list (cdr form)) nil)))) @@ -341,13 +409,22 @@ always be nil, so we return t for 1-valued." (setq result (testcover-reinstrument (pop list)))) result)) -(defun testcover-reinstrument-clauses (clauselist) - "Reinstrument each list in CLAUSELIST. -Result is t if every clause is 1-valued." +(defun testcover-reinstrument-compose (list fun) + "For a compositional function, the result is 1-valued if all +arguments are, potentially 1-valued if all arguments are either +definitely or potentially 1-valued, and multi-valued otherwise. +FUN should be `testcover-reinstrument' for compositional functions, + `testcover-reinstrument-list' for clauses in a `cond'." (let ((result t)) (mapc #'(lambda (x) - (setq result (and (testcover-reinstrument-list x) result))) - clauselist) + (setq x (funcall fun x)) + (cond + ((eq result t) + (setq result x)) + ((eq result 'maybe) + (when (not x) + (setq result nil))))) + list) result)) (defun testcover-end (buffer) @@ -387,7 +464,7 @@ same value during coverage testing." (aset testcover-vector idx (cons '1value val))) ((not (and (eq (car-safe (aref testcover-vector idx)) '1value) (equal (cdr (aref testcover-vector idx)) val))) - (error "Value of form marked with `1value' does vary."))) + (error "Value of form marked with `1value' does vary: %s" val))) val) @@ -415,7 +492,7 @@ eliminated by adding more test cases." ov j item) (or (and def-mark points coverage) (error "Missing edebug data for function %s" def)) - (when len + (when (> len 0) (set-buffer (marker-buffer def-mark)) (mapc 'delete-overlay (overlays-in def-mark (+ def-mark (aref points (1- len)) 1))) From 07dfe73898a43069d9d85ef74978e3fc9509773a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20Gro=C3=9Fjohann?= Date: Sat, 17 Jul 2004 17:28:43 +0000 Subject: [PATCH 43/46] Sync with Tramp 2.0.43. (tramp-handle-verify-visited-file-modtime): Remove outdated comment. (tramp-locked, tramp-locker): New variables for implementing a global lock. (tramp-sh-file-name-handler): Use them to implement the global lock. --- lisp/ChangeLog | 39 +++++++++ lisp/net/tramp-smb.el | 2 +- lisp/net/tramp-vc.el | 18 ++-- lisp/net/tramp.el | 199 +++++++++++++++++++++++++----------------- man/trampver.texi | 2 +- 5 files changed, 170 insertions(+), 90 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cf0600b7605..f508879cb01 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,42 @@ +2004-07-17 Kai Grossjohann + + Sync with Tramp 2.0.43. + + * net/tramp.el (tramp-handle-verify-visited-file-modtime): Remove + outdated comment. + (tramp-locked, tramp-locker): New variables for implementing a + global lock. + (tramp-sh-file-name-handler): Use them to implement the global + lock. + +2004-07-13 Michael Albinus + + * net/tramp.el (all): Code cleanup. Change all `tramp-handle-xxx' + calls to respective `xxx` calls. + (tramp-process-alive-regexp): Precise doc string. + (tramp-multi-action-process-alive): New defun. + (tramp-multi-actions): Use it. + (tramp-handle-find-backup-file-name): `copy-tree' is available + since Emacs 21.4 only (XEmacs has it). Implementation rewritten + in order to avoid this function. + (tramp-handle-write-region): Set current buffer. If connection + wasn't open, `file-modes' has changed it accidently. Reported by + David Kastrup . + (tramp-enter-password, tramp-read-passwd): New arguments USER and + HOST. + (tramp-action-password, tramp-multi-action-password): Apply it. + (tramp-open-connection-rsh): If a port is given, the Tramp buffer + name must still contain the port number. Otherwise, we have two + Tramp buffers, with all the confusion. Reported by Myron Selby + and Rolf Dubitzky + . + + * net/tramp-smb.el (tramp-smb-open-connection): Apply USER and + HOST to `tramp-enter-passwd'. + + * net/tramp-vc.el (all): Code cleanup. Change all + `tramp-handle-xxx' calls to respective `xxx` calls. + 2004-07-17 Jonathan Yavner * emacs-lisp/testcover.el: New category "potentially-1valued" for diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index cca01d169b6..6a888d9d75d 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -1012,7 +1012,7 @@ Domain names in USER and port numbers in HOST are acknowledged." (when real-user (let ((pw-prompt "Password:")) (tramp-message 9 "Sending password") - (tramp-enter-password p pw-prompt))) + (tramp-enter-password p pw-prompt user host))) (unless (tramp-smb-wait-for-output user host) (tramp-clear-passwd user host) diff --git a/lisp/net/tramp-vc.el b/lisp/net/tramp-vc.el index 839a8702dd9..e720deb8f07 100644 --- a/lisp/net/tramp-vc.el +++ b/lisp/net/tramp-vc.el @@ -77,7 +77,7 @@ "Like `vc-do-command' but invoked for tramp files. See `vc-do-command' for more information." (save-match-data - (and file (setq file (tramp-handle-expand-file-name file))) + (and file (setq file (expand-file-name file))) (if (not buffer) (setq buffer "*vc*")) (if vc-command-messages (message "Running `%s' on `%s'..." command file)) @@ -85,7 +85,7 @@ See `vc-do-command' for more information." (squeezed nil) (olddir default-directory) vc-file status) - (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) + (let* ((v (tramp-dissect-file-name (expand-file-name file))) (multi-method (tramp-file-name-multi-method v)) (method (tramp-file-name-method v)) (user (tramp-file-name-user v)) @@ -130,7 +130,7 @@ See `vc-do-command' for more information." (save-excursion (save-window-excursion ;; Actually execute remote command - (tramp-handle-shell-command + (shell-command (mapconcat 'tramp-shell-quote-argument (cons command squeezed) " ") t) ;;(tramp-wait-for-output) @@ -190,7 +190,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either." (let ((w32-quote-process-args t)) (when (eq okstatus 'async) (message "Tramp doesn't do async commands, running synchronously.")) - (setq status (tramp-handle-shell-command + (setq status (shell-command (mapconcat 'tramp-shell-quote-argument (cons command squeezed) " ") t)) (when (or (not (integerp status)) @@ -257,7 +257,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either." ;; Don't switch to the *vc-info* buffer before running the ;; command, because that would change its default directory (save-match-data - (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) + (let* ((v (tramp-dissect-file-name (expand-file-name file))) (multi-method (tramp-file-name-multi-method v)) (method (tramp-file-name-method v)) (user (tramp-file-name-user v)) @@ -284,7 +284,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either." (save-excursion (save-window-excursion ;; Actually execute remote command - (tramp-handle-shell-command + (shell-command (mapconcat 'tramp-shell-quote-argument (append (list command) args (list localname)) " ") (get-buffer-create"*vc-info*")) @@ -414,7 +414,7 @@ filename we are thinking about..." (nth 2 (file-attributes file))))) (if (and uid (/= uid remote-uid)) (error "tramp-handle-vc-user-login-name cannot map a uid to a name") - (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) + (let* ((v (tramp-dissect-file-name (expand-file-name file))) (u (tramp-file-name-user v))) (cond ((stringp u) u) ((vectorp u) (elt u (1- (length u)))) @@ -445,8 +445,8 @@ filename we are thinking about..." (defun tramp-file-owner (filename) "Return who owns FILE (user name, as a string)." (let ((v (tramp-dissect-file-name - (tramp-handle-expand-file-name filename)))) - (if (not (tramp-handle-file-exists-p filename)) + (expand-file-name filename)))) + (if (not (file-exists-p filename)) nil ; file cannot be opened ;; file exists, find out stuff (save-excursion diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d9a8d14309a..7f04a948811 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -916,8 +916,8 @@ The answer will be provided by `tramp-action-terminal', which see." "Regular expression indicating a process has finished. In fact this expression is empty by intention, it will be used only to check regularly the status of the associated process. -The answer will be provided by `tramp-action-process-alive' and -`tramp-action-out-of-band', which see." +The answer will be provided by `tramp-action-process-alive', +`tramp-multi-action-process-alive' and`tramp-action-out-of-band', which see." :group 'tramp :type 'regexp) @@ -1321,7 +1321,7 @@ See `tramp-actions-before-shell' for more info." (shell-prompt-pattern tramp-multi-action-succeed) (tramp-shell-prompt-pattern tramp-multi-action-succeed) (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied) - (tramp-process-alive-regexp tramp-action-process-alive)) + (tramp-process-alive-regexp tramp-multi-action-process-alive)) "List of pattern/action pairs. This list is used for each hop in multi-hop connections. See `tramp-actions-before-shell' for more info." @@ -2165,7 +2165,7 @@ target of the symlink differ." (let ((nonnumeric (and id-format (equal id-format 'string))) result) (with-parsed-tramp-file-name filename nil - (when (tramp-handle-file-exists-p filename) + (when (file-exists-p filename) ;; file exists, find out stuff (save-excursion (if (tramp-get-remote-perl multi-method method user host) @@ -2509,19 +2509,19 @@ if the remote host can't provide the modtime." (defun tramp-handle-file-writable-p (filename) "Like `file-writable-p' for tramp files." (with-parsed-tramp-file-name filename nil - (if (tramp-handle-file-exists-p filename) + (if (file-exists-p filename) ;; Existing files must be writable. (zerop (tramp-run-test "-w" filename)) ;; If file doesn't exist, check if directory is writable. (and (zerop (tramp-run-test - "-d" (tramp-handle-file-name-directory filename))) + "-d" (file-name-directory filename))) (zerop (tramp-run-test - "-w" (tramp-handle-file-name-directory filename))))))) + "-w" (file-name-directory filename))))))) (defun tramp-handle-file-ownership-preserved-p (filename) "Like `file-ownership-preserved-p' for tramp files." (with-parsed-tramp-file-name filename nil - (or (not (tramp-handle-file-exists-p filename)) + (or (not (file-exists-p filename)) ;; Existing files must be writable. (zerop (tramp-run-test "-O" filename))))) @@ -3064,7 +3064,7 @@ This is like `dired-recursive-delete-directory' for tramp files." (with-parsed-tramp-file-name filename nil ;; run a shell command 'rm -r ' ;; Code shamelessly stolen for the dired implementation and, um, hacked :) - (or (tramp-handle-file-exists-p filename) + (or (file-exists-p filename) (signal 'file-error (list "Removing old file name" "no such directory" filename))) @@ -3075,7 +3075,7 @@ This is like `dired-recursive-delete-directory' for tramp files." ;; This might take a while, allow it plenty of time. (tramp-wait-for-output 120) ;; Make sure that it worked... - (and (tramp-handle-file-exists-p filename) + (and (file-exists-p filename) (error "Failed to recusively delete %s" filename)))) (defun tramp-handle-dired-call-process (program discard &rest arguments) @@ -3607,45 +3607,47 @@ This will break if COMMAND prints a newline, followed by the value of (defun tramp-handle-find-backup-file-name (filename) "Like `find-backup-file-name' for tramp files." + (with-parsed-tramp-file-name filename nil + ;; We set both variables. It doesn't matter whether it is + ;; Emacs or XEmacs + (let ((backup-directory-alist + ;; Emacs case + (when (boundp 'backup-directory-alist) + (if (boundp 'tramp-backup-directory-alist) + (mapcar + '(lambda (x) + (cons + (car x) + (if (and (stringp (cdr x)) + (file-name-absolute-p (cdr x)) + (not (tramp-file-name-p (cdr x)))) + (tramp-make-tramp-file-name + multi-method method user host (cdr x)) + (cdr x)))) + (symbol-value 'tramp-backup-directory-alist)) + (symbol-value 'backup-directory-alist)))) - (if (or (and (not (featurep 'xemacs)) - (not (boundp 'tramp-backup-directory-alist))) - (and (featurep 'xemacs) - (not (boundp 'tramp-bkup-backup-directory-info)))) + (bkup-backup-directory-info + ;; XEmacs case + (when (boundp 'bkup-backup-directory-info) + (if (boundp 'tramp-bkup-backup-directory-info) + (mapcar + '(lambda (x) + (nconc + (list (car x)) + (list + (if (and (stringp (car (cdr x))) + (file-name-absolute-p (car (cdr x))) + (not (tramp-file-name-p (car (cdr x))))) + (tramp-make-tramp-file-name + multi-method method user host (car (cdr x))) + (car (cdr x)))) + (cdr (cdr x)))) + (symbol-value 'tramp-bkup-backup-directory-info)) + (symbol-value 'bkup-backup-directory-info))))) - ;; No tramp backup directory alist defined, or nil - (tramp-run-real-handler 'find-backup-file-name (list filename)) + (tramp-run-real-handler 'find-backup-file-name (list filename))))) - (with-parsed-tramp-file-name filename nil - (let* ((backup-var - (copy-tree - (if (featurep 'xemacs) - ;; XEmacs case - (symbol-value 'tramp-bkup-backup-directory-info) - ;; Emacs case - (symbol-value 'tramp-backup-directory-alist)))) - - ;; We set both variables. It doesn't matter whether it is - ;; Emacs or XEmacs - (backup-directory-alist backup-var) - (bkup-backup-directory-info backup-var)) - - (mapcar - '(lambda (x) - (let ((dir (if (consp (cdr x)) (car (cdr x)) (cdr x)))) - (when (and (stringp dir) - (file-name-absolute-p dir) - (not (tramp-file-name-p dir))) - ;; Prepend absolute directory names with tramp prefix - (if (consp (cdr x)) - (setcar (cdr x) - (tramp-make-tramp-file-name - multi-method method user host dir)) - (setcdr x (tramp-make-tramp-file-name - multi-method method user host dir)))))) - backup-var) - - (tramp-run-real-handler 'find-backup-file-name (list filename)))))) ;; CCC grok APPEND, LOCKNAME, CONFIRM (defun tramp-handle-write-region @@ -3689,6 +3691,9 @@ This will break if COMMAND prints a newline, followed by the value of ;; use an encoding function, but currently we use it always ;; because this makes the logic simpler. (setq tmpfil (tramp-make-temp-file)) + ;; Set current buffer. If connection wasn't open, `file-modes' has + ;; changed it accidently. + (set-buffer curbuf) ;; We say `no-message' here because we don't want the visited file ;; modtime data to be clobbered from the temp file. We call ;; `set-visited-file-modtime' ourselves later on. @@ -3972,14 +3977,50 @@ Falls back to normal file name handler if no tramp file name handler exists." (foreign (apply foreign operation args)) (t (tramp-run-real-handler operation args)))))) + +;; In Emacs, there is some concurrency due to timers. If a timer +;; interrupts Tramp and wishes to use the same connection buffer as +;; the "main" Emacs, then garbage might occur in the connection +;; buffer. Therefore, we need to make sure that a timer does not use +;; the same connection buffer as the "main" Emacs. We implement a +;; cheap global lock, instead of locking each connection buffer +;; separately. The global lock is based on two variables, +;; `tramp-locked' and `tramp-locker'. `tramp-locked' is set to true +;; (with setq) to indicate a lock. But Tramp also calls itself during +;; processing of a single file operation, so we need to allow +;; recursive calls. That's where the `tramp-locker' variable comes in +;; -- it is let-bound to t during the execution of the current +;; handler. So if `tramp-locked' is t and `tramp-locker' is also t, +;; then we should just proceed because we have been called +;; recursively. But if `tramp-locker' is nil, then we are a timer +;; interrupting the "main" Emacs, and then we signal an error. + +(defvar tramp-locked nil + "If non-nil, then Tramp is currently busy. +Together with `tramp-locker', this implements a locking mechanism +preventing reentrant calls of Tramp.") + +(defvar tramp-locker nil + "If non-nil, then a caller has locked Tramp. +Together with `tramp-locked', this implements a locking mechanism +preventing reentrant calls of Tramp.") + (defun tramp-sh-file-name-handler (operation &rest args) "Invoke remote-shell Tramp file name handler. Fall back to normal file name handler if no Tramp handler exists." - (save-match-data - (let ((fn (assoc operation tramp-file-name-handler-alist))) - (if fn - (apply (cdr fn) args) - (tramp-run-real-handler operation args))))) + (when (and tramp-locked (not tramp-locker)) + (signal 'file-error "Forbidden reentrant call of Tramp")) + (let ((tl tramp-locked)) + (unwind-protect + (progn + (setq tramp-locked t) + (let ((tramp-locker t)) + (save-match-data + (let ((fn (assoc operation tramp-file-name-handler-alist))) + (if fn + (apply (cdr fn) args) + (tramp-run-real-handler operation args)))))) + (setq tramp-locked tl)))) ;;;###autoload (defun tramp-completion-file-name-handler (operation &rest args) @@ -4062,7 +4103,7 @@ necessary anymore." (tramp-make-tramp-file-name multi-method method user host x))) (read (current-buffer)))))) - (list (tramp-handle-expand-file-name name)))))) + (list (expand-file-name name)))))) ;; Check for complete.el and override PC-expand-many-files if appropriate. (eval-and-compile @@ -4073,7 +4114,7 @@ necessary anymore." (symbol-function 'PC-expand-many-files)) (defun PC-expand-many-files (name) (if (tramp-tramp-file-p name) - (tramp-handle-expand-many-files name) + (expand-many-files name) (tramp-save-PC-expand-many-files name)))) ;; Why isn't eval-after-load sufficient? @@ -4824,17 +4865,17 @@ file exists and nonzero exit status otherwise." ;; `/usr/bin/test -e' In case `/bin/test' does not exist. (unless (or (and (setq tramp-file-exists-command "test -e %s") - (tramp-handle-file-exists-p existing) - (not (tramp-handle-file-exists-p nonexisting))) + (file-exists-p existing) + (not (file-exists-p nonexisting))) (and (setq tramp-file-exists-command "/bin/test -e %s") - (tramp-handle-file-exists-p existing) - (not (tramp-handle-file-exists-p nonexisting))) + (file-exists-p existing) + (not (file-exists-p nonexisting))) (and (setq tramp-file-exists-command "/usr/bin/test -e %s") - (tramp-handle-file-exists-p existing) - (not (tramp-handle-file-exists-p nonexisting))) + (file-exists-p existing) + (not (file-exists-p nonexisting))) (and (setq tramp-file-exists-command "ls -d %s") - (tramp-handle-file-exists-p existing) - (not (tramp-handle-file-exists-p nonexisting)))) + (file-exists-p existing) + (not (file-exists-p nonexisting)))) (error "Couldn't find command to check if file exists.")))) @@ -4896,9 +4937,8 @@ file exists and nonzero exit status otherwise." METHOD, USER and HOST specify the connection, CMD (the absolute file name of) the `ls' executable. Returns t if CMD supports the `-n' option, nil otherwise." - (tramp-message 9 "Checking remote `%s' command for `-n' option" - cmd) - (when (tramp-handle-file-executable-p + (tramp-message 9 "Checking remote `%s' command for `-n' option" cmd) + (when (file-executable-p (tramp-make-tramp-file-name multi-method method user host cmd)) (let ((result nil)) (tramp-message 7 "Testing remote command `%s' for -n..." cmd) @@ -4956,7 +4996,7 @@ Returns nil if none was found, else the command is returned." "Query the user for a password." (let ((pw-prompt (match-string 0))) (tramp-message 9 "Sending password") - (tramp-enter-password p pw-prompt))) + (tramp-enter-password p pw-prompt user host))) (defun tramp-action-succeed (p multi-method method user host) "Signal success in finding shell prompt." @@ -5034,7 +5074,7 @@ The terminal type can be configured with `tramp-terminal-type'." (defun tramp-multi-action-password (p method user host) "Query the user for a password." (tramp-message 9 "Sending password") - (tramp-enter-password p (match-string 0))) + (tramp-enter-password p (match-string 0) user host)) (defun tramp-multi-action-succeed (p method user host) "Signal success in finding shell prompt." @@ -5049,6 +5089,11 @@ The terminal type can be configured with `tramp-terminal-type'." (erase-buffer) (throw 'tramp-action 'permission-denied)) +(defun tramp-multi-action-process-alive (p method user host) + "Check whether a process has finished." + (unless (memq (process-status p) '(run open)) + (throw 'tramp-action 'process-died))) + ;; Functions for processing the actions. (defun tramp-process-one-action (p multi-method method user host actions) @@ -5246,12 +5291,13 @@ arguments, and xx will be used as the host name to connect to. (login-args (tramp-get-method-parameter multi-method (tramp-find-method multi-method method user host) - user host 'tramp-login-args))) + user host 'tramp-login-args)) + (real-host host)) ;; The following should be changed. We need a more general ;; mechanism to parse extra host args. (when (string-match "\\([^#]*\\)#\\(.*\\)" host) (setq login-args (cons "-p" (cons (match-string 2 host) login-args))) - (setq host (match-string 1 host))) + (setq real-host (match-string 1 host))) (setenv "TERM" tramp-terminal-type) (let* ((default-directory (tramp-temporary-file-directory)) ;; If we omit the conditional, we would use @@ -5262,9 +5308,9 @@ arguments, and xx will be used as the host name to connect to. tramp-dos-coding-system)) (p (if (and user (not (string= user ""))) (apply #'start-process bufnam buf login-program - host "-l" user login-args) + real-host "-l" user login-args) (apply #'start-process bufnam buf login-program - host login-args))) + real-host login-args))) (found nil)) (tramp-set-process-query-on-exit-flag p nil) @@ -5547,10 +5593,10 @@ seconds. If not, it produces an error message with the given ERROR-ARGS." (pop-to-buffer (buffer-name)) (apply 'error error-args))) -(defun tramp-enter-password (p prompt) +(defun tramp-enter-password (p prompt user host) "Prompt for a password and send it to the remote end. Uses PROMPT as a prompt and sends the password to process P." - (let ((pw (tramp-read-passwd prompt))) + (let ((pw (tramp-read-passwd user host prompt))) (erase-buffer) (process-send-string p (concat pw @@ -6717,16 +6763,11 @@ this is the function `temp-directory'." "`temp-directory' is defined -- using /tmp.")) (file-name-as-directory "/tmp")))) -(defun tramp-read-passwd (prompt) +(defun tramp-read-passwd (user host prompt) "Read a password from user (compat function). Invokes `password-read' if available, `read-passwd' else." (if (functionp 'password-read) - (let* ((user (or tramp-current-user (user-login-name))) - (host (or tramp-current-host (system-name))) - (key (if (and (stringp user) (stringp host)) - (concat user "@" host) - (concat "[" (mapconcat 'identity user "/") "]@[" - (mapconcat 'identity host "/") "]"))) + (let* ((key (concat (or user (user-login-name)) "@" host)) (password (apply #'password-read (list prompt key)))) (apply #'password-cache-add (list key password)) password) diff --git a/man/trampver.texi b/man/trampver.texi index a62583fd6d4..32ab2349241 100644 --- a/man/trampver.texi +++ b/man/trampver.texi @@ -4,7 +4,7 @@ @c In the Tramp CVS, the version number is auto-frobbed from @c configure.ac, so you should edit that file and run @c "autoconf && ./configure" to change the version number. -@set trampver 2.0.42 +@set trampver 2.0.43 @c Other flags from configuration @set prefix /usr/local From 26503ad20330065c10629a61b79bcfa3bfb6fec3 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sat, 17 Jul 2004 17:33:05 +0000 Subject: [PATCH 44/46] (not_single_kboard_state): Do nothing unless MULTI_KBOARD is defined. --- src/ChangeLog | 5 +++++ src/keyboard.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 253b3ce806f..9765ec9403c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-07-17 Juanma Barranquero + + * keyboard.c (not_single_kboard_state): Do nothing unless + MULTI_KBOARD is defined. + 2004-07-17 Richard M. Stallman * window.c (coordinates_in_window): Inside the window but outside diff --git a/src/keyboard.c b/src/keyboard.c index aa2bdbddf5a..de6356987b8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1096,8 +1096,10 @@ void not_single_kboard_state (kboard) KBOARD *kboard; { +#ifdef MULTI_KBOARD if (kboard == current_kboard) single_kboard = 0; +#endif } /* Maintain a stack of kboards, so other parts of Emacs @@ -10203,7 +10205,7 @@ stuff_buffered_input (stuffstring) /* Anything we have read ahead, put back for the shell to read. */ /* ?? What should this do when we have multiple keyboards?? Should we ignore anything that was typed in at the "wrong" kboard? - + rms: we should stuff everything back into the kboard it came from. */ for (; kbd_fetch_ptr != kbd_store_ptr; kbd_fetch_ptr++) From 2d677766573bcf9a4fd97c195d595383d99c7d9c Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Sat, 17 Jul 2004 20:55:57 +0000 Subject: [PATCH 45/46] Describe `Auto Revert Tail Mode' in `Commentary' section. (auto-revert-handler): Do not check `auto-revert-tail-mode' for non-file buffers. We know it is nil. --- lisp/ChangeLog | 11 +++++++++-- lisp/autorevert.el | 12 ++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f508879cb01..1877f9c0281 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2004-07-17 Luc Teirlinck + + * autorevert.el: Describe `Auto Revert Tail Mode' in `Commentary' + section. + (auto-revert-handler): Do not check `auto-revert-tail-mode' for + non-file buffers. We know it is nil. + 2004-07-17 Kai Grossjohann Sync with Tramp 2.0.43. @@ -8,7 +15,7 @@ global lock. (tramp-sh-file-name-handler): Use them to implement the global lock. - + 2004-07-13 Michael Albinus * net/tramp.el (all): Code cleanup. Change all `tramp-handle-xxx' @@ -36,7 +43,7 @@ * net/tramp-vc.el (all): Code cleanup. Change all `tramp-handle-xxx' calls to respective `xxx` calls. - + 2004-07-17 Jonathan Yavner * emacs-lisp/testcover.el: New category "potentially-1valued" for diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 596c7ff8997..ef438eb4b97 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -34,7 +34,8 @@ ;; ;; This package contains two minor modes: Global Auto-Revert Mode and ;; Auto-Revert Mode. Both modes automatically revert buffers -;; whenever the corresponding files have been changed on disk. +;; whenever the corresponding files have been changed on disk and the +;; buffer contains no unsaved changes. ;; ;; Auto-Revert Mode can be activated for individual buffers. Global ;; Auto-Revert Mode applies to all file buffers. (If the user option @@ -59,6 +60,13 @@ ;; Just put point at the end of the buffer and it will stay there. ;; These rules apply to file buffers. For non-file buffers, the ;; behavior may be mode dependent. +;; +;; While you can use Auto Revert Mode to tail a file, this package +;; contains a third minor mode, Auto Revert Tail Mode, which does so +;; more efficiently, as long as you are sure that the file will only +;; change by growing at the end. It only appends the new output, +;; instead of reverting the entire buffer. It does so even if the +;; buffer contains unsaved changes. (Because they will not be lost.) ;; Usage: ;; @@ -389,7 +397,7 @@ This is an internal function used by Auto-Revert Mode." (not (file-remote-p buffer-file-name)) (file-readable-p buffer-file-name) (not (verify-visited-file-modtime buffer))) - (and (or auto-revert-mode auto-revert-tail-mode + (and (or auto-revert-mode global-auto-revert-non-file-buffers) revert-buffer-function (boundp 'buffer-stale-function) From cdfa3eccb179fe579a5e38949d0a2ad3d2757524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20Gro=C3=9Fjohann?= Date: Sat, 17 Jul 2004 21:33:32 +0000 Subject: [PATCH 46/46] (tramp-handle-verify-visited-file-modtime): New docstring. From Luc Teirlinck. --- lisp/ChangeLog | 5 +++++ lisp/net/tramp.el | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1877f9c0281..876646163e3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2004-07-17 Kai Grossjohann + + * net/tramp.el (tramp-handle-verify-visited-file-modtime): New + docstring. From Luc Teirlinck. + 2004-07-17 Luc Teirlinck * autorevert.el: Describe `Auto Revert Tail Mode' in `Commentary' diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 7f04a948811..02b076483c1 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2331,7 +2331,12 @@ If it doesn't exist, generate a new one." ;; This function makes the same assumption as ;; `tramp-handle-set-visited-file-modtime'. (defun tramp-handle-verify-visited-file-modtime (buf) - "Like `verify-visited-file-modtime' for tramp files." + "Like `verify-visited-file-modtime' for tramp files. +At the time `verify-visited-file-modtime' calls this function, we +already know that the buffer is visiting a file and that +`visited-file-modtime' does not return 0. Do not call this +function directly, unless those two cases are already taken care +of." (with-current-buffer buf (let ((f (buffer-file-name))) (with-parsed-tramp-file-name f nil