From 4b320a0146c7c068079b756624579eef6580b503 Mon Sep 17 00:00:00 2001 From: Yuri Karaban Date: Fri, 19 Nov 2010 11:25:09 -0500 Subject: [PATCH 01/30] * pop3.el (pop3-open-server): Read server greeting before starting TLS negotiation. --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/pop3.el | 21 +++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index e6024b3e95e..7350cf97f50 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2010-11-19 Yuri Karaban (tiny change) + + * pop3.el (pop3-open-server): Read server greeting before starting TLS + negotiation. + 2010-10-12 Juanma Barranquero * nnmail.el (nnmail-fancy-expiry-targets): Fix typo in docstring. diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el index b3012b4b198..b445b8979ea 100644 --- a/lisp/gnus/pop3.el +++ b/lisp/gnus/pop3.el @@ -259,21 +259,22 @@ Returns the process associated with the connection." ;; gnutls-cli, openssl don't accept service names (if (equal port "pop3") (setq port 110)) - (let ((process (starttls-open-stream "POP" (current-buffer) - mailhost (or port 110)))) - (pop3-send-command process "STLS") - (let ((response (pop3-read-response process t))) - (if (and response (string-match "+OK" response)) - (starttls-negotiate process) - (pop3-quit process) - (error "POP server doesn't support starttls"))) - process)) - (t + ;; Delay STLS until server greeting is read (Bug#7438). + (starttls-open-stream "POP" (current-buffer) + mailhost (or port 110))) + (t (open-network-stream "POP" (current-buffer) mailhost port)))) (let ((response (pop3-read-response process t))) (setq pop3-timestamp (substring response (or (string-match "<" response) 0) (+ 1 (or (string-match ">" response) -1))))) + (when (eq pop3-stream-type 'starttls) + (pop3-send-command process "STLS") + (let ((response (pop3-read-response process t))) + (if (and response (string-match "+OK" response)) + (starttls-negotiate process) + (pop3-quit process) + (error "POP server doesn't support starttls")))) process))) ;; Support functions From 8d7f026f625a02854b3214f7a54e778121d266bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Sat, 20 Nov 2010 14:50:55 +0100 Subject: [PATCH 02/30] Fix bug 7425. NOTE: When merging to trunk: xg_height_changed is xg_height_or_width_changed in trunk. * src/gtkutil.c (menubar_map_cb): New function. (xg_update_frame_menubar): Connect signal map to menubar_map_cb. Use 23 as menubar height if 0. (Bug#7425). --- src/ChangeLog | 6 ++++++ src/gtkutil.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6268dcf33ae..4655ea714ad 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-20 Jan Djärv + + * gtkutil.c (menubar_map_cb): New function (Bug#7425). + (xg_update_frame_menubar): Connect signal map to menubar_map_cb. + Use 23 as menubar height if 0. (Bug#7425). + 2010-11-14 Jan Djärv * xsettings.c (init_gconf): Check HAVE_G_TYPE_INIT. diff --git a/src/gtkutil.c b/src/gtkutil.c index 7a25bbb1e3f..7102823a814 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -2936,6 +2936,23 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p, gtk_widget_show_all (menubar); } +/* Callback called when the menu bar W is mapped. + Used to find the height of the menu bar if we didn't get it + after showing the widget. */ + +static void +menubar_map_cb (GtkWidget *w, gpointer user_data) +{ + GtkRequisition req; + FRAME_PTR f = (FRAME_PTR) user_data; + gtk_widget_size_request (w, &req); + if (FRAME_MENUBAR_HEIGHT (f) != req.height) + { + FRAME_MENUBAR_HEIGHT (f) = req.height; + xg_height_changed (f); + } +} + /* Recompute all the widgets of frame F, when the menu bar has been changed. Value is non-zero if widgets were updated. */ @@ -2958,10 +2975,19 @@ xg_update_frame_menubar (f) FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0); + g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f); gtk_widget_show_all (x->menubar_widget); gtk_widget_size_request (x->menubar_widget, &req); - FRAME_MENUBAR_HEIGHT (f) = req.height; - xg_height_changed (f); + /* If menu bar doesn't know its height yet, cheat a little so the frame + doesn't jump so much when resized later in menubar_map_cb. */ + if (req.height == 0) + req.height = 23; + + if (FRAME_MENUBAR_HEIGHT (f) != req.height) + { + FRAME_MENUBAR_HEIGHT (f) = req.height; + xg_height_changed (f); + } UNBLOCK_INPUT; return 1; From ec8a6295a0e4554f2ce8164ff3fe5e2910810d0d Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 20 Nov 2010 14:52:20 -0500 Subject: [PATCH 03/30] Document some Emacs 23.3 changes in manuals. * doc/emacs/macos.texi (Mac / GNUstep Basics): Document ns-right-alternate-modifier. * doc/lispref/numbers.texi (Float Basics): Document float-e and float-pi. * doc/lispref/symbols.texi (Creating Symbols): Using unintern without an obarray arg is now obsolete. * doc/lispref/text.texi (Kill Functions, Kill Functions) (Low-Level Kill Ring, Low-Level Kill Ring): Remove obsolete YANK-HANDLER args. * doc/lispref/variables.texi (Defining Variables): Change "pi" example to "float-pi". --- doc/emacs/ChangeLog | 5 +++ doc/emacs/macos.texi | 85 ++++++++++++++++---------------------- doc/lispref/ChangeLog | 14 +++++++ doc/lispref/numbers.texi | 8 ++++ doc/lispref/symbols.texi | 2 +- doc/lispref/text.texi | 25 ++--------- doc/lispref/variables.texi | 18 ++++---- etc/NEWS | 23 ++++++++--- 8 files changed, 95 insertions(+), 85 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 18819f858fd..c2752dd3a47 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2010-11-20 Chong Yidong + + * macos.texi (Mac / GNUstep Basics): Document + ns-right-alternate-modifier. + 2010-11-06 Eli Zaretskii * msdog.texi (Windows HOME): Add information regarding startup diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi index 6fa5666ba6f..044a722a07a 100644 --- a/doc/emacs/macos.texi +++ b/doc/emacs/macos.texi @@ -8,23 +8,22 @@ @cindex Macintosh @cindex GNUstep - This section briefly describes the peculiarities of using Emacs built with -the GNUstep libraries on GNU/Linux or other operating systems, or on Mac OS X -with native window system support. For Mac OS X, Emacs can be built either -without window system support, with X11, or with the Cocoa interface. This -section only applies to the Cocoa build. Emacs 23 does not support Mac OS -Classic. + This section describes the peculiarities of using Emacs built with +the GNUstep libraries on GNU/Linux or other operating systems, or on +Mac OS X with native window system support. On Mac OS X, Emacs can be +built either without window system support, with X11, or with the +Cocoa interface; this section only applies to the Cocoa build. Emacs +does not support earlier versions of Mac OS. - Emacs, when built on Mac OS X, uses the Cocoa application interface. For -various historical and technical reasons, Emacs uses the term @samp{Nextstep} -internally, instead of ``Cocoa'' or ``Mac OS X''; for instance, most of the -commands and variables described in the following sections begin with -@samp{ns-}, which is short for @samp{Nextstep}. NeXTstep was an application -interface released by NeXT Inc during the 1980s, of which Cocoa is a direct -descendant. Apart from Cocoa, there is another NeXTstep-style system: -GNUstep, which is free software. As of this writing, the GNUstep support is -alpha status (@pxref{GNUstep Support}), but we hope to improve it in the -future. + For various historical and technical reasons, Emacs uses the term +@samp{Nextstep} internally, instead of ``Cocoa'' or ``Mac OS X''; for +instance, most of the commands and variables described in this section +begin with @samp{ns-}, which is short for @samp{Nextstep}. NeXTstep +was an application interface released by NeXT Inc during the 1980s, of +which Cocoa is a direct descendant. Apart from Cocoa, there is +another NeXTstep-style system: GNUstep, which is free software. As of +this writing, the GNUstep support is alpha status (@pxref{GNUstep +Support}), but we hope to improve it in the future. @menu * Mac / GNUstep Basics:: Basic Emacs usage under GNUstep or Mac OS. @@ -37,19 +36,24 @@ future. @section Basic Emacs usage under Mac OS and GNUstep By default, the @key{alt} and @key{option} keys are the same as -@key{Meta} when running under Mac OS. The Mac @key{Cmd} key is the -same as @key{Super}, and Emacs provides a set of keybindings using -this modifier key that mimic other Mac / GNUstep applications (@pxref{Mac / -GNUstep Events}). You can change these bindings in the usual way (@pxref{Key -Bindings}). +@key{Meta}. The Mac @key{Cmd} key is the same as @key{Super}, and +Emacs provides a set of keybindings using this modifier key that mimic +other Mac / GNUstep applications (@pxref{Mac / GNUstep Events}). You +can change these bindings in the usual way (@pxref{Key Bindings}). - The standard Mac / GNUstep font and color panels are accessible via Lisp commands. - To use the color panel, drag from it to an Emacs frame to change the -foreground color of the face at that position (if the @key{shift} key -is held down, it changes the background color instead). To discard the -settings, create a new frame and close the altered one. -@c [unclear if the following holds.] -@c To finalize the settings for either color or font, choose @samp{Save Options} in the @samp{Options} menu. + The variable @code{ns-right-alternate-modifier} controls the +behavior of the right @key{alt} and @key{option} keys. These keys +behave like the left-hand keys if the value is @code{left} (the +default). A value of @code{control}, @code{meta}, @code{alt}, +@code{super}, or @code{hyper} makes them behave like the corresponding +modifier keys; a value of @code{none} tells Emacs to ignore them. + + The standard Mac / GNUstep font and color panels are accessible via +Lisp commands. To use the color panel, drag from it to an Emacs frame +to change the foreground color of the face at that position (if the +@key{shift} key is held down, it changes the background color +instead). To discard the settings, create a new frame and close the +altered one. @key{S-Mouse-1} (i.e., clicking the left mouse button while holding down the @key{Shift} key) adjusts the region to the @@ -58,7 +62,7 @@ it does not pop up a menu for changing the default face, as @key{S-Mouse-1} normally does (@pxref{Temporary Face Changes}). This change makes Emacs behave more like other Mac / GNUstep applications. - When you open or save files using the menus, or using the + When you open or save files using the menus, or using the @key{Cmd-o} and @key{Cmd-S} bindings, Emacs uses graphical file dialogs to read file names. However, if you use the regular Emacs key sequences, such as @key{C-x C-f}, Emacs uses the minibuffer to read @@ -110,7 +114,7 @@ dragging will alter the foreground color. Shift dragging will alter the background color. @c To make the changes permanent select the "Save Options" -@c item in the "Options" menu, or run @code{menu-bar-options-save}. +@c item in the "Options" menu, or run @code{menu-bar-options-save}. Useful in this context is the listing of all faces obtained by @key{M-x} @code{list-faces-display}. @@ -193,7 +197,7 @@ font are stored in the variables @code{ns-input-font} and @code{ns-input-fontsize}, respectively. @item ns-power-off -This event occurs when the user logs out and Emacs is still running, or when +This event occurs when the user logs out and Emacs is still running, or when `Quit Emacs' is chosen from the application menu. The default behavior is to save all file-visiting buffers. @end table @@ -208,26 +212,9 @@ and return the result as a string. You can also use the Lisp function services and receive the results back. Note that you may need to restart Emacs to access newly-available services. - @node GNUstep Support, , Mac / GNUstep Events, Mac OS / GNUstep @section GNUstep Support -Emacs can be built and run under GNUstep, however there are still some +Emacs can be built and run under GNUstep, but there are still some issues to be addressed. Interested developers should contact @email{emacs-devel@@gnu.org}. - -@c Presumably no longer relevant since CANNOT_DUMP removed 2009-05-06: -@ignore -In particular, it may be necessary to run @samp{make bootstrap} with a -plain X configuration, then @samp{make clean} and @samp{./configure ---with-ns} followed by @samp{make install}. - -Currently CANNOT_DUMP is automatically enabled in GNUstep configurations, -because the unex file(s) for GNUstep, mainly @samp{unexelf.c}, have not been -updated yet with the ``zone'' code in and related to @samp{unexmacosx.c}. -@end ignore - - -@ignore - arch-tag: a822c2ab-4273-4997-927e-c153bb71dcf6 -@end ignore diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 79d6f71c1b4..2ea15fe3ca8 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,17 @@ +2010-11-20 Chong Yidong + + * text.texi (Kill Functions, Kill Functions) + (Low-Level Kill Ring, Low-Level Kill Ring): Remove obsolete + YANK-HANDLER args. + + * symbols.texi (Creating Symbols): Using unintern without an + obarray arg is now obsolete. + + * numbers.texi (Float Basics): Document float-e and float-pi. + + * variables.texi (Defining Variables): Change "pi" example to + "float-pi". + 2010-11-12 Eli Zaretskii * customize.texi (Composite Types): Lower-case index entry. diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index 62b4796350e..e83da348e05 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi @@ -224,6 +224,14 @@ down to an integer. @end example @end defun +@defvar float-e +The mathematical constant @math{e} (2.71828@dots{}). +@end defvar + +@defvar float-pi +The mathematical constant @math{pi} (3.14159@dots{}). +@end defvar + @node Predicates on Numbers @section Type Predicates for Numbers @cindex predicates for numbers diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index 5bb44ff9675..ccf90e33cd0 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -383,7 +383,7 @@ See @code{documentation} in @ref{Accessing Documentation}, for another example using @code{mapatoms}. @end defun -@defun unintern symbol &optional obarray +@defun unintern symbol obarray This function deletes @var{symbol} from the obarray @var{obarray}. If @code{symbol} is not actually in the obarray, @code{unintern} does nothing. If @var{obarray} is @code{nil}, the current obarray is used. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 2510607475b..025bf1b6f85 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -865,7 +865,7 @@ adds it to the most recent element. It determines automatically (using @code{last-command}) whether the previous command was a kill command, and if so appends the killed text to the most recent entry. -@deffn Command kill-region start end &optional yank-handler +@deffn Command kill-region start end This function kills the text in the region defined by @var{start} and @var{end}. The text is deleted but saved in the kill ring, along with its text properties. The value is always @code{nil}. @@ -873,17 +873,10 @@ its text properties. The value is always @code{nil}. In an interactive call, @var{start} and @var{end} are point and the mark. -@c Emacs 19 feature If the buffer or text is read-only, @code{kill-region} modifies the kill ring just the same, then signals an error without modifying the buffer. This is convenient because it lets the user use a series of kill commands to copy text from a read-only buffer into the kill ring. - -If @var{yank-handler} is non-@code{nil}, this puts that value onto -the string of killed text, as a @code{yank-handler} text property. -@xref{Yanking}. Note that if @var{yank-handler} is @code{nil}, any -@code{yank-handler} properties present on the killed text are copied -onto the kill ring, like other text properties. @end deffn @defopt kill-read-only-ok @@ -1068,7 +1061,7 @@ it returns the entry pointed at by the yanking pointer and does not move the yanking pointer. @end defun -@defun kill-new string &optional replace yank-handler +@defun kill-new string &optional replace This function pushes the text @var{string} onto the kill ring and makes the yanking pointer point to it. It discards the oldest entry if appropriate. It also invokes the value of @@ -1077,25 +1070,15 @@ if appropriate. It also invokes the value of If @var{replace} is non-@code{nil}, then @code{kill-new} replaces the first element of the kill ring with @var{string}, rather than pushing @var{string} onto the kill ring. - -If @var{yank-handler} is non-@code{nil}, this puts that value onto -the string of killed text, as a @code{yank-handler} property. -@xref{Yanking}. Note that if @var{yank-handler} is @code{nil}, then -@code{kill-new} copies any @code{yank-handler} properties present on -@var{string} onto the kill ring, as it does with other text properties. @end defun -@defun kill-append string before-p &optional yank-handler +@defun kill-append string before-p This function appends the text @var{string} to the first entry in the kill ring and makes the yanking pointer point to the combined entry. Normally @var{string} goes at the end of the entry, but if @var{before-p} is non-@code{nil}, it goes at the beginning. This function also invokes the value of @code{interprogram-cut-function} -(see below). This handles @var{yank-handler} just like -@code{kill-new}, except that if @var{yank-handler} is different from -the @code{yank-handler} property of the first entry of the kill ring, -@code{kill-append} pushes the concatenated string onto the kill ring, -instead of replacing the original first entry with it. +(see below). @end defun @defvar interprogram-paste-function diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index a3a550868f5..20fe4dbc9fa 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -544,21 +544,23 @@ not the buffer-local value. (But you should not be making buffer-local bindings for a symbol that is defined with @code{defconst}.) -Here, @code{pi} is a constant that presumably ought not to be changed -by anyone (attempts by the Indiana State Legislature notwithstanding). -As the second form illustrates, however, this is only advisory. +An example of the use of @code{defconst} is Emacs' definition of +@code{float-pi}---the mathematical constant @math{pi}, which ought not +to be changed by anyone (attempts by the Indiana State Legislature +notwithstanding). As the second form illustrates, however, +@code{defconst} is only advisory. @example @group -(defconst pi 3.1415 "Pi to five places.") - @result{} pi +(defconst float-pi 3.141592653589793 "The value of Pi.") + @result{} float-pi @end group @group -(setq pi 3) - @result{} pi +(setq float-pi 3) + @result{} float-pi @end group @group -pi +float-pi @result{} 3 @end group @end example diff --git a/etc/NEWS b/etc/NEWS index eb765f37373..59b63440775 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -26,9 +26,6 @@ used on x86-64 and s390x GNU/Linux architectures. * Changes in Emacs 23.3 -** The nextstep port can have different modifiers for the left and right -alt/option key by customizing the value for ns-right-alternate-modifier. - * Editing Changes in Emacs 23.3 @@ -82,10 +79,12 @@ produce an up to date diff. * New Modes and Packages in Emacs 23.3 + ** smie.el is a generic navigation and indentation engine. It takes a simple BNF description of the grammar, and provides both sexp-style navigation (jumping over begin..end pairs) as well as indentation, which can be adjusted via ad-hoc indentation rules. + * Incompatible Lisp Changes in Emacs 23.3 @@ -96,16 +95,28 @@ starting from the first line of text below the header line. * Lisp changes in Emacs 23.3 ++++ ** `e' and `pi' are now called `float-e' and `float-pi'. The old names are obsolete. -** The use of unintern without an obarray arg is declared obsolete. -** The function `princ-list' is declared obsolete. -** The yank-handler argument to kill-region and friends is declared obsolete. + ++++ +** The use of unintern without an obarray arg is now obsolete. + +--- +** The function `princ-list' is now obsolete. + ++++ +** The yank-handler argument to kill-region and friends is now obsolete. + ** New function byte-to-string, like char-to-string but for bytes. * Changes in Emacs 23.3 on non-free operating systems ++++ +** The nextstep port can have different modifiers for the left and right +alt/option key by customizing the value for ns-right-alternate-modifier. + * Installation Changes in Emacs 23.2 From 76dabd3729b43a7165dea82b92afc641078af881 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 20 Nov 2010 15:23:26 -0500 Subject: [PATCH 04/30] Prompt before running print commands. * lpr.el (lpr-buffer, print-buffer, lpr-region, print-region): Prompt user before actually printing. --- lisp/ChangeLog | 8 +++++++- lisp/lpr.el | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4fb7c84f3c3..0f0308be41b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,13 @@ +2010-11-20 Chong Yidong + + * lpr.el (lpr-buffer, print-buffer, lpr-region, print-region): + Prompt user before actually printing. + 2010-11-18 Stefan Monnier * simple.el (kill-new, kill-append, kill-region): - * comint.el (comint-kill-region): Make the yank-handler argument obsolete. + * comint.el (comint-kill-region): Make the yank-handler argument + obsolete. 2010-11-17 Stefan Monnier diff --git a/lisp/lpr.el b/lisp/lpr.el index 51b68c1ab48..812db4c2630 100644 --- a/lisp/lpr.el +++ b/lisp/lpr.el @@ -152,7 +152,9 @@ The variable `lpr-page-header-program' specifies the program to use." "Print buffer contents without pagination or page headers. See the variables `lpr-switches' and `lpr-command' for customization of the printer command." - (interactive) + (interactive + (unless (y-or-n-p "Send current buffer to default printer? ") + (error "Cancelled"))) (print-region-1 (point-min) (point-max) lpr-switches nil)) ;;;###autoload @@ -169,7 +171,9 @@ in the print command itself; we expect them to request pagination. See the variables `lpr-switches' and `lpr-command' for further customization of the printer command." - (interactive) + (interactive + (unless (y-or-n-p "Send current buffer to default printer? ") + (error "Cancelled"))) (print-region-1 (point-min) (point-max) lpr-switches t)) ;;;###autoload @@ -177,7 +181,10 @@ for further customization of the printer command." "Print region contents without pagination or page headers. See the variables `lpr-switches' and `lpr-command' for customization of the printer command." - (interactive "r") + (interactive + (if (y-or-n-p "Send selected text to default printer? ") + (list (region-beginning) (region-end)) + (error "Cancelled"))) (print-region-1 start end lpr-switches nil)) ;;;###autoload @@ -194,7 +201,10 @@ in the print command itself; we expect them to request pagination. See the variables `lpr-switches' and `lpr-command' for further customization of the printer command." - (interactive "r") + (interactive + (if (y-or-n-p "Send selected text to default printer? ") + (list (region-beginning) (region-end)) + (error "Cancelled"))) (print-region-1 start end lpr-switches t)) (defun print-region-1 (start end switches page-headers) From 1aaae3f39e02d2190dc59c2b56e1c0356863730c Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 20 Nov 2010 18:16:10 -0500 Subject: [PATCH 05/30] Document VC headers and other VC changes. * maintaining.texi (Version Control): Say "commit", not "check in". (Version Control Systems): Simplify descriptions. (VCS Merging, VCS Changesets, VCS Repositories): New nodes, split from VCS Concepts. (VC Mode Line): Update example. (Old Revisions): Document revert-buffer for vc-diff. (Log Buffer): Promote to a subsection. Document header lines. * emacs.texi (Top): Update node listing. --- doc/emacs/ChangeLog | 10 ++ doc/emacs/emacs.texi | 5 +- doc/emacs/maintaining.texi | 351 +++++++++++++++++++------------------ etc/NEWS | 38 ++-- 4 files changed, 215 insertions(+), 189 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index c2752dd3a47..7dba095b250 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,8 +1,18 @@ 2010-11-20 Chong Yidong + * maintaining.texi (Version Control): Say "commit", not "check in". + (Version Control Systems): Simplify descriptions. + (VCS Merging, VCS Changesets, VCS Repositories): New nodes, split from + VCS Concepts. + (VC Mode Line): Update example. + (Old Revisions): Document revert-buffer for vc-diff. + (Log Buffer): Promote to a subsection. Document header lines. + * macos.texi (Mac / GNUstep Basics): Document ns-right-alternate-modifier. + * emacs.texi (Top): Update node listing. + 2010-11-06 Eli Zaretskii * msdog.texi (Windows HOME): Add information regarding startup diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index b9dd51a85e6..91ce399d4c1 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -770,6 +770,7 @@ Version Control * Introduction to VC:: How version control works in general. * VC Mode Line:: How the mode line shows version control status. * Basic VC Editing:: How to edit a file under version control. +* Log Buffer:: Features available in log entry buffers. * Old Revisions:: Examining and comparing old versions. * Secondary VC Commands:: The commands used a little less frequently. * VC Directory Mode:: Listing files managed by version control. @@ -784,6 +785,9 @@ Introduction to Version Control * Why Version Control?:: Understanding the problems it addresses. * Version Control Systems:: Supported version control back-end systems. * VCS Concepts:: Words and concepts related to version control. +* VCS Merging:: How file conflicts are handled. +* VCS Changesets:: Changesets in version control. +* VCS Repositories:: Where version control repositories are stored. * Types of Log File:: The VCS log in contrast to the ChangeLog. Basic Editing under Version Control @@ -791,7 +795,6 @@ Basic Editing under Version Control * VC With A Merging VCS:: Without locking: default mode for CVS. * VC With A Locking VCS:: RCS in its default mode, SCCS, and optionally CVS. * Advanced C-x v v:: Advanced features available with a prefix argument. -* Log Buffer:: Features available in log entry buffers. The Secondary Commands of VC diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index f5a93ec60e7..dccd632bfb8 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -24,20 +24,20 @@ programs. @section Version Control @cindex version control - A @dfn{version control system} is a package that can record multiple + A @dfn{version control system} is a program that can record multiple versions of a source file, storing information such as the creation -time of each version, who created it, and a description of what was -changed in that version. +time of each version, who made it, and a description of what was +changed. - The Emacs version control interface is called VC. Its commands work -with several different version control systems; currently, it supports -GNU Arch, Bazaar, CVS, Git, Mercurial, Monotone, RCS, SCCS/CSSC, and -Subversion. Of these, the GNU project distributes CVS, GNU Arch, RCS, -and Bazaar. + The Emacs version control interface is called @dfn{VC}. VC commands +work with several different version control systems; currently, it +supports GNU Arch, Bazaar, CVS, Git, Mercurial, Monotone, RCS, +SCCS/CSSC, and Subversion. Of these, the GNU project distributes CVS, +Arch, RCS, and Bazaar. - VC is enabled automatically whenever you visit a file that is -governed by a version control system. To disable VC entirely, set the -customizable variable @code{vc-handled-backends} to @code{nil} + VC is enabled automatically whenever you visit a file governed by a +version control system. To disable VC entirely, set the customizable +variable @code{vc-handled-backends} to @code{nil} @iftex (@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}). @end iftex @@ -49,6 +49,7 @@ customizable variable @code{vc-handled-backends} to @code{nil} * Introduction to VC:: How version control works in general. * VC Mode Line:: How the mode line shows version control status. * Basic VC Editing:: How to edit a file under version control. +* Log Buffer:: Features available in log entry buffers. * Old Revisions:: Examining and comparing old versions. * Secondary VC Commands:: The commands used a little less frequently. * VC Directory Mode:: Listing files managed by version control. @@ -65,12 +66,13 @@ customizable variable @code{vc-handled-backends} to @code{nil} @subsection Introduction to Version Control VC allows you to use a version control system from within Emacs, -integrating the version control operations smoothly with editing. -Though VC cannot completely bridge the gaps between version control -systems with widely differing capabilities, it does provide a uniform -interface to many version control operations. Regardless of which -version control system is in use, you will be able to do basic -operations in much the same way. +integrating the version control operations smoothly with editing. It +provides a uniform interface for common operations in many version +control operations. + + Some uncommon or intricate version control operations, such as +altering repository settings, are not supported in VC. You should +perform such tasks outside Emacs, e.g. via the command line. This section provides a general overview of version control, and describes the version control systems that VC supports. You can skip @@ -81,6 +83,9 @@ you want to use. * Why Version Control?:: Understanding the problems it addresses. * Version Control Systems:: Supported version control back-end systems. * VCS Concepts:: Words and concepts related to version control. +* VCS Merging:: How file conflicts are handled. +* VCS Changesets:: How changes are grouped. +* VCS Repositories:: Where version control repositories are stored. * Types of Log File:: The VCS log in contrast to the ChangeLog. @end menu @@ -112,8 +117,8 @@ vitally important form of communication among developers. @subsubsection Supported Version Control Systems @cindex back end (version control) - VC currently works with many different version control systems or -@dfn{back ends}: + VC currently works with many different version control systems, +which it refers to as @dfn{back ends}: @itemize @bullet @@ -134,73 +139,62 @@ control system. @cindex RCS @item RCS is the free version control system around which VC was initially -built. Almost everything you can do with RCS can be done through VC. -However, you cannot use RCS over the network, and it only works at the -level of individual files rather than projects. +built. It is relatively primitive: it cannot be used over the +network, and works at the level of individual files. Almost +everything you can do with RCS can be done through VC. @cindex CVS @item CVS is the free version control system that was, until recently (circa 2008), used by the majority of free software projects. Nowadays, it is slowly being superseded by newer systems. CVS allows concurrent -multi-user development either locally or over the network. It lacks -support for atomic commits or file moving/renaming. VC supports all -basic editing operations under CVS. For some less common tasks, you -still need to call CVS from the command line. Note also that before -using CVS you must set up a repository, which is a subject too complex -to treat here. +multi-user development either locally or over the network. Unlike +newer systems, it lacks support for atomic commits and file +moving/renaming. VC supports all basic editing operations under CVS. @cindex SVN @cindex Subversion @item Subversion (SVN) is a free version control system designed to be -similar to CVS but without its problems. It supports atomic commits -of filesets, and versioning of directories, symbolic links, meta-data, -renames, copies, and deletes. +similar to CVS but without its problems (e.g., it supports atomic +commits of filesets, and versioning of directories, symbolic links, +meta-data, renames, copies, and deletes). @cindex GNU Arch @cindex Arch @item -GNU Arch is a version control system designed for distributed work. -It differs in many ways from older systems like CVS and RCS. It -provides different methods for interoperating between users, support -for offline operations, and good branching and merging features. It -also supports atomic commits of filesets and file moving/renaming. VC -does not support all operations provided by GNU Arch, so you must -sometimes invoke it from the command line. +GNU Arch is one of the earliest @dfn{distributed} version control +systems (the other being Monotone). @xref{VCS Concepts}, for a +description of distributed version control systems. It is no longer +under active development, and has been deprecated in favor of Bazaar. @cindex git @item -Git is a distributed version control system invented by Linus Torvalds to support -development of Linux (his kernel). It supports atomic commits of filesets and -file moving/renaming. One significant feature of git is that it -largely abolishes the notion of a single centralized repository; -instead, each working copy of a git project is its own repository and -coordination is done through repository-sync operations. VC supports -most git operations, with the exception of news merges and repository -syncing; these must be done from the command line. +Git is a distributed version control system originally invented by +Linus Torvalds to support development of Linux (his kernel). VC +supports most git operations, with the exception of news merges and +repository syncing; these must be done from the command line. VC +supports most git operations, with the exception of news merges and +repository syncing. @cindex hg @cindex Mercurial @item Mercurial (hg) is a distributed version control system broadly -resembling GNU Arch and git, with atomic fileset commits and file -moving/renaming. Like git, it is fully decentralized. VC supports -most Mercurial commands, with the exception of repository sync -operations; this needs to be done from the command line. +resembling git. VC supports most Mercurial commands, with the +exception of repository sync operations. @cindex bzr @cindex Bazaar @item -Bazaar (bzr) is a distributed version control system that supports both -repository-based and distributed versioning, with atomic fileset -commits and file moving/renaming. VC supports most basic editing -operations under Bazaar. +Bazaar (bzr) is a distributed version control system that supports +both repository-based and distributed versioning. VC supports most +basic editing operations under Bazaar. @end itemize Previous versions of VC supported a version control system known as -Meta-CVS. This support has been dropped because of limited interest -from users and developers. +Meta-CVS. This support was dropped due to limited interest from users +and developers. @node VCS Concepts @subsubsection Concepts of Version Control @@ -216,11 +210,11 @@ as @dfn{log entries} that describe the changes made to each file. @cindex work file @cindex checking out files - A file @dfn{checked out} of a repository is called the @dfn{work -file}. You edit the work file and make changes in it, as you would -with an ordinary file. After you are done with a set of changes, you -@dfn{check in} or @dfn{commit} the file; this records the changes in -the repository, along with a log entry for those changes. + The copy of a version-controlled file that you actually edit is +called the @dfn{work file}. You can change each work file as you +would an ordinary file. After you are done with a set of changes, you +@dfn{commit} (or @dfn{check in}) the changes; this records the changes +in the repository, along with a descriptive log entry. @cindex revision @cindex revision ID @@ -231,12 +225,15 @@ on the version control system; in the simplest case, it is just an integer. To go beyond these basic concepts, you will need to understand three -aspects in which version control systems differ. -They can be locking-based or merging-based; they can be file-based or -changeset-based; and they can be centralized or decentralized. VC -handles all these modes of operation, but it cannot hide the differences. +aspects in which version control systems differ. As explained in the +next three sections, they can be lock-based or merge-based; file-based +or changeset-based; and centralized or decentralized. VC handles all +these modes of operation, but it cannot hide the differences. +@node VCS Merging +@subsubsection Merge-based vs lock-based Version Control @cindex locking versus merging + A version control system typically has some mechanism to coordinate between users who want to change the same file. There are two ways to do this: merging and locking. @@ -244,8 +241,7 @@ do this: merging and locking. In a version control system that uses merging, each user may check out and modify a work file at any time. The system lets you @dfn{merge} your work file, which may contain changes that have not -been checked in, with the latest changes that others have checked into -the repository. +been committed, with the latest changes that others have committed. Older version control systems use a @dfn{locking} scheme instead. Here, work files are normally read-only. To edit a file, you ask the @@ -253,7 +249,7 @@ version control system to make it writable for you by @dfn{locking} it; only one user can lock a given file at any given time. This procedure is analogous to, but different from, the locking that Emacs uses to detect simultaneous editing of ordinary files -(@pxref{Interlocking}). When you check in your changes, that unlocks +(@pxref{Interlocking}). When you commit your changes, that unlocks the file, and the work file becomes read-only again. Other users may then lock the file to make their own changes. @@ -261,8 +257,8 @@ then lock the file to make their own changes. users try to modify the same file at the same time. Locking systems have @dfn{lock conflicts}; a user may try to check a file out and be unable to because it is locked. In merging systems, @dfn{merge -conflicts} happen when you check in a change to a file that conflicts -with a change checked in by someone else after your checkout. Both +conflicts} happen when you commit a change to a file that conflicts +with a change committed by someone else after your checkout. Both kinds of conflict have to be resolved by human judgment and communication. Experience has shown that merging is superior to locking, both in convenience to developers and in minimizing the @@ -275,27 +271,33 @@ Distributed version control systems, such as GNU Arch, git, and Mercurial, are exclusively merging-based. VC mode supports both locking and merging version control. The -terms ``checkin'' and ``checkout'' come from locking-based version -control systems; newer version control systems have slightly different -operations usually called ``commit'' and ``update'', but VC hides the -differences between them as much as possible. +terms ``commit'' and ``update'' are used in newer version control +systems; older lock-based systems use the terms ``check in'' and +``check out''. VC hides the differences between them as much as +possible. -@cindex files versus changesets. +@node VCS Changesets +@subsubsection Changeset-based vs File-based Version Control + +@cindex changesets On SCCS, RCS, CVS, and other early version control systems, version control operations are @dfn{file-based}: each file has its own comment -and revision history separate from that of all other files in the -system. Later systems, beginning with Subversion, are -@dfn{changeset-based}: a checkin may include changes to several files, -and the entire set of changes is treated as a unit by the system. Any -comment associated with the change does not belong to a single file, -but to the changeset itself. +and revision history separate from that of all other files. Newer +systems, beginning with Subversion, are @dfn{changeset-based}: a +checkin may include changes to several files, and the entire set of +changes is handled as a unit. Any comment associated with the change +does not belong to a single file, but to the changeset itself. Changeset-based version control is more flexible and powerful than file-based version control; usually, when a change to multiple files has to be reversed, it's good to be able to easily identify and remove all of it. -@cindex centralized vs. decentralized version control +@node VCS Repositories +@subsubsection Decentralized vs Centralized Repositories + +@cindex centralized version control +@cindex decentralized version control Early version control systems were designed around a @dfn{centralized} model in which each project has only one repository used by all developers. SCCS, RCS, CVS, and Subversion share this @@ -306,14 +308,12 @@ point for reliability and efficiency. control, later implemented in git, Mercurial, and Bazaar. A project may have several different repositories, and these systems support a sort of super-merge between repositories that tries to reconcile their -change histories. At the limit, each developer has his/her own -repository, and repository merges replace checkin/commit operations. +change histories. In effect, there is one repository for each +developer, and repository merges take the place of commit operations. - VC's job is to help you manage the traffic between your personal -workfiles and a repository. Whether that repository is a single -master or one of a network of peer repositories is not something VC -has to care about. Thus, the difference between a centralized and a -decentralized version control system is invisible to VC mode. + VC helps you manage the traffic between your personal workfiles and +a repository. Whether the repository is a single master, or one of a +network of peer repositories, is not something VC has to care about. @node Types of Log File @subsubsection Types of Log File @@ -323,9 +323,9 @@ decentralized version control system is invisible to VC mode. Projects that use a version control system can have two types of log for changes. One is the log maintained by the version control system: -each time you check in a change, you fill out a @dfn{log entry} for -the change (@pxref{Log Buffer}). This is called the @dfn{version -control log}. +each time you commit a change, you fill out a @dfn{log entry} for the +change (@pxref{Log Buffer}). This is called the @dfn{version control +log}. The other kind of log is the file @file{ChangeLog} (@pxref{Change Log}). It provides a chronological record of all changes to a large @@ -364,21 +364,22 @@ change, and later use the @kbd{C-x v a} command to copy it to @subsection Version Control and the Mode Line When you visit a file that is under version control, Emacs indicates -this on the mode line. For example, @samp{RCS-1.3} says that RCS is -used for that file, and the current version is 1.3. +this on the mode line. For example, @samp{Bzr-1223} says that Bazaar +is used for that file, and the current revision ID is 1223. The character between the back-end name and the revision ID -indicates the version control status of the file. @samp{-} means that -the work file is not locked (if locking is in use), or not modified (if -locking is not in use). @samp{:} indicates that the file is locked, or -that it is modified. If the file is locked by some other user (for -instance, @samp{jim}), that is displayed as @samp{RCS:jim:1.3}. +indicates the status of the work file. In a merge-based version +control system, a @samp{-} character indicates that the work file is +unmodified, and @samp{:} indicates that it has been modified. In a +lock-based system, @samp{-} indicates an unlocked file, and @samp{:} a +locked file; if the file is locked by another user (for instance, +@samp{jim}), that is displayed as @samp{RCS:jim:1.3}. On a graphical display, you can move the mouse over this mode line indicator to pop up a ``tool-tip'', which displays a more verbose description of the version control status. Pressing @kbd{Mouse-1} -over the indicator pops up a menu of VC commands. This menu is -identical to the @samp{Tools / Version Control} menu item. +over the indicator pops up a menu of VC commands, identical to +@samp{Tools / Version Control} on the menu bar. @vindex auto-revert-check-vc-info When Auto Revert mode (@pxref{Reverting}) reverts a buffer that is @@ -430,12 +431,6 @@ command line. All files in a VC fileset must be under the same version control system; if they are not, Emacs signals an error when you attempt to execute a command on the fileset. - Support for VC filesets and changeset-based version control systems -is the main improvement to VC in Emacs 23. When you mark multi-file -VC in a VC Directory buffer, VC operations treat them as a VC fileset, -and operate on them all at once if the version control system is -changeset-based. @xref{VC Directory Mode}. - VC filesets are distinct from the ``named filesets'' used for viewing and visiting files in functional groups (@pxref{Filesets}). Unlike named filesets, VC filesets are not named and don't persist @@ -445,7 +440,6 @@ across sessions. * VC With A Merging VCS:: Without locking: default mode for CVS. * VC With A Locking VCS:: RCS in its default mode, SCCS, and optionally CVS. * Advanced C-x v v:: Advanced features available with a prefix argument. -* Log Buffer:: Features available in log entry buffers. @end menu @node VC With A Merging VCS @@ -478,9 +472,9 @@ If you have not changed the work file, but some other user has checked in changes to the repository, merge those changes into the work file. @item -If you have made modifications to the work file, attempts to check in -your changes. To do this, Emacs first reads the log entry for the new -revision (@pxref{Log Buffer}). If some other user has checked in +If you have made modifications to the work file, attempt to commit +the changes. To do this, Emacs first reads the log entry for the new +revision (@pxref{Log Buffer}). If some other user has committed changes to the repository since you last checked it out, the checkin fails. In that case, type @kbd{C-x v v} again to merge those changes into your own work file; this puts the work file into a ``conflicted'' @@ -495,8 +489,8 @@ trying to commit your own changes, type @kbd{C-x v m @key{RET}}. These rules also apply when you use RCS in its ``non-locking'' mode, except that changes are not automatically merged from the repository. -Nothing informs you if another user has checked in changes in the same -file since you began editing it; when you check in your revision, his +Nothing informs you if another user has committed changes in the same +file since you began editing it; when you commit your revision, his changes are removed (however, they remain in the repository and are thus not irrevocably lost). Therefore, you must verify that the current revision is unchanged before checking in your changes. In @@ -516,7 +510,7 @@ If the file is not locked, lock it and make it writable, so that you can change it. @item -If the file is locked by you, and contains changes, check in the +If the file is locked by you, and contains changes, commit the changes. In order to do this, Emacs first reads the log entry for the new revision. @xref{Log Buffer}. @@ -537,7 +531,7 @@ that there is no such thing as stealing a lock. @node Advanced C-x v v @subsubsection Advanced Control in @kbd{C-x v v} -@cindex revision ID to check in/out +@cindex revision ID in version control When you give a prefix argument to @code{vc-next-action} (@kbd{C-u C-x v v}), it still performs the next logical version control operation, but accepts additional arguments to specify precisely how @@ -546,8 +540,8 @@ to do the operation. @itemize @bullet @item If the file is modified (or locked), you can specify the revision ID -to use for the new version that you check in. This is one way -to create a new branch (@pxref{Branches}). +to use for the new version that you commit. This is one way to create +a new branch (@pxref{Branches}). @item If the file is not modified (and unlocked), you can specify the @@ -573,34 +567,53 @@ Features}). @end itemize @node Log Buffer -@subsubsection Features of the Log Entry Buffer +@subsection Features of the Log Entry Buffer - When you check in changes, Emacs pops up a buffer called -@samp{*VC-Log*} for you to enter a log entry. + When you tell VC to commit a change, it pops up a buffer called +@samp{*VC-Log*}. In this buffer, you should write a @dfn{log entry} +describing the changes you have made (@pxref{Why Version Control?}). +After you are done, type @kbd{C-c C-c}; this exits the buffer and +commits the change, together with your log entry. - After you have finished editing the log message, type @kbd{C-c C-c} -to exit the buffer and commit the change. + While in the @samp{*VC-Log*} buffer, you can write one or more +@dfn{header lines}, specifying additional information to be supplied +to the version control system. Each header line must occupy a single +line at the top of the buffer; the first line that is not a header +line is treated as the start of the log entry. For example, the +following header line states that the present change was not written +by you, but by another developer: + +@smallexample +Author: J. R. Hacker +@end smallexample + +@noindent +Apart from the @samp{Author} header, Emacs recognizes the headers +@samp{Date} (a manually-specified commit time) and @samp{Fixes} (a +reference to a bug fixed by the change). Not all version control +systems recognize all headers: Bazaar recognizes all three headers, +while git, Mercurial, and Monotone recognizes only @samp{Author} and +@samp{Summary}. If you specify a header for a version control that +does not support it, the header is treated as part of the log entry. @findex log-edit-show-files @findex log-edit-show-diff - In the @samp{*VC-Log*} buffer, typing @kbd{C-c C-f} -(@code{log-edit-show-files}) displays a list of files in the VC -fileset you are committing. If you called @kbd{C-x v v} directly from -a work file, the VC fileset consists of that single file, so this -command is not very useful. If you called @kbd{C-x v v} from a VC -directory buffer, the VC fileset may consist of multiple files -(@pxref{VC Directory Mode}). + Type @kbd{C-c C-f} (@code{log-edit-show-files}) to display a list of +files in the current VC fileset. If you called @kbd{C-x v v} directly +from a work file, the fileset consists of that single file; if you +called @kbd{C-x v v} from a VC directory buffer (@pxref{VC Directory +Mode}), the fileset may consist of multiple files. @findex log-edit-insert-changelog - Type @kbd{C-c C-d} (@code{log-edit-show-diff}) to show a ``diff'' of -the changes you have made (i.e., the differences between the work file -and the repository revision from which you started editing the file). -The diff is displayed in a special buffer in another window. -@xref{Comparing Files}. + Type @kbd{C-c C-d} (@code{log-edit-show-diff}) to show a @dfn{diff} +of the changes you have made (i.e., the differences between the work +file and the repository revision from which you started editing). +@xref{Old Revisions}. - If you have written an entry in the @file{ChangeLog} (@pxref{Change -Log}), type @kbd{C-c C-a} (@code{log-edit-insert-changelog}) to pull -it into the @samp{*VC-Log*} buffer. If the topmost item in the + If the current VC fileset includes one or more @file{ChangeLog} +files (@pxref{Change Log}), type @kbd{C-c C-a} +(@code{log-edit-insert-changelog}) to pull the relevant entries into +the @samp{*VC-Log*} buffer. If the topmost item in each @file{ChangeLog} was made under your user name on the current date, this command searches that item for entries that match the file(s) to be committed; if found, these entries are inserted. @@ -615,7 +628,7 @@ the revision control log. To abort a check-in, just @strong{don't} type @kbd{C-c C-c} in that buffer. You can switch buffers and do other editing. As long as you -don't try to check in another file, the entry you were editing remains +don't try to commit another file, the entry you were editing remains in the @samp{*VC-Log*} buffer, and you can go back to that buffer at any time to complete the check-in. @@ -624,7 +637,7 @@ convenient to specify the same log entry for many of the files. (This is the normal way to do things on a changeset-oriented system, where comments are attached to changesets rather than the history of individual files.) The most convenient way to do this is to mark all -the files in VC Directory Mode and check in from there; the log buffer +the files in VC Directory Mode and commit from there; the log buffer will carry the fileset information with it and do a group commit when you type @kbd{C-c C-c}. @@ -636,7 +649,7 @@ work just like the minibuffer history commands (except that these versions are used outside the minibuffer). @vindex vc-log-mode-hook - Each time you check in a change, the log entry buffer is put into VC + Each time you commit a change, the log entry buffer is put into VC Log Edit mode, which involves running two hooks: @code{text-mode-hook} and @code{vc-log-mode-hook}. @xref{Hooks}. @@ -688,8 +701,12 @@ buffer in a separate window. @kbd{C-x v =} (@code{vc-diff}) compares each file in the current VC fileset (saving them if necessary) with the repository revision(s) from which you started editing. Note that the latter may or may not -be the latest revision of the file(s). The diff is displayed in a -special buffer in another window. @xref{Comparing Files}. +be the latest revision of the file(s). + + The diff is displayed in another window, in a Diff mode buffer +(@pxref{Diff Mode}) named @file{*vc-diff*}. In this buffer, the +@kbd{g} (@code{revert-buffer}) command performs the file comparison +again, generating a new diff. @findex vc-diff @kindex C-u C-x v = @@ -996,7 +1013,7 @@ then decide not to change it. @kindex C-x v c @findex vc-rollback - To cancel a change that you already checked in, use @kbd{C-x v c} + To cancel a change that you already committed, use @kbd{C-x v c} (@code{vc-rollback}). This command discards all record of the most recent checked-in revision, but only if your work file corresponds to that revision---you cannot use @kbd{C-x v c} to cancel a revision that @@ -1063,8 +1080,8 @@ output is used. Here is an example using CVS: @noindent In this example, @samp{file1.c} is modified with respect to the repository, and @samp{file2.c} is not. @samp{file3.c} is modified, -but other changes have also been checked in to the repository---you -need to merge them with the work file before you can check it in. +but other changes have also been committed---you need to merge them +with the work file before you can check it in. @vindex vc-stay-local @vindex vc-cvs-stay-local @@ -1102,7 +1119,7 @@ this includes Version Control subdirectories such as @samp{RCS} and VC Directory mode has a full set of navigation and marking commands for picking out filesets. Some of these are also available in a -context menu invoked by the @kbd{mouse-2} button. +context menu invoked by @kbd{mouse-2}. Up- and down-arrow keys move in the buffer; @kbd{n} and @kbd{p} also move vertically as in other list-browsing modes. @key{SPC} and @@ -1162,11 +1179,11 @@ buffers. Some single-key shortcuts are available as well; @kbd{=}, @kbd{+}, @kbd{l}, @kbd{i}, and @kbd{v} behave as through prefixed with @kbd{C-x v}. - The command @kbd{C-x v v} (@code{vc-next-action}) operates on all the -marked files, so that you can check in several files at once. -If the underlying VC supports atomic commits of multiple-file -changesets, @kbd{C-x v v} with a selected set of modified but not -committed files will commit all of them at once as a single changeset. + The command @kbd{C-x v v} (@code{vc-next-action}) operates on all +the marked files, so that you can commit several files at once. If +the underlying VC supports atomic commits of multiple-file changesets, +@kbd{C-x v v} with a selected set of modified but not committed files +will commit all of them at once as a single changeset. When @kbd{C-x v v} (@code{vc-next-action}) operates on multiple files, all of those files must be either in the same state or in @@ -1249,15 +1266,15 @@ other branch. @node Creating Branches @subsubsection Creating New Branches - To create a new branch from a head revision (one that is the latest in -the branch that contains it), first select that revision if necessary, -lock it with @kbd{C-x v v}, and make whatever changes you want. Then, -when you check in the changes, use @kbd{C-u C-x v v}. This lets you -specify the revision ID for the new revision. You should specify a -suitable branch ID for a branch starting at the current revision. -For example, if the current revision is 2.5, the branch ID should be -2.5.1, 2.5.2, and so on, depending on the number of existing branches at -that point. + To create a new branch from a head revision (one that is the latest +in the branch that contains it), first select that revision if +necessary, lock it with @kbd{C-x v v}, and make whatever changes you +want. Then, when you commit the changes, use @kbd{C-u C-x v v}. This +lets you specify the revision ID for the new revision. You should +specify a suitable branch ID for a branch starting at the current +revision. For example, if the current revision is 2.5, the branch ID +should be 2.5.1, 2.5.2, and so on, depending on the number of existing +branches at that point. To create a new branch at an older revision (one that is no longer the head of a branch), first select that revision (@pxref{Switching @@ -1270,11 +1287,11 @@ revision, that you really mean to create a new branch---if you say no, you'll be offered a chance to lock the latest revision instead. On a merging-based VCS you will skip this step. - Then make your changes and type @kbd{C-x v v} again to check in a new + Then make your changes and type @kbd{C-x v v} again to commit a new revision. This automatically creates a new branch starting from the -selected revision. You need not specially request a new branch, because -that's the only way to add a new revision at a point that is not the head -of a branch. +selected revision. You need not specially request a new branch, +because that's the only way to add a new revision at a point that is +not the head of a branch. After the branch is created, you ``stay'' on it. That means that subsequent check-ins create new revisions on that branch. To leave the @@ -1322,11 +1339,11 @@ type @kbd{C-x v v} to lock revision 1.5 so that you can change it. Next, type @kbd{C-x v m 1.3.1 @key{RET}}. This takes the entire set of changes on branch 1.3.1 (relative to revision 1.3, where the branch started, up to the last revision on the branch) and merges it into the current revision -of the work file. You can now check in the changed file, thus creating +of the work file. You can now commit the changed file, thus creating revision 1.6 containing the changes from the branch. It is possible to do further editing after merging the branch, before -the next check-in. But it is usually wiser to check in the merged +the next check-in. But it is usually wiser to commit the merged revision, then lock it and make the further changes. This will keep a better record of the history of changes. @@ -1362,7 +1379,7 @@ master file revision with user B's changes in it is 1.11. Then you can resolve the conflicts by editing the file manually. Or you can type @code{M-x vc-resolve-conflicts} after visiting the file. This starts an Ediff session, as described above. Don't forget to -check in the merged version afterwards. +commit the merged version afterwards. @node Multi-User Branching @subsubsection Multi-User Branching diff --git a/etc/NEWS b/etc/NEWS index 59b63440775..8e5115c6cae 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -38,39 +38,35 @@ This can be used in place of the default appt-message-warning-time. ** VC and related modes -*** New VC commands: vc-log-incoming, vc-log-outgoing, vc-find-conflicted-file. +*** New VC command `vc-log-incoming', bound to `C-x v I'. +This shows a log of changes to be received with a pull operation. +For Git, this runs "git fetch" to make the necessary data available +locally; this requires version 1.7 or newer. -**** vc-log-incoming for Git runs "git fetch" so that the necessary -data is available locally. +*** New VC command `vc-log-outgoing', bound to `C-x v O'. +This shows a log of changes to be sent in the next commit. -**** vc-log-incoming and vc-log-outgoing for Git require version 1.7 (or newer). - -*** New key bindings: C-x v I and C-x v O bound to vc-log-incoming and -vc-log-outgoing, respectively. +*** New VC command vc-find-conflicted-file. ++++ *** The 'g' key in VC diff, log, log-incoming and log-outgoing buffers reruns the corresponding VC command to compute an up to date version of the buffer. *** vc-dir for Bzr supports viewing shelve contents and shelving snapshots. ++++ *** Special markup can be added to log-edit buffers. -The log-edit buffers are expected to have a format similar to email messages -with headers of the form: - Author: - Summary: - Fixes: -Some backends handle some of those headers specially, but any unknown header -is just left as is in the message, so it is not lost. +You can add headers specifying additional information to be supplied +to the version control system. For example: -**** vc-git handles Author: and Date: -**** vc-hg handles Author: and Date: -**** vc-bzr handles Author:, Date: and Fixes: -**** vc-mtn handles Author: and Date: - -*** Pressing g in a *vc-diff* buffer reruns vc-diff, so it will -produce an up to date diff. + Author: J. R. Hacker + Fixes: 4204 + Actual text of log entry... +Bazaar recognizes the headers "Author", "Date" and "Fixes". +Git, Mercurial, and Monotone recognize "Author" and "Date". +Any unknown header is left as is in the message, so it is not lost. ** Obsolete packages From 091af6490f0f4e6a314746401578b52991457ecd Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 20 Nov 2010 18:19:39 -0800 Subject: [PATCH 06/30] python.el comment. --- lisp/progmodes/python.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ac0fc4f3a3b..5d528e5fa28 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1550,6 +1550,7 @@ buffer for a list of commands.)" (with-current-buffer (let* ((cmdlist (append (python-args-to-list cmd) + ;; See http://lists.gnu.org/archive/html/emacs-devel/2008-09/msg00215.html '("-i" "-c" "import sys; sys.path.remove('')"))) (path (getenv "PYTHONPATH")) (process-environment ; to import emacs.py From 0d6607ab81be365f247b8dd7a831fdb390591e49 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 21 Nov 2010 11:05:27 -0500 Subject: [PATCH 07/30] =?UTF-8?q?*=20maintaining.texi=20(Version=20Control?= =?UTF-8?q?=20Systems):=20Fix=20repeated=20sentence.=20Suggested=20by=20?= =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/emacs/ChangeLog | 5 +++++ doc/emacs/maintaining.texi | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 7dba095b250..db27d5c46f0 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2010-11-21 Chong Yidong + + * maintaining.texi (Version Control Systems): Fix repeated sentence. + Suggested by Štěpán Němec. + 2010-11-20 Chong Yidong * maintaining.texi (Version Control): Say "commit", not "check in". diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index dccd632bfb8..68e521be4ca 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -172,10 +172,8 @@ under active development, and has been deprecated in favor of Bazaar. @item Git is a distributed version control system originally invented by Linus Torvalds to support development of Linux (his kernel). VC -supports most git operations, with the exception of news merges and -repository syncing; these must be done from the command line. VC -supports most git operations, with the exception of news merges and -repository syncing. +supports many common git operations, but others, such as repository +syncing, must be done from the command line. @cindex hg @cindex Mercurial From 1d851570a67adec22da23bdc7499bb489992d578 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 21 Nov 2010 11:52:05 -0500 Subject: [PATCH 08/30] Make the sys.path remove in Python mode customizable (Bug#7454). * progmodes/python.el (run-python): Doc fix. (python-keep-current-directory-in-path): New var (Bug#7454). --- etc/NEWS | 4 ++++ lisp/ChangeLog | 5 +++++ lisp/progmodes/python.el | 44 ++++++++++++++++++++++++++-------------- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 8e5115c6cae..4a7b9a5259f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -36,6 +36,10 @@ used on x86-64 and s390x GNU/Linux architectures. ** The appt-add command takes an optional argument for the warning time. This can be used in place of the default appt-message-warning-time. +--- +** You can allow inferior Python processes to load modules from the +current directory by setting `python-remove-cwd-from-path' to nil. + ** VC and related modes *** New VC command `vc-log-incoming', bound to `C-x v I'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0f0308be41b..4796239b366 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-11-21 Chong Yidong + + * progmodes/python.el (run-python): Doc fix. + (python-keep-current-directory-in-path): New var (Bug#7454). + 2010-11-20 Chong Yidong * lpr.el (lpr-buffer, print-buffer, lpr-region, print-region): diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5d528e5fa28..653ef3150e5 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1426,6 +1426,16 @@ Default ignores all inputs of 0, 1, or 2 non-blank characters." :type 'regexp :group 'python) +(defcustom python-remove-cwd-from-path t + "Whether to allow loading of Python modules from the current directory. +If this is non-nil, Emacs removes '' from sys.path when starting +an inferior Python process. This is the default, for security +reasons, as it is easy for the Python process to be started +without the user's realization (e.g. to perform completion)." + :type 'boolean + :group 'python + :version "23.3") + (defun python-input-filter (str) "`comint-input-filter' function for inferior Python. Don't save anything for STR matching `inferior-python-filter-regexp'." @@ -1523,20 +1533,24 @@ Don't save anything for STR matching `inferior-python-filter-regexp'." ;;;###autoload (defun run-python (&optional cmd noshow new) "Run an inferior Python process, input and output via buffer *Python*. -CMD is the Python command to run. NOSHOW non-nil means don't show the -buffer automatically. +CMD is the Python command to run. NOSHOW non-nil means don't +show the buffer automatically. -Normally, if there is a process already running in `python-buffer', -switch to that buffer. Interactively, a prefix arg allows you to edit -the initial command line (default is `python-command'); `-i' etc. args -will be added to this as appropriate. A new process is started if: -one isn't running attached to `python-buffer', or interactively the -default `python-command', or argument NEW is non-nil. See also the -documentation for `python-buffer'. +Interactively, a prefix arg means to prompt for the initial +Python command line (default is `python-command'). -Runs the hook `inferior-python-mode-hook' \(after the -`comint-mode-hook' is run). \(Type \\[describe-mode] in the process -buffer for a list of commands.)" +A new process is started if one isn't running attached to +`python-buffer', or if called from Lisp with non-nil arg NEW. +Otherwise, if a process is already running in `python-buffer', +switch to that buffer. + +This command runs the hook `inferior-python-mode-hook' after +running `comint-mode-hook'. Type \\[describe-mode] in the +process buffer for a list of commands. + +By default, Emacs inhibits the loading of Python modules from the +current working directory, for security reasons. To disable this +behavior, change `python-remove-cwd-from-path' to nil." (interactive (if current-prefix-arg (list (read-string "Run Python: " python-command) nil t) (list python-command))) @@ -1549,9 +1563,9 @@ buffer for a list of commands.)" (when (or new (not (comint-check-proc python-buffer))) (with-current-buffer (let* ((cmdlist - (append (python-args-to-list cmd) - ;; See http://lists.gnu.org/archive/html/emacs-devel/2008-09/msg00215.html - '("-i" "-c" "import sys; sys.path.remove('')"))) + (append (python-args-to-list cmd) '("-i") + (if python-remove-cwd-from-path + '("-c" "import sys; sys.path.remove('')")))) (path (getenv "PYTHONPATH")) (process-environment ; to import emacs.py (cons (concat "PYTHONPATH=" From ae3da38afc6269294faf1e6204128b5be2f40c3f Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 21 Nov 2010 12:04:43 -0500 Subject: [PATCH 09/30] Backport fixes for Bug#5390 and Bug#5694 from trunk. * progmodes/python.el: Add Ipython support (Bug#5390). (python-shell-prompt-alist) (python-shell-continuation-prompt-alist): New options. (python--set-prompt-regexp): New function. (inferior-python-mode, run-python, python-shell): Require ansi-color. Use python--set-prompt-regexp to set the comint prompt based on the Python interpreter. (python--prompt-regexp): New var. (python-check-comint-prompt) (python-comint-output-filter-function): Use it. (run-python): Use a pipe (Bug#5694). --- lisp/ChangeLog | 14 ++++++ lisp/progmodes/python.el | 95 ++++++++++++++++++++++++++++++---------- 2 files changed, 85 insertions(+), 24 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4796239b366..add4b50bfbd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2010-11-21 Chong Yidong + + * progmodes/python.el: Add Ipython support (Bug#5390). + (python-shell-prompt-alist) + (python-shell-continuation-prompt-alist): New options. + (python--set-prompt-regexp): New function. + (inferior-python-mode, run-python, python-shell): Require + ansi-color. Use python--set-prompt-regexp to set the comint + prompt based on the Python interpreter. + (python--prompt-regexp): New var. + (python-check-comint-prompt) + (python-comint-output-filter-function): Use it. + (run-python): Use a pipe (Bug#5694). + 2010-11-21 Chong Yidong * progmodes/python.el (run-python): Doc fix. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 653ef3150e5..6fdaa126b5b 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -570,6 +570,33 @@ having to restart the program." "Queue of Python temp files awaiting execution. Currently-active file is at the head of the list.") +(defcustom python-shell-prompt-alist + '(("ipython" . "^In \\[[0-9]+\\]: *") + (t . "^>>> ")) + "Alist of Python input prompts. +Each element has the form (PROGRAM . REGEXP), where PROGRAM is +the value of `python-python-command' for the python process and +REGEXP is a regular expression matching the Python prompt. +PROGRAM can also be t, which specifies the default when no other +element matches `python-python-command'." + :type 'string + :group 'python + :version "24.1") + +(defcustom python-shell-continuation-prompt-alist + '(("ipython" . "^ [.][.][.]+: *") + (t . "^[.][.][.] ")) + "Alist of Python continued-line prompts. +Each element has the form (PROGRAM . REGEXP), where PROGRAM is +the value of `python-python-command' for the python process and +REGEXP is a regular expression matching the Python prompt for +continued lines. +PROGRAM can also be t, which specifies the default when no other +element matches `python-python-command'." + :type 'string + :group 'python + :version "24.1") + (defvar python-pdbtrack-is-tracking-p nil) (defconst python-pdbtrack-stack-entry-regexp @@ -1302,13 +1329,9 @@ See `python-check-command' for the default." ;;;; Inferior mode stuff (following cmuscheme). -;; Fixme: Make sure we can work with IPython. - (defcustom python-python-command "python" "Shell command to run Python interpreter. -Any arguments can't contain whitespace. -Note that IPython may not work properly; it must at least be used -with the `-cl' flag, i.e. use `ipython -cl'." +Any arguments can't contain whitespace." :group 'python :type 'string) @@ -1386,6 +1409,23 @@ local value.") ;; Autoloaded. (declare-function compilation-shell-minor-mode "compile" (&optional arg)) +(defvar python--prompt-regexp nil) + +(defun python--set-prompt-regexp () + (let ((prompt (cdr-safe (or (assoc python-python-command + python-shell-prompt-alist) + (assq t python-shell-prompt-alist)))) + (cprompt (cdr-safe (or (assoc python-python-command + python-shell-continuation-prompt-alist) + (assq t python-shell-continuation-prompt-alist))))) + (set (make-local-variable 'comint-prompt-regexp) + (concat "\\(" + (mapconcat 'identity + (delq nil (list prompt cprompt "^([Pp]db) ")) + "\\|") + "\\)")) + (set (make-local-variable 'python--prompt-regexp) prompt))) + ;; Fixme: This should inherit some stuff from `python-mode', but I'm ;; not sure how much: at least some keybindings, like C-c C-f; ;; syntax?; font-locking, e.g. for triple-quoted strings? @@ -1408,14 +1448,12 @@ For running multiple processes in multiple buffers, see `run-python' and \\{inferior-python-mode-map}" :group 'python + (require 'ansi-color) ; for ipython (setq mode-line-process '(":%s")) (set (make-local-variable 'comint-input-filter) 'python-input-filter) (add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter nil t) - ;; Still required by `comint-redirect-send-command', for instance - ;; (and we need to match things like `>>> ... >>> '): - (set (make-local-variable 'comint-prompt-regexp) - (rx line-start (1+ (and (or (repeat 3 (any ">.")) "(Pdb)") " ")))) + (python--set-prompt-regexp) (set (make-local-variable 'compilation-error-regexp-alist) python-compilation-regexp-alist) (compilation-shell-minor-mode 1)) @@ -1522,12 +1560,12 @@ Don't save anything for STR matching `inferior-python-filter-regexp'." cmd))) (unless (shell-command-to-string cmd) (error "Can't run Python command `%s'" cmd)) - (let* ((res (shell-command-to-string (concat cmd " --version")))) - (string-match "Python \\([0-9]\\)\\.\\([0-9]\\)" res) - (unless (and (equal "2" (match-string 1 res)) - (match-beginning 2) - (>= (string-to-number (match-string 2 res)) 2)) - (error "Only Python versions >= 2.2 and < 3.0 supported"))) + (let* ((res (shell-command-to-string + (concat cmd + " -c \"from sys import version_info;\ +print version_info >= (2, 2) and version_info < (3, 0)\"")))) + (unless (string-match "True" res) + (error "Only Python versions >= 2.2 and < 3.0 are supported"))) (setq python-version-checked t))) ;;;###autoload @@ -1554,6 +1592,7 @@ behavior, change `python-remove-cwd-from-path' to nil." (interactive (if current-prefix-arg (list (read-string "Run Python: " python-command) nil t) (list python-command))) + (require 'ansi-color) ; for ipython (unless cmd (setq cmd python-command)) (python-check-version cmd) (setq python-command cmd) @@ -1572,8 +1611,10 @@ behavior, change `python-remove-cwd-from-path' to nil." (if path (concat path path-separator)) data-directory) process-environment)) - ;; Suppress use of pager for help output: - (process-connection-type nil)) + ;; If we use a pipe, unicode characters are not printed + ;; correctly (Bug#5794) and IPython does not work at + ;; all (Bug#5390). + (process-connection-type t)) (apply 'make-comint-in-buffer "Python" (generate-new-buffer "*Python*") (car cmdlist) nil (cdr cmdlist))) @@ -1629,7 +1670,12 @@ behavior, change `python-remove-cwd-from-path' to nil." ;; non-ASCII. (interactive "r") (let* ((f (make-temp-file "py")) - (command (format "emacs.eexecfile(%S)" f)) + (command + ;; IPython puts the FakeModule module into __main__ so + ;; emacs.eexecfile becomes useless. + (if (string-match "^ipython" python-command) + (format "execfile %S" f) + (format "emacs.eexecfile(%S)" f))) (orig-start (copy-marker start))) (when (save-excursion (goto-char start) @@ -1829,7 +1875,9 @@ If there isn't, it's probably not appropriate to send input to return Eldoc information etc. If PROC is non-nil, check the buffer for that process." (with-current-buffer (process-buffer (or proc (python-proc))) (save-excursion - (save-match-data (re-search-backward ">>> \\=" nil t))))) + (save-match-data + (re-search-backward (concat python--prompt-regexp " *\\=") + nil t))))) ;; Fixme: Is there anything reasonable we can do with random methods? ;; (Currently only works with functions.) @@ -2545,9 +2593,7 @@ Runs `jython-mode-hook' after `python-mode-hook'." "Watch output for Python prompt and exec next file waiting in queue. This function is appropriate for `comint-output-filter-functions'." ;; TBD: this should probably use split-string - (when (and (or (string-equal string ">>> ") - (and (>= (length string) 5) - (string-equal (substring string -5) "\n>>> "))) + (when (and (string-match python--prompt-regexp string) python-file-queue) (condition-case nil (delete-file (car python-file-queue)) @@ -2759,6 +2805,7 @@ comint believe the user typed this string so that (funcall (process-filter proc) proc msg)) (set-buffer curbuf)) (process-send-string proc cmd))) + ;;;###autoload (defun python-shell (&optional argprompt) "Start an interactive Python interpreter in another window. @@ -2798,6 +2845,7 @@ interaction between undo and process filters; the same problem exists in non-Python process buffers using the default (Emacs-supplied) process filter." (interactive "P") + (require 'ansi-color) ; For ipython ;; Set the default shell if not already set (when (null python-which-shell) (python-toggle-shells python-default-interpreter)) @@ -2814,10 +2862,9 @@ filter." )))) (switch-to-buffer-other-window (apply 'make-comint python-which-bufname python-which-shell nil args)) - (make-local-variable 'comint-prompt-regexp) (set-process-sentinel (get-buffer-process (current-buffer)) 'python-sentinel) - (setq comint-prompt-regexp "^>>> \\|^[.][.][.] \\|^(pdb) ") + (python--set-prompt-regexp) (add-hook 'comint-output-filter-functions 'python-comint-output-filter-function nil t) ;; pdbtrack From 5b9b7ef4489a78fea8f37bcc79385ff234594166 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 21 Nov 2010 19:59:08 +0200 Subject: [PATCH 10/30] bugtracker: Correct locations of bzr *.conf files. --- admin/notes/bugtracker | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker index 859d99b03bd..0ef89739b19 100644 --- a/admin/notes/bugtracker +++ b/admin/notes/bugtracker @@ -450,8 +450,8 @@ http://lists.gnu.org/archive/html/emacs-devel/2009-11/msg00440.html ** Bazaar stuff *** You can use `bzr commit --fixes debbugs:123' to mark that a commit fixes -Emacs bug 123. You will first need to add a line to your ~/bazaar.conf -or ~/locations.conf: +Emacs bug 123. You will first need to add a line to one of your +configuration files, ~/.bazaar/bazaar.conf or ~/.bazaar/locations.conf: bugtracker_debbugs_url = http://debbugs.gnu.org/{id} From 3e99b8257bc97f34595128b200e25b76a2fe560f Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 21 Nov 2010 13:07:47 -0500 Subject: [PATCH 11/30] Document byte-to-string in Lisp manual. * objects.texi (Symbol Type): * text.texi (Near Point): * help.texi (Help Functions): * functions.texi (Mapping Functions): Use string instead of char-to-string in examples. * nonascii.texi (Converting Representations): Document byte-to-string. * strings.texi (Creating Strings): Don't mention semi-obsolete function char-to-string. (String Conversion): Shorten discussion of semi-obsolete function string-to-char. Link to Converting Representations. --- doc/lispref/ChangeLog | 16 ++++++++++ doc/lispref/functions.texi | 2 +- doc/lispref/help.texi | 2 +- doc/lispref/nonascii.texi | 7 +++++ doc/lispref/objects.texi | 1 - doc/lispref/strings.texi | 63 +++++++++++++++----------------------- doc/lispref/text.texi | 6 ++-- etc/NEWS | 1 + 8 files changed, 54 insertions(+), 44 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 2ea15fe3ca8..959f4844c1c 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,19 @@ +2010-11-21 Chong Yidong + + * nonascii.texi (Converting Representations): Document + byte-to-string. + + * strings.texi (Creating Strings): Don't mention semi-obsolete + function char-to-string. + (String Conversion): Shorten discussion of semi-obsolete function + string-to-char. Link to Converting Representations. + + * objects.texi (Symbol Type): + * text.texi (Near Point): + * help.texi (Help Functions): + * functions.texi (Mapping Functions): Use string instead of + char-to-string in examples. + 2010-11-20 Chong Yidong * text.texi (Kill Functions, Kill Functions) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 6f3fd63013c..635245426fb 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -818,7 +818,7 @@ length of @var{sequence}. For example: @result{} (a c e) (mapcar '1+ [1 2 3]) @result{} (2 3 4) -(mapcar 'char-to-string "abc") +(mapcar 'string "abc") @result{} ("a" "b" "c") @end group diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 026258f2472..31a4db31dc9 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi @@ -551,7 +551,7 @@ follows: @smallexample @group -(define-key global-map (char-to-string help-char) 'help-command) +(define-key global-map (string help-char) 'help-command) (fset 'help-command help-map) @end group @end smallexample diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index dfcb3e4730b..f8d98cb1ad9 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi @@ -202,6 +202,13 @@ unibyte string, it is returned unchanged. Use this function for characters. @end defun +@defun byte-to-string byte +@cindex byte to string +This function returns a unibyte string containing a single byte of +character data, @var{character}. It signals a error if +@var{character} is not an integer between 0 and 255. +@end defun + @defun multibyte-char-to-unibyte char This converts the multibyte character @var{char} to a unibyte character, and returns that character. If @var{char} is neither diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index c8ccb15a2d3..8f72cc01680 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -582,7 +582,6 @@ makes it invalid as a number. @group foo ; @r{A symbol named @samp{foo}.} FOO ; @r{A symbol named @samp{FOO}, different from @samp{foo}.} -char-to-string ; @r{A symbol named @samp{char-to-string}.} @end group @group 1+ ; @r{A symbol named @samp{1+}} diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 1128ca87d8a..94d2765a833 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -126,9 +126,8 @@ This function returns a string made up of @var{count} repetitions of @result{} "" @end example - Other functions to compare with this one include @code{char-to-string} -(@pxref{String Conversion}), @code{make-vector} (@pxref{Vectors}), and -@code{make-list} (@pxref{Building Lists}). + Other functions to compare with this one include @code{make-vector} +(@pxref{Vectors}) and @code{make-list} (@pxref{Building Lists}). @end defun @defun string &rest characters @@ -565,38 +564,6 @@ of text characters and general input events (@code{single-key-description} and @code{text-char-description}). These are used primarily for making help messages. -@defun char-to-string character -@cindex character to string -This function returns a new string containing one character, -@var{character}. This function is semi-obsolete because the function -@code{string} is more general. @xref{Creating Strings}. -@end defun - -@defun string-to-char string -@cindex string to character - This function returns the first character in @var{string}. If the -string is empty, the function returns 0. The value is also 0 when the -first character of @var{string} is the null character, @acronym{ASCII} code -0. - -@example -(string-to-char "ABC") - @result{} 65 - -(string-to-char "xyz") - @result{} 120 -(string-to-char "") - @result{} 0 -@group -(string-to-char "\000") - @result{} 0 -@end group -@end example - -This function may be eliminated in the future if it does not seem useful -enough to retain. -@end defun - @defun number-to-string number @cindex integer to string @cindex integer to decimal @@ -657,21 +624,41 @@ this function returns 0. @findex string-to-int @code{string-to-int} is an obsolete alias for this function. +@end defun + +@defun char-to-string character +@cindex character to string +This function returns a new string containing one character, +@var{character}. This function is semi-obsolete because the function +@code{string} is more general. @xref{Creating Strings}. +@end defun + +@defun string-to-char string + This function returns the first character in @var{string}. This +mostly identical to @code{(aref string 0)}, except that it returns 0 +if the string is empty. (The value is also 0 when the first character +of @var{string} is the null character, @acronym{ASCII} code 0.) This +function may be eliminated in the future if it does not seem useful +enough to retain. @end defun Here are some other functions that can convert to or from a string: @table @code @item concat -@code{concat} can convert a vector or a list into a string. +This function converts a vector or a list into a string. @xref{Creating Strings}. @item vconcat -@code{vconcat} can convert a string into a vector. @xref{Vector +This function converts a string into a vector. @xref{Vector Functions}. @item append -@code{append} can convert a string into a list. @xref{Building Lists}. +This function converts a string into a list. @xref{Building Lists}. + +@item byte-to-string +This function converts a byte of character data into a unibyte string. +@xref{Converting Representations}. @end table @node Formatting Strings diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 025bf1b6f85..57bf4825887 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -86,7 +86,7 @@ buffer is @samp{@@}: @example @group -(char-to-string (char-after 1)) +(string (char-after 1)) @result{} "@@" @end group @end example @@ -121,9 +121,9 @@ but there is no peace. @end group @group -(char-to-string (preceding-char)) +(string (preceding-char)) @result{} "a" -(char-to-string (following-char)) +(string (following-char)) @result{} "c" @end group @end example diff --git a/etc/NEWS b/etc/NEWS index 4a7b9a5259f..6e152777aee 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -108,6 +108,7 @@ starting from the first line of text below the header line. +++ ** The yank-handler argument to kill-region and friends is now obsolete. ++++ ** New function byte-to-string, like char-to-string but for bytes. From 35f1de62f2ab87e39c4a058cb34668727e9a9c42 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 21 Nov 2010 13:16:19 -0500 Subject: [PATCH 12/30] * editfns.c (Fbyte_to_string): Signal an error if arg is not a byte. --- src/ChangeLog | 4 ++++ src/editfns.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4655ea714ad..f986c03cc14 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-21 Chong Yidong + + * editfns.c (Fbyte_to_string): Signal an error arg is not a byte. + 2010-11-20 Jan Djärv * gtkutil.c (menubar_map_cb): New function (Bug#7425). diff --git a/src/editfns.c b/src/editfns.c index ea279a462f2..910fd13aed4 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -222,12 +222,14 @@ usage: (char-to-string CHAR) */) } DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, - doc: /* Convert arg BYTE to a string containing that byte. */) + doc: /* Convert arg BYTE to a unibyte string containing that byte. */) (byte) Lisp_Object byte; { unsigned char b; CHECK_NUMBER (byte); + if (XINT (byte) < 0 || XINT (byte) > 255) + error ("Invalid byte"); b = XINT (byte); return make_string_from_bytes (&b, 1, 1); } From f102b34567441421ca647afff52943a225f8062a Mon Sep 17 00:00:00 2001 From: Ulrich Mueller Date: Sun, 21 Nov 2010 14:03:51 -0500 Subject: [PATCH 13/30] * etc/HELLO: Add ancient Greek (Bug#7418). --- etc/ChangeLog | 4 ++++ etc/HELLO | 1 + 2 files changed, 5 insertions(+) diff --git a/etc/ChangeLog b/etc/ChangeLog index 0bc42469dd5..384b276a285 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2010-11-21 Ulrich Mueller + + * HELLO: Add ancient Greek (Bug#7418). + 2010-10-20 Richard Stallman * DISTRIB: Update donation section. diff --git a/etc/HELLO b/etc/HELLO index c7bd5ebe449..348dcfa3ad6 100644 --- a/etc/HELLO +++ b/etc/HELLO @@ -33,6 +33,7 @@ French (fran,Ag(Bais) Bonjour / Salut Georgian ($,1JEJ0J@J7J5J4J:J8(B) $,1J2J0J;J0J@JOJ=J1J0(B German (Deutsch) Guten Tag / Gr,A|_(B Gott Greek (,Fekkgmij\(B) ,FCei\(B ,Fsar(B +Greek, ancient ($,1p1,Fkkgmij^(B) ,FO$,1pv,Fk](B ,Fte(B ,Fja$,1q6(B ,Fl]ca(B ,Fwa$,1r6,Fqe(B Gujarati ($,19W:!9\9p9~9d: (B) $,19h9n9x:-9d:'(B Hebrew (,Hzixar(B) ,Hylem(B Hungarian (magyar) Sz,Bi(Bp j,Bs(B napot! From 96ad0af7411d61d6ae3e7afcab1b3996dd0ef1d4 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 21 Nov 2010 19:39:42 -0500 Subject: [PATCH 14/30] Fix image cache marking bug (Bug#6301). * src/alloc.c (mark_terminals): Ensure that the image cache is marked even if the terminal object was marked earlier (Bug#6301). --- src/ChangeLog | 5 +++++ src/alloc.c | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f986c03cc14..0aa7e869c39 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-22 YAMAMOTO Mitsuharu + + * alloc.c (mark_terminals): Ensure that the image cache is marked + even if the terminal object was marked earlier (Bug#6301). + 2010-11-21 Chong Yidong * editfns.c (Fbyte_to_string): Signal an error arg is not a byte. diff --git a/src/alloc.c b/src/alloc.c index da63fe0f82b..4d19d3ac479 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -5771,13 +5771,14 @@ mark_terminals (void) for (t = terminal_list; t; t = t->next_terminal) { eassert (t->name != NULL); - if (!VECTOR_MARKED_P (t)) - { #ifdef HAVE_WINDOW_SYSTEM - mark_image_cache (t->image_cache); + /* If a terminal object is reachable from a stacpro'ed object, + it might have been marked already. Make sure the image cache + gets marked. */ + mark_image_cache (t->image_cache); #endif /* HAVE_WINDOW_SYSTEM */ - mark_vectorlike ((struct Lisp_Vector *)t); - } + if (!VECTOR_MARKED_P (t)) + mark_vectorlike ((struct Lisp_Vector *)t); } } From 0c3b672775df3ba6f1f165e5565765a29ce5616d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 22 Nov 2010 05:52:49 +0200 Subject: [PATCH 15/30] bugtracker: REALLY correct locations of bzr *.conf files. --- admin/notes/bugtracker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker index 0ef89739b19..ca71214cdcc 100644 --- a/admin/notes/bugtracker +++ b/admin/notes/bugtracker @@ -466,7 +466,7 @@ In the locations.conf file, it should go into the branch-specific configuration section for the branch where you want this to be in effect. For example, if you want this to be in effect for the branch located at `/home/projects/emacs/trunk', you need to have this in your -~/locations.conf file: +~/.bazaar/locations.conf file: [/home/projects/emacs/trunk] bugtracker_debbugs_url = http://debbugs.gnu.org/{id} From b8e5cf1da0ef8f5e3cc37dd4276fe813f0305182 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 22 Nov 2010 20:09:29 +0200 Subject: [PATCH 16/30] Back-port 2010-09-17T21:34:45Z!eliz@gnu.org from the trunk, to resolve bug #7452. w32.c (_PROCESS_MEMORY_COUNTERS_EX): Don't define with versions of w32api >= 3.15. --- src/ChangeLog | 5 +++++ src/w32.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 0aa7e869c39..cc7e302d733 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-22 Eli Zaretskii + + * w32.c (_PROCESS_MEMORY_COUNTERS_EX): Don't define with versions + of w32api >= 3.15. (Bug#6989) (Bug#7452) + 2010-11-22 YAMAMOTO Mitsuharu * alloc.c (mark_terminals): Ensure that the image cache is marked diff --git a/src/w32.c b/src/w32.c index d96abd346f5..1b01a631850 100644 --- a/src/w32.c +++ b/src/w32.c @@ -94,8 +94,11 @@ typedef struct _MEMORY_STATUS_EX { #include #include +#include +#if !defined(__MINGW32__) || __W32API_MAJOR_VERSION < 3 || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 15) /* This either is not in psapi.h or guarded by higher value of - _WIN32_WINNT than what we use. */ + _WIN32_WINNT than what we use. w32api supplied with MinGW 3.15 + defines it in psapi.h */ typedef struct _PROCESS_MEMORY_COUNTERS_EX { DWORD cb; DWORD PageFaultCount; @@ -109,6 +112,7 @@ typedef struct _PROCESS_MEMORY_COUNTERS_EX { DWORD PeakPagefileUsage; DWORD PrivateUsage; } PROCESS_MEMORY_COUNTERS_EX,*PPROCESS_MEMORY_COUNTERS_EX; +#endif #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */ #include From 17a6e2788d7b2b9f95bef9af3cf6b49786ebc0a1 Mon Sep 17 00:00:00 2001 From: Bob Rogers Date: Tue, 23 Nov 2010 00:18:26 -0800 Subject: [PATCH 17/30] Small VC fixes for doc/emacs. * doc/emacs/maintaining.texi (VC With A Locking VCS, VC Directory Commands): * doc/emacs/vc1-xtra.texi (Customizing VC, General VC Options): Small fixes. --- doc/emacs/ChangeLog | 5 +++++ doc/emacs/maintaining.texi | 5 +++-- doc/emacs/vc1-xtra.texi | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index db27d5c46f0..91cabc40c9d 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2010-11-23 Bob Rogers + + * maintaining.texi (VC With A Locking VCS, VC Directory Commands): + * vc1-xtra.texi (Customizing VC, General VC Options): Small fixes. + 2010-11-21 Chong Yidong * maintaining.texi (Version Control Systems): Fix repeated sentence. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 68e521be4ca..a2240330a9d 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -524,7 +524,7 @@ locked the file, to inform him of what has happened. @end itemize These rules also apply when you use CVS in locking mode, except -that there is no such thing as stealing a lock. +that CVS does not support stealing a lock. @node Advanced C-x v v @subsubsection Advanced Control in @kbd{C-x v v} @@ -1161,7 +1161,8 @@ directory buffer will be used. @kbd{M-s a C-s} does an incremental search on the marked files. - @kbd{M-s a C-M-s} does an incremental search on the marked files. + @kbd{M-s a C-M-s} does an incremental regular expression search +on the marked files. @cindex stashes in version control @cindex shelves in version control diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi index 5095c3f4764..04d37719013 100644 --- a/doc/emacs/vc1-xtra.texi +++ b/doc/emacs/vc1-xtra.texi @@ -594,7 +594,7 @@ headers. @vindex vc-handled-backends The variable @code{vc-handled-backends} determines which version control systems VC should handle. The default value is @code{(RCS CVS -SVN SCCS BZR GIT HG Arch)}, so it contains all the version systems +SVN SCCS Bzr Git Hg Mtn Arch)}, so it contains all the version systems that are currently supported. If you want VC to ignore one or more of these systems, exclude its name from the list. To disable VC entirely, set this variable to @code{nil}. @@ -657,8 +657,8 @@ variable does not affect @kbd{C-x v c}; that operation is so drastic that it should always ask for confirmation.) @vindex vc-command-messages - VC mode does much of its work by running the shell commands for RCS, -CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC + VC mode does much of its work by running the shell commands for the +appropriate backend. If @code{vc-command-messages} is non-@code{nil}, VC displays messages to indicate which shell commands it runs, and additional messages when the commands finish. From f98a3c94837dbaccfed3d6ea52931a985f7db9df Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 23 Nov 2010 01:16:40 -0800 Subject: [PATCH 18/30] ChangeLog fix for initial nxml import. --- lisp/ChangeLog.13 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog.13 b/lisp/ChangeLog.13 index c5a51f813a7..3d8a2b0aa3b 100644 --- a/lisp/ChangeLog.13 +++ b/lisp/ChangeLog.13 @@ -6680,8 +6680,9 @@ buffer if the parent buffer is in vc-dired-mode. 2007-11-23 Mark A. Hershberger + James Clark - * nxml: Initial merge of nxml. Kept nxml/char-name subdir for now. + * nxml/: Initial merge of nxml. Kept nxml/char-name subdir for now. 2007-11-23 Juri Linkov @@ -16693,10 +16694,9 @@ See ChangeLog.12 for earlier changes. ;; Local Variables: ;; coding: utf-8 -;; add-log-time-zone-rule: t ;; End: - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -16712,5 +16712,3 @@ See ChangeLog.12 for earlier changes. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . - -;; arch-tag: 1e8aa93a-fc6c-4ac3-9b10-1f445e1840af From d3dfb185aef3ed50fb5a5ab41d8093392c090728 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 23 Nov 2010 01:19:57 -0800 Subject: [PATCH 19/30] * doc/misc/nxml-mode.texi (Introduction): New section. This summarizes the still-relevant information from the standalone nxml README fle, mistakenly removed in the initial import of nxml-mode. See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01716.html and associated thread, also bug#7456. --- doc/misc/ChangeLog | 5 ++++ doc/misc/nxml-mode.texi | 59 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index a47dff59e93..8b2f3b07999 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2010-11-23 Glenn Morris + James Clark + + * nxml-mode.texi (Introduction): New section. + 2010-11-10 Glenn Morris * edt.texi: Remove information about Emacs 19. diff --git a/doc/misc/nxml-mode.texi b/doc/misc/nxml-mode.texi index 423bdc85a24..c22ba6e0f9f 100644 --- a/doc/misc/nxml-mode.texi +++ b/doc/misc/nxml-mode.texi @@ -8,7 +8,8 @@ This manual documents nxml-mode, an Emacs major mode for editing XML with RELAX NG support. -Copyright @copyright{} 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright @copyright{} 2007, 2008, 2009, 2010 +Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -43,6 +44,7 @@ license to the document, as described in section 6 of the license. This manual is not yet complete. @menu +* Introduction:: * Completion:: * Inserting end-tags:: * Paragraphs:: @@ -52,6 +54,58 @@ This manual is not yet complete. * Limitations:: @end menu +@node Introduction +@chapter Introduction + +nXML mode is an Emacs major-mode for editing XML documents. It supports +editing well-formed XML documents, and provides schema-sensitive editing +using RELAX NG Compact Syntax. To get started, visit a file containing an +XML document, and, if necessary, use @kbd{M-x nxml-mode} to switch to nXML +mode. By default, @code{auto-mode-alist} and @code{magic-fallback-alist} +put buffers in nXML mode if they have recognizable XML content or file +extensions. You may wish to customize the settings, for example to +recognize different file extensions. + +Once in nXML mode, you can type @kbd{C-h m} for basic information on the +mode. + +The @file{etc/nxml} directory in the Emacs distribution contains some data +files used by nXML mode, and includes two files (@file{test.valid.xml} and +@file{test.invalid.xml}) that provide examples of valid and invalid XML +documents. + +To get validation and schema-sensitive editing, you need a RELAX NG Compact +Syntax (RNC) schema for your document (@pxref{Locating a schema}). The +@file{etc/schema} directory includes some schemas for popular document +types. See @url{http://relaxng.org/} for more information on RELAX NG. +You can use the @samp{Trang} program from +@url{http://www.thaiopensource.com/relaxng/trang.html} to +automatically create RNC schemas. This program can: + +@itemize @bullet +@item +infer an RNC schema from an instance document; +@item +convert a DTD to an RNC schema; +@item +convert a RELAX NG XML syntax schema to an RNC schema. +@end itemize + +@noindent To convert a RELAX NG XML syntax (@samp{.rng}) schema to a RNC +one, you can also use the XSLT stylesheet from +@url{http://www.pantor.com/download.html}. + +To convert a W3C XML Schema to an RNC schema, you need first to convert it +to RELAX NG XML syntax using Sun's RELAX NG converter tool @code{rngconv} +(built on top of MSV). See @url{https://github.com/kohsuke/msv} +and @url{https://msv.dev.java.net/}. + +For historical discussions only, see the mailing list archives at +@url{http://groups.yahoo.com/group/emacs-nxml-mode/}. Please make all new +discussions on the @samp{help-gnu-emacs} and @samp{emacs-devel} mailing +lists. Report any bugs with @kbd{M-x report-emacs-bug}. + + @node Completion @chapter Completion @@ -855,6 +909,3 @@ specification are not enforced. @bye -@ignore - arch-tag: 3b6e8ac2-ae8d-4f38-bd43-ce9f80be04d6 -@end ignore From 4d47208a22c200215abd719adbd830799ff42397 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 23 Nov 2010 10:16:21 -0800 Subject: [PATCH 20/30] Tweak previous nxml doc change. --- doc/misc/ChangeLog | 2 +- doc/misc/nxml-mode.texi | 2 +- lisp/ChangeLog.13 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 8b2f3b07999..bb211e7ffca 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,5 +1,5 @@ 2010-11-23 Glenn Morris - James Clark + James Clark * nxml-mode.texi (Introduction): New section. diff --git a/doc/misc/nxml-mode.texi b/doc/misc/nxml-mode.texi index c22ba6e0f9f..d076f0dd820 100644 --- a/doc/misc/nxml-mode.texi +++ b/doc/misc/nxml-mode.texi @@ -96,7 +96,7 @@ one, you can also use the XSLT stylesheet from @url{http://www.pantor.com/download.html}. To convert a W3C XML Schema to an RNC schema, you need first to convert it -to RELAX NG XML syntax using Sun's RELAX NG converter tool @code{rngconv} +to RELAX NG XML syntax using the RELAX NG converter tool @code{rngconv} (built on top of MSV). See @url{https://github.com/kohsuke/msv} and @url{https://msv.dev.java.net/}. diff --git a/lisp/ChangeLog.13 b/lisp/ChangeLog.13 index 3d8a2b0aa3b..b561ba75ba5 100644 --- a/lisp/ChangeLog.13 +++ b/lisp/ChangeLog.13 @@ -6680,7 +6680,7 @@ buffer if the parent buffer is in vc-dired-mode. 2007-11-23 Mark A. Hershberger - James Clark + James Clark * nxml/: Initial merge of nxml. Kept nxml/char-name subdir for now. From e40fc7451704a1d868f9ce5282d759dffc9d9126 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 23 Nov 2010 20:52:25 +0100 Subject: [PATCH 21/30] * net/tramp.el (tramp-default-method-alist) (tramp-default-user-alist, tramp-default-proxies-alist): Adapt custom options type. (Bug#7445) --- lisp/ChangeLog | 6 ++++++ lisp/net/tramp.el | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index add4b50bfbd..cc15db8feac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-11-23 Michael Albinus + + * net/tramp.el (tramp-default-method-alist) + (tramp-default-user-alist, tramp-default-proxies-alist): Adapt + custom options type. (Bug#7445) + 2010-11-21 Chong Yidong * progmodes/python.el: Add Ipython support (Bug#5390). diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e0f25ffd1f3..a9733fc6a0f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -814,9 +814,9 @@ empty string for the user name. See `tramp-methods' for a list of possibilities for METHOD." :group 'tramp - :type '(repeat (list (regexp :tag "Host regexp") - (regexp :tag "User regexp") - (string :tag "Method")))) + :type '(repeat (list (choice :tag "Host regexp" regexp sexp) + (choice :tag "User regexp" regexp sexp) + (choice :tag "Method name" string (const nil))))) (defcustom tramp-default-user nil @@ -842,9 +842,9 @@ matches, the variable `tramp-default-user' takes effect. If the file name does not specify the method, lookup is done using the empty string for the method name." :group 'tramp - :type '(repeat (list (regexp :tag "Method regexp") - (regexp :tag "Host regexp") - (string :tag "User")))) + :type '(repeat (list (choice :tag "Method regexp" regexp sexp) + (choice :tag " Host regexp" regexp sexp) + (choice :tag " User name" string (const nil))))) (defcustom tramp-default-host (system-name) @@ -870,7 +870,7 @@ interpreted as a regular expression which always matches." :group 'tramp :type '(repeat (list (choice :tag "Host regexp" regexp sexp) (choice :tag "User regexp" regexp sexp) - (choice :tag "Proxy remote name" string (const nil))))) + (choice :tag " Proxy name" string (const nil))))) (defconst tramp-local-host-regexp (concat From 33aeea0eb66921329fde41e14cfda2565c6bad6d Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 23 Nov 2010 21:21:55 -0500 Subject: [PATCH 22/30] * progmodes/which-func.el (which-func-imenu-joiner-function): Return a string, as expected. (which-function-mode): Make sure we stop any previous timer before starting a new one. --- lisp/ChangeLog | 209 ++++++++++++++++++----------------- lisp/progmodes/which-func.el | 8 +- 2 files changed, 113 insertions(+), 104 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cc15db8feac..fc460eaaf3d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,8 +1,15 @@ +2010-11-24 Stefan Monnier + + * progmodes/which-func.el (which-func-imenu-joiner-function): + Return a string, as expected. + (which-function-mode): Make sure we stop any previous timer before + starting a new one. + 2010-11-23 Michael Albinus * net/tramp.el (tramp-default-method-alist) - (tramp-default-user-alist, tramp-default-proxies-alist): Adapt - custom options type. (Bug#7445) + (tramp-default-user-alist, tramp-default-proxies-alist): + Adapt custom options type. (Bug#7445) 2010-11-21 Chong Yidong @@ -10,8 +17,8 @@ (python-shell-prompt-alist) (python-shell-continuation-prompt-alist): New options. (python--set-prompt-regexp): New function. - (inferior-python-mode, run-python, python-shell): Require - ansi-color. Use python--set-prompt-regexp to set the comint + (inferior-python-mode, run-python, python-shell): + Require ansi-color. Use python--set-prompt-regexp to set the comint prompt based on the Python interpreter. (python--prompt-regexp): New var. (python-check-comint-prompt) @@ -455,8 +462,8 @@ character pins, bug264. Reported by Michael Laajanen. (verilog-auto-inst, verilog-read-decls, verilog-read-sub-decls) (verilog-read-sub-decls-in-interfaced, verilog-read-sub-decls-sig) - (verilog-subdecls-get-interfaced, verilog-subdecls-new): Support - interfaces with AUTOINST, bug270. Reported by Luis Gutierrez. + (verilog-subdecls-get-interfaced, verilog-subdecls-new): + Support interfaces with AUTOINST, bug270. Reported by Luis Gutierrez. (verilog-pretty-expr): Fix interactive arguments, bug272. Reported by Mark Johnson. (verilog-auto-tieoff, verilog-auto-tieoff-ignore-regexp): @@ -502,8 +509,8 @@ (verilog-auto-sense-sigs, verilog-read-always-signals) (verilog-read-always-signals-recurse): Fix loop indexes being AUTORESET. AUTORESET now assumes any variables in the - initialization section of a for() should be ignored. Reported by - Dan Dever. + initialization section of a for() should be ignored. + Reported by Dan Dever. (verilog-error-font-lock-keywords) (verilog-error-regexp-emacs-alist) (verilog-error-regexp-xemacs-alist): Fix error detection of @@ -1478,7 +1485,8 @@ Fix annotating other revisions for renamed files in vc-annotate. * vc-annotate.el (vc-annotate): Add an optional argument for the VC backend. Use it when non-nil. - (vc-annotate-warp-revision): Pass the VC backend to vc-annotate. (Bug#6487) + (vc-annotate-warp-revision): Pass the VC backend to vc-annotate + (Bug#6487). Fix vc-annotate-show-changeset-diff-revision-at-line for git. * vc-annotate.el (vc-annotate-show-diff-revision-at-line-internal): @@ -2074,8 +2082,8 @@ 2010-02-28 Michael Albinus * net/dbus.el (dbus-introspect, dbus-get-property) - (dbus-set-property, dbus-get-all-properties): Use - `dbus-call-method' when noninteractive. (Bug#5645) + (dbus-set-property, dbus-get-all-properties): + Use `dbus-call-method' when noninteractive. (Bug#5645) 2010-02-28 Chong Yidong @@ -2138,8 +2146,8 @@ 2010-02-21 Chong Yidong - * files.el (directory-listing-before-filename-regexp): Use - stricter matching for iso-style dates, to avoid false matches with + * files.el (directory-listing-before-filename-regexp): + Use stricter matching for iso-style dates, to avoid false matches with date-like filenames (Bug#5597). * htmlfontify.el (htmlfontify): Doc fix. @@ -2162,8 +2170,8 @@ 2010-02-19 Chong Yidong - * isearch.el (isearch-update-post-hook, isearch-update): Revert - 2010-02-17 change. + * isearch.el (isearch-update-post-hook, isearch-update): + Revert 2010-02-17 change. 2010-02-19 Ulf Jasper @@ -2398,7 +2406,8 @@ 2010-02-06 Dan Nicolaescu - * vc-bzr.el (vc-bzr-dir-extra-headers): Disable the pending merges header. + * vc-bzr.el (vc-bzr-dir-extra-headers): + Disable the pending merges header. 2010-02-05 Juri Linkov @@ -2629,8 +2638,8 @@ (vc-git-toggle-signoff): Remove function. (vc-git-extra-menu-map): Do not bind vc-git-toggle-signoff. - * term/xterm.el (xterm-maybe-set-dark-background-mode): Rename - from xterm-set-background-mode. Return t if the background mode + * term/xterm.el (xterm-maybe-set-dark-background-mode): + Rename from xterm-set-background-mode. Return t if the background mode was set. (terminal-init-xterm): Move tty-set-up-initial-frame-faces earlier, call it again in case the background mode has changed. @@ -2677,8 +2686,8 @@ 2010-01-21 Alan Mackenzie Fix a situation where deletion of a cpp construct throws an error. - * progmodes/cc-engine.el (c-invalidate-state-cache): Before - invoking c-with-all-but-one-cpps-commented-out, check that the + * progmodes/cc-engine.el (c-invalidate-state-cache): + Before invoking c-with-all-but-one-cpps-commented-out, check that the special cpp construct is still in the buffer. (c-parse-state): Record the special cpp with markers, not numbers. @@ -2794,8 +2803,8 @@ 2010-01-16 Lennart Borgman - * nxml/nxml-mode.el (nxml-extend-after-change-region): Never - return t (Bug#3898). + * nxml/nxml-mode.el (nxml-extend-after-change-region): + Never return t (Bug#3898). 2010-01-16 Frédéric Perrin (tiny change) @@ -2912,8 +2921,8 @@ 2010-01-12 Glenn Morris - * mail/emacsbug.el (report-emacs-bug-pretest-address): Set - it to bug-gnu-emacs rather than emacs-pretest-bug. + * mail/emacsbug.el (report-emacs-bug-pretest-address): + Set it to bug-gnu-emacs rather than emacs-pretest-bug. 2010-01-11 Sam Steingold @@ -3227,8 +3236,8 @@ 2009-12-29 Dan Nicolaescu Make vc-dir work on subdirectories of the bzr root. - * vc-bzr.el (vc-bzr-after-dir-status): Add new argument. Return - file names relative to it. + * vc-bzr.el (vc-bzr-after-dir-status): Add new argument. + Return file names relative to it. (vc-bzr-dir-status, vc-bzr-dir-status-files): Pass the bzr root relative directory to vc-bzr-after-dir-status. @@ -3286,8 +3295,8 @@ 2009-12-18 Ulf Jasper - * calendar/icalendar.el (icalendar--convert-tz-offset): Fixed - timezone names. + * calendar/icalendar.el (icalendar--convert-tz-offset): + Fixed timezone names. (icalendar--convert-tz-offset): Fixed the "last-day-problem". (icalendar--add-diary-entry): Remove the trailing blank that diary-make-entry inserts. @@ -3322,8 +3331,8 @@ * files.el (hack-local-variables-filter): While ignoring duplicates, don't take `mode' into account. - (hack-local-variables-filter, hack-dir-local-variables): Don't - remove duplicate `mode' from local-variables-alist (like `eval'). + (hack-local-variables-filter, hack-dir-local-variables): + Don't remove duplicate `mode' from local-variables-alist (like `eval'). 2009-12-17 Juri Linkov @@ -3470,8 +3479,8 @@ 2009-12-10 Vinicius Jose Latorre - * whitespace.el (whitespace-display-char-on): Ensure - `buffer-display-table' is unique when two or more windows are + * whitespace.el (whitespace-display-char-on): + Ensure `buffer-display-table' is unique when two or more windows are visible. Reported by Martin Pohlack . New version 12.1. @@ -3688,11 +3697,11 @@ (tramp-methods, tramp-find-shell) (tramp-open-connection-setup-interactive-shell) (tramp-maybe-open-connection): Use it. - (tramp-shell-prompt-pattern, tramp-wait-for-output): Handle - existence of `#' and `$'. + (tramp-shell-prompt-pattern, tramp-wait-for-output): + Handle existence of `#' and `$'. - * net/tramp-fish.el (tramp-fish-maybe-open-connection): Use - `tramp-initial-end-of-output'. + * net/tramp-fish.el (tramp-fish-maybe-open-connection): + Use `tramp-initial-end-of-output'. 2009-12-07 Dan Nicolaescu @@ -3750,13 +3759,13 @@ 2009-12-06 Ulf Jasper - * xml.el (xml-substitute-numeric-entities): Move - newsticker--decode-numeric-entities in newst-backend.el to + * xml.el (xml-substitute-numeric-entities): + Move newsticker--decode-numeric-entities in newst-backend.el to xml-substitute-numeric-entities in xml.el. (Bug#5008) * net/newst-backend.el (newsticker--parse-generic-feed) (newsticker--parse-generic-items) - (newsticker--decode-numeric-entities): Move - newsticker--decode-numeric-entities in newst-backend.el to + (newsticker--decode-numeric-entities): + Move newsticker--decode-numeric-entities in newst-backend.el to xml-substitute-numeric-entities in xml.el. (Bug#5008) 2009-12-06 Daniel Colascione @@ -3819,8 +3828,8 @@ 2009-12-05 Kevin Ryde - * textmodes/sgml-mode.el (sgml-lexical-context): Recognise - comment-start-skip to comment-end-skip as comment (Bug#4781). + * textmodes/sgml-mode.el (sgml-lexical-context): + Recognise comment-start-skip to comment-end-skip as comment (Bug#4781). 2009-12-05 Juri Linkov @@ -4277,8 +4286,8 @@ (doc-view-scroll-up-or-next-page) (doc-view-scroll-down-or-previous-page) (doc-view-next-line-or-next-page) - (doc-view-previous-line-or-previous-page): Rename - `doc-view-continuous-mode' to `doc-view-continuous'. (Bug#4896) + (doc-view-previous-line-or-previous-page): + Rename `doc-view-continuous-mode' to `doc-view-continuous'. (Bug#4896) 2009-11-30 Juri Linkov @@ -4480,8 +4489,8 @@ (verilog-auto-inst, verilog-auto-star-safe) (verilog-delete-auto-star-implicit, verilog-read-sub-decls): - Fix removing "// Interfaces" when saving .* expansions. Reported by - Pierre-David Pfister. + Fix removing "// Interfaces" when saving .* expansions. + Reported by Pierre-David Pfister. 2009-11-26 Glenn Morris @@ -5659,12 +5668,12 @@ (tramp-compat-delete-directory): New defuns. * net/tramp-fish.el (tramp-fish-handle-delete-directory): - * net/tramp-gvfs.el (tramp-gvfs-handle-delete-directory): Use - `tramp-compat-delete-directory'. + * net/tramp-gvfs.el (tramp-gvfs-handle-delete-directory): + Use `tramp-compat-delete-directory'. * net/tramp-smb.el (tramp-smb-handle-copy-directory) - (tramp-smb-handle-delete-directory): Use - `tramp-compat-copy-directory' and `tramp-compat-delete-directory'. + (tramp-smb-handle-delete-directory): + Use `tramp-compat-copy-directory' and `tramp-compat-delete-directory'. * net/trampver.el: Update release number. @@ -6016,11 +6025,11 @@ 2009-10-31 Chong Yidong - * international/mule-diag.el (list-character-sets-1): Minor - message fix (Bug#3526). + * international/mule-diag.el (list-character-sets-1): + Minor message fix (Bug#3526). - * progmodes/etags.el (etags-list-tags, etags-tags-apropos): Fix - face property (Bug#4834). + * progmodes/etags.el (etags-list-tags, etags-tags-apropos): + Fix face property (Bug#4834). (etags-list-tags, etags-tags-apropos-additional) (etags-tags-apropos, tags-select-tags-table): Add follow-link property. @@ -6517,8 +6526,8 @@ 2009-10-23 Jay Belanger - * calc/calc.el (math-read-number, math-read-number-simple): Use - `save-match-data'. + * calc/calc.el (math-read-number, math-read-number-simple): + Use `save-match-data'. 2009-10-22 Stefan Monnier @@ -7812,8 +7821,8 @@ 2009-09-26 Alan Mackenzie - * progmodes/cc-engine.el (c-beginning-of-statement-1): Correct - buggy bracketing. (Bug#4289) + * progmodes/cc-engine.el (c-beginning-of-statement-1): + Correct buggy bracketing. (Bug#4289) * progmodes/cc-langs.el (c-nonlabel-token-key): Allow quoted character constants (as case labels). (Bug#4289) @@ -8196,8 +8205,8 @@ 2009-09-21 Chong Yidong - * files.el (conf-mode-maybe, magic-fallback-mode-alist): Use - nxml-mode instead of xml-mode. + * files.el (conf-mode-maybe, magic-fallback-mode-alist): + Use nxml-mode instead of xml-mode. 2009-09-21 Kevin Ryde @@ -9018,8 +9027,8 @@ * net/tramp.el (tramp-handle-insert-directory): Handle "--dired" also when adding a new directory. - * net/tramp-compat.el (tramp-compat-line-beginning-position): New - defun. + * net/tramp-compat.el (tramp-compat-line-beginning-position): + New defun. 2009-09-04 Stefan Monnier @@ -10346,8 +10355,8 @@ (gdb-control-current-thread): Interactive setters for `gdb-gud-control-all-threads' to use in menu. (gdb-show-run-p): Show «Go» when process is not active. - (gud-tool-bar-map): Add non-stop/A,T indicator. Uses - gud/thread.xpm and gud/all.xpm. + (gud-tool-bar-map): Add non-stop/A,T indicator. + Uses gud/thread.xpm and gud/all.xpm. 2009-08-08 Yoni Rabkin @@ -10371,8 +10380,8 @@ (gdb-breakpoints-mode-map): Don't assume threads buffer is present. (gdb-threads-mode-map): Don't assume breakpoints buffer is present. (gdb-disassembly-handler-custom, gdb-stack-list-frames-custom) - (gdb-locals-handler-custom, gdb-registers-handler-custom): Thread - info in mode name. + (gdb-locals-handler-custom, gdb-registers-handler-custom): + Thread info in mode name. (gdb-registers-mode-map): TAB to switch to locals. 2009-08-08 Eli Zaretskii @@ -10387,14 +10396,14 @@ 2009-08-07 Eli Zaretskii - * mail/sendmail.el (mail-yank-original): Set - buffer-file-coding-system from the one used by the message whose + * mail/sendmail.el (mail-yank-original): + Set buffer-file-coding-system from the one used by the message whose text is yanked. * calc/calc-graph.el (calc-graph-plot): Set calc-graph-last-device to "windows" when "pgnuplot" is used. - (calc-graph-command, calc-gnuplot-command, calc-graph-init): Don't - call accept-process-output if "pgnuplot" is used. + (calc-graph-command, calc-gnuplot-command, calc-graph-init): + Don't call accept-process-output if "pgnuplot" is used. (calc-graph-init): Don't send -display and -geometry to "pgnuplot". If "pgnuplot" is used, glean gnuplot version by running "pgnuplot -V" with shell-command-to-string. @@ -10534,11 +10543,11 @@ * progmodes/gdb-mi.el (gdb-thread-number): Initialize with nil. (gdb-current-context-command): Do not append --thread if `gdb-thread-number' is nil. - (gdb-running-threads-count, gdb-stopped-threads-count): New - variables. + (gdb-running-threads-count, gdb-stopped-threads-count): + New variables. (gdb-non-stop, gdb-gud-control-all-threads, gdb-switch-reasons) - (gdb-stopped-hooks, gdb-switch-when-another-stopped): New - customization options. + (gdb-stopped-hooks, gdb-switch-when-another-stopped): + New customization options. (gdb-gud-context-command, gdb-gud-context-call): New wrappers for GUD commands. (gdb): `gud-def' definitions changed to use `gdb-gud-context-call'. @@ -10662,8 +10671,8 @@ * net/tramp-cache.el (tramp-cache-inhibit-cache): New defvar. (tramp-get-file-property): Use it. - * autorevert.el (auto-revert-handler): Allow - `auto-revert-tail-mode' for remote files. + * autorevert.el (auto-revert-handler): + Allow `auto-revert-tail-mode' for remote files. 2009-08-02 Jason Rumney @@ -10673,8 +10682,8 @@ 2009-08-02 Chong Yidong * font-lock.el (font-lock-string-face, font-lock-builtin-face) - (font-lock-variable-name-face, font-lock-constant-face): Darken - the colors for light backgrounds. + (font-lock-variable-name-face, font-lock-constant-face): + Darken the colors for light backgrounds. 2009-08-01 Eli Zaretskii @@ -10774,8 +10783,8 @@ * net/zeroconf.el (zeroconf-init): Check for "GetVersionString" instead of "IsNSSSupportAvailable". Avahi ought to work also when - "IsNSSSupportAvailable" method is not available. Reported by - Steve Youngs . + "IsNSSSupportAvailable" method is not available. + Reported by Steve Youngs . 2009-07-24 Kenichi Handa @@ -10900,11 +10909,11 @@ 2009-07-21 Chong Yidong - * mail/rmailedit.el (rmail-edit-mode): Use - auto-save-include-big-deletions. + * mail/rmailedit.el (rmail-edit-mode): + Use auto-save-include-big-deletions. - * mail/rmail.el (rmail-variables): Use - auto-save-include-big-deletions. + * mail/rmail.el (rmail-variables): + Use auto-save-include-big-deletions. * files.el (auto-save-mode): Revert 2009-07-21 and 2009-07-16 changes. @@ -11080,8 +11089,8 @@ * w32-fns.el (x-selection-owner-p): New function. * mouse.el (mouse-drag-track): Call deactivate-mark earlier. - (mouse-yank-at-click, mouse-yank-primary): If - select-active-regions is non-nil, deactivate the mark before + (mouse-yank-at-click, mouse-yank-primary): + If select-active-regions is non-nil, deactivate the mark before insertion. * simple.el (deactivate-mark, set-mark): Only save selection if we @@ -11150,11 +11159,11 @@ * select.el (x-set-selection): Doc fix. (x-valid-simple-selection-p): Allow buffer values. - (xselect--selection-bounds): Handle buffer values. Suggested by - David De La Harpe Golden. + (xselect--selection-bounds): Handle buffer values. + Suggested by David De La Harpe Golden. - * mouse.el (mouse-set-region, mouse-drag-track): Call - copy-region-as-kill before setting the mark, to let + * mouse.el (mouse-set-region, mouse-drag-track): + Call copy-region-as-kill before setting the mark, to let select-active-regions work. 2009-07-15 David De La Harpe Golden @@ -11356,8 +11365,8 @@ * progmodes/gdb-mi.el: Port memory buffer from gdb-ui.el. (gdb-memory-address): New variable which holds top address of memory page shown in memory buffer. - (gdb-memory-repeat-count, gdb-memory-format, gdb-memory-unit): New - customization variables. + (gdb-memory-repeat-count, gdb-memory-format, gdb-memory-unit): + New customization variables. New functions: (gdb-display-memory-buffer, gdb-frame-memory-buffer): Functions to display the memory buffer. @@ -11370,8 +11379,8 @@ (gdb-memory-unit-word, gdb-memory-unit-halfword) (gdb-memory-unit-giant, gdb-memory-unit-byte): Functions to set unit size used in memory buffer. - (gdb-memory-show-next-page, gdb-memory-show-previous-page): Switch - to next/previous page of memory buffer. + (gdb-memory-show-next-page, gdb-memory-show-previous-page): + Switch to next/previous page of memory buffer. Now using (bindat-get-field) instead of fadr functions. 2009-07-07 Sam Steingold @@ -11381,8 +11390,8 @@ 2009-07-07 Kenichi Handa - * international/mule-cmds.el (reset-language-environment): Put - the highset priority to the charset iso-8859-1. + * international/mule-cmds.el (reset-language-environment): + Put the highset priority to the charset iso-8859-1. 2009-07-06 Chong Yidong @@ -11412,8 +11421,8 @@ (woman-file-name, woman2-format-paragraphs) (woman-leave-blank-lines): Code cleanup. (woman-use-own-frame): Change default to nil. - (woman-italic, woman-bold, woman-unknown, woman-addition): Change - defaults to inherit from default faces. + (woman-italic, woman-bold, woman-unknown, woman-addition): + Change defaults to inherit from default faces. (woman2-process-escapes): Consume the newline after a stand-alone filler character (Bug#3651). @@ -11707,8 +11716,8 @@ (verilog-auto-ascii-enum): Support one-hot state machines in AUTOASCIIENUM. Suggested by Lloyd Gomez. (verilog-auto-inst, verilog-auto-inst-port): Include interface - modport in AUTOINST and add vl-modport for users. Reported by - David Rogoff. + modport in AUTOINST and add vl-modport for users. + Reported by David Rogoff. (verilog-auto-inout-module, verilog-auto-inst) (verilog-decls-get-interfaces, verilog-insert-definition) (verilog-insert-one-definition, verilog-read-decls) diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 469786e04dd..049d708d191 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -154,7 +154,7 @@ mouse-3: go to end") :type 'sexp) ;;;###autoload (put 'which-func-format 'risky-local-variable t) -(defvar which-func-imenu-joiner-function #'last +(defvar which-func-imenu-joiner-function (lambda (x) (car (last x))) "Function to join together multiple levels of imenu nomenclature. Called with a single argument, a list of strings giving the names of the menus we had to traverse to get to the item. Returns a @@ -242,6 +242,9 @@ continuously displayed in the mode line, in certain major modes. With prefix ARG, turn Which Function mode on if arg is positive, and off otherwise." :global t :group 'which-func + (when (timerp which-func-update-timer) + (cancel-timer which-func-update-timer)) + (setq which-func-update-timer nil) (if which-function-mode ;;Turn it on (progn @@ -253,9 +256,6 @@ and off otherwise." (or (eq which-func-modes t) (member major-mode which-func-modes)))))) ;; Turn it off - (when (timerp which-func-update-timer) - (cancel-timer which-func-update-timer)) - (setq which-func-update-timer nil) (dolist (buf (buffer-list)) (with-current-buffer buf (setq which-func-mode nil))))) From b84ae584330c940010bc543fd925eddeb13fd9e2 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 25 Nov 2010 12:55:14 +0900 Subject: [PATCH 23/30] Fix decoding of emacs-mule coding system. --- src/ChangeLog | 16 ++++++++++++++++ src/charset.c | 6 +++--- src/charset.h | 4 +--- src/coding.c | 20 ++++++++++---------- src/lread.c | 8 ++++---- 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d33f9dd4f0b..7daa09c703f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2010-11-25 Kenichi Handa + + * charset.c (emacs_mule_charset): Make it an array of charset ID; + i.e. integer. + (Fdefine_charset_internal): Adjusted for the above change. + (init_charset_once): Likewise. + + * charset.h (emacs_mule_charset): Adjust the prototype. Delete + duplicated extern. + + * coding.c (emacs_mule_char): Adjust for the change of + emacs_mule_charset. + + * lread.c (read_emacs_mule_char): Adjust for the change of + emacs_mule_charset. + 2010-10-18 Ken Brown * s/cygwin.h (SIGNALS_VIA_CHARACTERS): New define (bug#7225). diff --git a/src/charset.c b/src/charset.c index 3b45dc348ed..60203d6a532 100644 --- a/src/charset.c +++ b/src/charset.c @@ -115,7 +115,7 @@ Lisp_Object Viso_2022_charset_list; /* List of emacs-mule charsets. */ Lisp_Object Vemacs_mule_charset_list; -struct charset *emacs_mule_charset[256]; +int emacs_mule_charset[256]; /* Mapping table from ISO2022's charset (specified by DIMENSION, CHARS, and FINAL-CHAR) to Emacs' charset. */ @@ -1248,7 +1248,7 @@ usage: (define-charset-internal ...) */) if (charset.emacs_mule_id >= 0) { - emacs_mule_charset[charset.emacs_mule_id] = CHARSET_FROM_ID (id); + emacs_mule_charset[charset.emacs_mule_id] = id; if (charset.emacs_mule_id < 0xA0) emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 1; else @@ -2405,7 +2405,7 @@ init_charset_once () iso_charset_table[i][j][k] = -1; for (i = 0; i < 256; i++) - emacs_mule_charset[i] = NULL; + emacs_mule_charset[i] = -1; charset_jisx0201_roman = -1; charset_jisx0208_1978 = -1; diff --git a/src/charset.h b/src/charset.h index 718859929df..7afe6546908 100644 --- a/src/charset.h +++ b/src/charset.h @@ -255,7 +255,7 @@ extern Lisp_Object Vcharset_list; extern Lisp_Object Viso_2022_charset_list; extern Lisp_Object Vemacs_mule_charset_list; -extern struct charset *emacs_mule_charset[256]; +extern int emacs_mule_charset[256]; extern Lisp_Object Vcurrent_iso639_language; @@ -517,8 +517,6 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL]; #define EMACS_MULE_LEADING_CODE_PRIVATE_21 0x9C /* 2/2 */ #define EMACS_MULE_LEADING_CODE_PRIVATE_22 0x9D /* 2/2 */ -extern struct charset *emacs_mule_charset[256]; - extern Lisp_Object Qcharsetp; diff --git a/src/coding.c b/src/coding.c index 137e72a0ba4..9c989e1c39e 100644 --- a/src/coding.c +++ b/src/coding.c @@ -2078,7 +2078,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base = src; int multibytep = coding->src_multibyte; - struct charset *charset; + int charset_id; unsigned code; int c; int consumed_chars = 0; @@ -2088,7 +2088,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) if (c < 0) { c = -c; - charset = emacs_mule_charset[0]; + charset_id = emacs_mule_charset[0]; } else { @@ -2124,7 +2124,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) switch (emacs_mule_bytes[c]) { case 2: - if (! (charset = emacs_mule_charset[c])) + if ((charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2137,7 +2137,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) { ONE_MORE_BYTE (c); - if (c < 0xA0 || ! (charset = emacs_mule_charset[c])) + if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2146,7 +2146,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) } else { - if (! (charset = emacs_mule_charset[c])) + if ((charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2161,7 +2161,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) case 4: ONE_MORE_BYTE (c); - if (c < 0 || ! (charset = emacs_mule_charset[c])) + if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2175,21 +2175,21 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status) case 1: code = c; - charset = CHARSET_FROM_ID (ASCII_BYTE_P (code) - ? charset_ascii : charset_eight_bit); + charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; break; default: abort (); } - CODING_DECODE_CHAR (coding, src, src_base, src_end, charset, code, c); + CODING_DECODE_CHAR (coding, src, src_base, src_end, + CHARSET_FROM_ID (charset_id), code, c); if (c < 0) goto invalid_code; } *nbytes = src - src_base; *nchars = consumed_chars; if (id) - *id = charset->id; + *id = charset_id; return (mseq_found ? -c : c); no_more_source: diff --git a/src/lread.c b/src/lread.c index c96e391a2d3..13de4d01317 100644 --- a/src/lread.c +++ b/src/lread.c @@ -616,7 +616,7 @@ read_emacs_mule_char (c, readbyte, readcharfun) if (len == 2) { - charset = emacs_mule_charset[buf[0]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]); code = buf[1] & 0x7F; } else if (len == 3) @@ -624,18 +624,18 @@ read_emacs_mule_char (c, readbyte, readcharfun) if (buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_11 || buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_12) { - charset = emacs_mule_charset[buf[1]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]); code = buf[2] & 0x7F; } else { - charset = emacs_mule_charset[buf[0]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]); code = ((buf[1] << 8) | buf[2]) & 0x7F7F; } } else { - charset = emacs_mule_charset[buf[1]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]); code = ((buf[2] << 8) | buf[3]) & 0x7F7F; } c = DECODE_CHAR (charset, code); From d1be4ec2743387d7b8c0c5c83ca97fb345a0b4b2 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 26 Nov 2010 13:06:59 +0900 Subject: [PATCH 24/30] Improve rmail's MIME handling. --- lisp/ChangeLog | 43 +++++ lisp/mail/rmail.el | 53 +++--- lisp/mail/rmailmm.el | 367 ++++++++++++++++++++++++++++++++++++++---- lisp/mail/rmailsum.el | 22 ++- 4 files changed, 419 insertions(+), 66 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fc460eaaf3d..812c66d3df6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,46 @@ +2010-11-26 Kenichi Handa + + * mail/rmailmm.el (rmail-mime-entity, rmail-mime-entity-type) + (rmail-mime-entity-disposition) + (rmail-mime-entity-transfer-encoding, rmail-mime-entity-header) + (rmail-mime-entity-body, rmail-mime-entity-children): New functions. + (rmail-mime-save): Handle the case that the button's `data' is a + MIME entity. + (rmail-mime-insert-text): New function. + (rmail-mime-insert-image): Handle the case that DATA is a MIME + entity. + (rmail-mime-bulk-handler): Just call rmail-mime-insert-bulk. + (rmail-mime-insert-bulk): New function mostly copied from the old + rmail-mime-bulk-handler. + (rmail-mime-multipart-handler): Just call + rmail-mime-process-multipart. + (rmail-mime-process-multipart): New funciton mostly copied from + the old rmail-mime-multipart-handler. + (rmail-mime-show): Just call rmail-mime-process. + (rmail-mime-process): New funciton mostly copied from the old + rmail-mime-show. + (rmail-mime-insert-multipart, rmail-mime-parse) + (rmail-mime-insert, rmail-show-mime) + (rmail-insert-mime-forwarded-message) + (rmail-insert-mime-resent-message): New functions. + (rmail-insert-mime-forwarded-message-function): Set to + rmail-insert-mime-forwarded-message. + (rmail-insert-mime-resent-message-function): Set to + rmail-insert-mime-resent-message. + + * mail/rmailsum.el: Require rfc2047. + (rmail-header-summary): Handle multiline Subject: field. + (rmail-summary-line-decoder): Change the default to + rfc2047-decode-string. + + * mail/rmail.el (rmail-enable-mime): Change the default to t. + (rmail-mime-feature): Change the default to `rmailmm'. + (rmail-quit): Delete the specifal code for rmail-enable-mime. + (rmail-display-labels): Likewise. + (rmail-show-message-1): Check rmail-enable-mime, and use + rmail-show-mime-function for a MIME message. Decode the headers + according to RFC2047. + 2010-11-24 Stefan Monnier * progmodes/which-func.el (which-func-imenu-joiner-function): diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 3ab87fa21f7..70c84a242f5 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -638,7 +638,7 @@ Element N specifies the summary line for message N+1.") This is set to nil by default.") -(defcustom rmail-enable-mime nil +(defcustom rmail-enable-mime t "If non-nil, RMAIL uses MIME features. If the value is t, RMAIL automatically shows MIME decoded message. If the value is neither t nor nil, RMAIL does not show MIME decoded message @@ -649,6 +649,7 @@ unless the feature specified by `rmail-mime-feature' is available." :type '(choice (const :tag "on" t) (const :tag "off" nil) (other :tag "when asked" ask)) + :version "23.3" :group 'rmail) (defvar rmail-enable-mime-composing nil @@ -693,13 +694,12 @@ start of the header) with three arguments MSG, REGEXP, and LIMIT, where MSG is the message number, REGEXP is the regular expression, LIMIT is the position specifying the end of header.") -(defvar rmail-mime-feature 'rmail-mime +(defvar rmail-mime-feature 'rmailmm "Feature to require to load MIME support in Rmail. When starting Rmail, if `rmail-enable-mime' is non-nil, this feature is required with `require'. -The default value is `rmail-mime'. This feature is provided by -the rmail-mime package available at .") +The default value is `rmailmm'") ;; FIXME this is unused. (defvar rmail-decode-mime-charset t @@ -1509,17 +1509,9 @@ Hook `rmail-quit-hook' is run after expunging." (set-buffer-modified-p nil)) (replace-buffer-in-windows rmail-summary-buffer) (bury-buffer rmail-summary-buffer)) - (if rmail-enable-mime - (let ((obuf rmail-buffer) - (ovbuf rmail-view-buffer)) - (set-buffer rmail-view-buffer) - (quit-window) - (replace-buffer-in-windows ovbuf) - (replace-buffer-in-windows obuf) - (bury-buffer obuf)) - (let ((obuf (current-buffer))) - (quit-window) - (replace-buffer-in-windows obuf)))) + (let ((obuf (current-buffer))) + (quit-window) + (replace-buffer-in-windows obuf))) (defun rmail-bury () "Bury current Rmail buffer and its summary buffer." @@ -2219,15 +2211,7 @@ If nil, that means the current message." (let ((blurb (rmail-get-labels))) (setq mode-line-process (format " %d/%d%s" - rmail-current-message rmail-total-messages blurb)) - ;; If rmail-enable-mime is non-nil, we may have to update - ;; `mode-line-process' of rmail-view-buffer too. - (if (and rmail-enable-mime - (not (eq (current-buffer) rmail-view-buffer)) - (buffer-live-p rmail-view-buffer)) - (let ((mlp mode-line-process)) - (with-current-buffer rmail-view-buffer - (setq mode-line-process mlp)))))) + rmail-current-message rmail-total-messages blurb)))) (defun rmail-get-attr-value (attr state) "Return the character value for ATTR. @@ -2706,6 +2690,11 @@ The current mail message becomes the message displayed." (message "Showing message %d" msg)) (narrow-to-region beg end) (goto-char beg) + (if (and rmail-enable-mime + (re-search-forward "mime-version: 1.0" nil t)) + (let ((rmail-buffer mbox-buf) + (rmail-view-buffer view-buf)) + (funcall rmail-show-mime-function)) (setq body-start (search-forward "\n\n" nil t)) (narrow-to-region beg (point)) (goto-char beg) @@ -2722,11 +2711,6 @@ The current mail message becomes the message displayed." ;; unibyte temporary buffer where the character decoding takes ;; place. (with-current-buffer rmail-view-buffer - ;; We give the view buffer a buffer-local value of - ;; rmail-header-style based on the binding in effect when - ;; this function is called; `rmail-toggle-headers' can - ;; inspect this value to determine how to toggle. - (set (make-local-variable 'rmail-header-style) header-style) (erase-buffer)) (if (null character-coding) ;; Do it directly since that is fast. @@ -2749,8 +2733,13 @@ The current mail message becomes the message displayed." (error "uuencoded messages are not supported yet")) (t)) (rmail-decode-region (point-min) (point-max) - coding-system view-buf))) + coding-system view-buf)))) (with-current-buffer rmail-view-buffer + ;; We give the view buffer a buffer-local value of + ;; rmail-header-style based on the binding in effect when + ;; this function is called; `rmail-toggle-headers' can + ;; inspect this value to determine how to toggle. + (set (make-local-variable 'rmail-header-style) header-style) ;; Unquote quoted From lines (goto-char (point-min)) (while (re-search-forward "^>+From " nil t) @@ -2766,6 +2755,10 @@ The current mail message becomes the message displayed." (with-current-buffer rmail-view-buffer (insert "\n") (goto-char (point-min)) + ;; Decode the headers according to RFC2047. + (save-excursion + (search-forward "\n\n" nil 'move) + (rfc2047-decode-region (point-min) (point))) (rmail-highlight-headers) ;(rmail-activate-urls) ;(rmail-process-quoted-material) diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index e8ca11ee349..6dfa92aa93a 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -26,17 +26,57 @@ ;; Essentially based on the design of Alexander Pohoyda's MIME ;; extensions (mime-display.el and mime.el). -;; Call `M-x rmail-mime' when viewing an Rmail message. + +;; This file provides two operation modes for viewing a MIME message. + +;; (1) When rmail-enable-mime is non-nil (now it is the default), the +;; function `rmail-show-mime' is automatically called. That function +;; shows a MIME message directly in RMAIL's view buffer. + +;; (2) When rmail-enable-mime is nil, the command 'v' (or M-x +;; rmail-mime) shows a MIME message in a new buffer "*RMAIL*". + +;; Both operations share the intermediate functions rmail-mime-process +;; and rmail-mime-process-multipart as below. + +;; rmail-show-mime +;; +- rmail-mime-parse +;; | +- rmail-mime-process <--+------------+ +;; | | +---------+ | +;; | + rmail-mime-process-multipart --+ +;; | +;; + rmail-mime-insert <----------------+ +;; +- rmail-mime-insert-text | +;; +- rmail-mime-insert-bulk | +;; +- rmail-mime-insert-multipart --+ +;; +;; rmail-mime +;; +- rmail-mime-show <----------------------------------+ +;; +- rmail-mime-process | +;; +- rmail-mime-handle | +;; +- rmail-mime-text-handler | +;; +- rmail-mime-bulk-handler | +;; | + rmail-mime-insert-bulk +;; +- rmail-mime-multipart-handler | +;; +- rmail-mime-process-multipart --+ + +;; In addition, for the case of rmail-enable-mime being non-nil, this +;; file provides two functions rmail-insert-mime-forwarded-message and +;; rmail-insert-mime-resent-message for composing forwarded and resent +;; messages respectively. ;; Todo: -;; Handle multipart/alternative. +;; Make rmail-mime-media-type-handlers-alist usable in the first +;; operation mode. +;; Handle multipart/alternative in the second operation mode. ;; Offer the option to call external/internal viewers (doc-view, xpdf, etc). ;;; Code: (require 'rmail) (require 'mail-parse) +(require 'message) ;;; User options. @@ -90,6 +130,52 @@ automatically display the image in the buffer." ;;; End of user options. +;;; MIME-entity object + +(defun rmail-mime-entity (type disposition transfer-encoding + header body children) + "Retrun a newly created MIME-entity object. + +A MIME-entity is a vector of 6 elements: + + [ TYPE DISPOSITION TRANSFER-ENCODING HEADER BODY CHILDREN ] + +TYPE and DISPOSITION correspond to MIME headers Content-Type: and +Cotent-Disposition: respectively, and has this format: + + \(VALUE (ATTRIBUTE . VALUE) (ATTRIBUTE . VALUE) ...) + +VALUE is a string and ATTRIBUTE is a symbol. + +Consider the following header, for example: + +Content-Type: multipart/mixed; + boundary=\"----=_NextPart_000_0104_01C617E4.BDEC4C40\" + +The corresponding TYPE argument must be: + +\(\"multipart/mixed\" + \(\"boundary\" . \"----=_NextPart_000_0104_01C617E4.BDEC4C40\")) + +TRANSFER-ENCODING corresponds to MIME header +Content-Transfer-Encoding, and is a lowercased string. + +HEADER and BODY are a cons (BEG . END), where BEG and END specify +the region of the corresponding part in RMAIL's data (mbox) +buffer. BODY may be nil. In that case, the current buffer is +narrowed to the body part. + +CHILDREN is a list of MIME-entities for a \"multipart\" entity, and +nil for the other types." + (vector type disposition transfer-encoding header body children)) + +;; Accessors for a MIME-entity object. +(defsubst rmail-mime-entity-type (entity) (aref entity 0)) +(defsubst rmail-mime-entity-disposition (entity) (aref entity 1)) +(defsubst rmail-mime-entity-transfer-encoding (entity) (aref entity 2)) +(defsubst rmail-mime-entity-header (entity) (aref entity 3)) +(defsubst rmail-mime-entity-body (entity) (aref entity 4)) +(defsubst rmail-mime-entity-children (entity) (aref entity 5)) ;;; Buttons @@ -98,6 +184,7 @@ automatically display the image in the buffer." (let* ((filename (button-get button 'filename)) (directory (button-get button 'directory)) (data (button-get button 'data)) + (mbox-buf rmail-view-buffer) (ofilename filename)) (setq filename (expand-file-name (read-file-name (format "Save as (default: %s): " filename) @@ -116,7 +203,17 @@ automatically display the image in the buffer." ;; file, the magic signature compares equal with the unibyte ;; signature string recorded in jka-compr-compression-info-list. (set-buffer-multibyte nil) - (insert data) + (setq buffer-undo-list t) + (if (stringp data) + (insert data) + ;; DATA is a MIME-entity object. + (let ((transfer-encoding (rmail-mime-entity-transfer-encoding data)) + (body (rmail-mime-entity-body data))) + (insert-buffer-substring mbox-buf (car body) (cdr body)) + (cond ((string= transfer-encoding "base64") + (ignore-errors (base64-decode-region (point-min) (point-max)))) + ((string= transfer-encoding "quoted-printable") + (quoted-printable-decode-region (point-min) (point-max)))))) (write-region nil nil filename nil nil nil t)))) (define-button-type 'rmail-mime-save 'action 'rmail-mime-save) @@ -133,6 +230,23 @@ automatically display the image in the buffer." (when (coding-system-p coding-system) (decode-coding-region (point-min) (point-max) coding-system)))) +(defun rmail-mime-insert-text (entity) + "Insert MIME-entity ENTITY as a plain text MIME part in the current buffer." + (let* ((content-type (rmail-mime-entity-type entity)) + (charset (cdr (assq 'charset (cdr content-type)))) + (coding-system (if charset (intern (downcase charset)))) + (transfer-encoding (rmail-mime-entity-transfer-encoding entity)) + (body (rmail-mime-entity-body entity))) + (save-restriction + (narrow-to-region (point) (point)) + (insert-buffer-substring rmail-buffer (car body) (cdr body)) + (cond ((string= transfer-encoding "base64") + (ignore-errors (base64-decode-region (point-min) (point-max)))) + ((string= transfer-encoding "quoted-printable") + (quoted-printable-decode-region (point-min) (point-max)))) + (if (coding-system-p coding-system) + (decode-coding-region (point-min) (point-max) coding-system))))) + ;; FIXME move to the test/ directory? (defun test-rmail-mime-handler () "Test of a mail using no MIME parts at all." @@ -151,10 +265,28 @@ MIME-Version: 1.0 (defun rmail-mime-insert-image (type data) - "Insert an image of type TYPE, where DATA is the image data." + "Insert an image of type TYPE, where DATA is the image data. +If DATA is not a string, it is a MIME-entity object." (end-of-line) - (insert ?\n) - (insert-image (create-image data type t))) + (let ((modified (buffer-modified-p))) + (insert ?\n) + (unless (stringp data) + ;; DATA is a MIME-entity. + (let ((transfer-encoding (rmail-mime-entity-transfer-encoding data)) + (body (rmail-mime-entity-body data)) + (mbox-buffer rmail-view-buffer)) + (with-temp-buffer + (set-buffer-multibyte nil) + (setq buffer-undo-list t) + (insert-buffer-substring mbox-buffer (car body) (cdr body)) + (cond ((string= transfer-encoding "base64") + (ignore-errors (base64-decode-region (point-min) (point-max)))) + ((string= transfer-encoding "quoted-printable") + (quoted-printable-decode-region (point-min) (point-max)))) + (setq data + (buffer-substring-no-properties (point-min) (point-max)))))) + (insert-image (create-image data type t)) + (set-buffer-modified-p modified))) (defun rmail-mime-image (button) "Display the image associated with BUTTON." @@ -171,8 +303,19 @@ MIME-Version: 1.0 "Handle the current buffer as an attachment to download. For images that Emacs is capable of displaying, the behavior depends upon the value of `rmail-mime-show-images'." + (rmail-mime-insert-bulk + (rmail-mime-entity content-type content-disposition content-transfer-encoding + nil nil nil))) + +(defun rmail-mime-insert-bulk (entity) + "Inesrt a MIME-entity ENTITY as an attachment. +The optional second arg DATA, if non-nil, is a string containing +the attachment data that is already decoded." ;; Find the default directory for this media type. - (let* ((directory (catch 'directory + (let* ((content-type (rmail-mime-entity-type entity)) + (content-disposition (rmail-mime-entity-disposition entity)) + (body (rmail-mime-entity-body entity)) + (directory (catch 'directory (dolist (entry rmail-mime-attachment-dirs-alist) (when (string-match (car entry) (car content-type)) (dolist (dir (cdr entry)) @@ -182,17 +325,21 @@ depends upon the value of `rmail-mime-show-images'." (cdr (assq 'filename (cdr content-disposition))) "noname")) (label (format "\nAttached %s file: " (car content-type))) - (data (buffer-string)) - (udata (string-as-unibyte data)) - (size (length udata)) - (osize size) (units '(B kB MB GB)) - type) - (while (and (> size 1024.0) ; cribbed from gnus-agent-expire-done-message + data udata size osize type) + (if body + (setq data entity + udata entity + size (- (cdr body) (car body))) + (setq data (buffer-string) + udata (string-as-unibyte data) + size (length udata)) + (delete-region (point-min) (point-max))) + (setq osize size) + (while (and (> size 1024.0) ; cribbed from gnus-agent-expire-done-message (cdr units)) (setq size (/ size 1024.0) units (cdr units))) - (delete-region (point-min) (point-max)) (insert label) (insert-button filename :type 'rmail-mime-save @@ -248,6 +395,22 @@ The current buffer should be narrowed to the body. CONTENT-TYPE, CONTENT-DISPOSITION, and CONTENT-TRANSFER-ENCODING are the values of the respective parsed headers. See `rmail-mime-handle' for their format." + (rmail-mime-process-multipart + content-type content-disposition content-transfer-encoding nil)) + +(defun rmail-mime-process-multipart (content-type + content-disposition + content-transfer-encoding + parse-only) + "Process the current buffer as a multipart MIME body. + +If PARSE-ONLY is nil, modify the current buffer directly for showing +the MIME body and return nil. + +Otherwise, just parse the current buffer and return a list of +MIME-entity objects. + +The other arguments are the same as `rmail-mime-multipart-handler'." ;; Some MUAs start boundaries with "--", while it should start ;; with "CRLF--", as defined by RFC 2046: ;; The boundary delimiter MUST occur at the beginning of a line, @@ -256,7 +419,7 @@ format." ;; of the preceding part. ;; We currently don't handle that. (let ((boundary (cdr (assq 'boundary content-type))) - beg end next) + beg end next entities) (unless boundary (rmail-mm-get-boundary-error-message "No boundary defined" content-type content-disposition @@ -266,7 +429,9 @@ format." (goto-char (point-min)) (when (and (search-forward boundary nil t) (looking-at "[ \t]*\n")) - (delete-region (point-min) (match-end 0))) + (if parse-only + (narrow-to-region (match-end 0) (point-max)) + (delete-region (point-min) (match-end 0)))) ;; Loop over all body parts, where beg points at the beginning of ;; the part and end points at the end of the part. next points at ;; the beginning of the next part. @@ -284,13 +449,17 @@ format." (rmail-mm-get-boundary-error-message "Malformed boundary" content-type content-disposition content-transfer-encoding))) - (delete-region end next) ;; Handle the part. - (save-restriction - (narrow-to-region beg end) - (rmail-mime-show)) - (goto-char (setq beg next))))) - + (if parse-only + (save-restriction + (narrow-to-region beg end) + (setq entities (cons (rmail-mime-process nil t) entities))) + (delete-region end next) + (save-restriction + (narrow-to-region beg end) + (rmail-mime-show))) + (goto-char (setq beg next))) + (nreverse entities))) (defun test-rmail-mime-multipart-handler () "Test of a mail used as an example in RFC 2046." @@ -393,6 +562,9 @@ called recursively if multiple parts are available. The current buffer must contain a single message. It will be modified." + (rmail-mime-process show-headers nil)) + +(defun rmail-mime-process (show-headers parse-only) (let ((end (point-min)) content-type content-transfer-encoding @@ -436,14 +608,105 @@ modified." ;; attachment according to RFC 2183. (unless (member (car content-disposition) '("inline" "attachment")) (setq content-disposition '("attachment"))) - ;; Hide headers and handle the part. - (save-restriction - (cond ((string= (car content-type) "message/rfc822") - (narrow-to-region end (point-max))) - ((not show-headers) - (delete-region (point-min) end))) - (rmail-mime-handle content-type content-disposition - content-transfer-encoding)))) + + (if parse-only + (cond ((string-match "multipart/.*" (car content-type)) + (setq end (1- end)) + (save-restriction + (let ((header (if show-headers (cons (point-min) end)))) + (narrow-to-region end (point-max)) + (rmail-mime-entity content-type + content-disposition + content-transfer-encoding + header nil + (rmail-mime-process-multipart + content-type content-disposition + content-transfer-encoding t))))) + ((string-match "message/rfc822" (car content-type)) + (or show-headers + (narrow-to-region end (point-max))) + (rmail-mime-process t t)) + (t + (rmail-mime-entity content-type + content-disposition + content-transfer-encoding + nil + (cons end (point-max)) + nil))) + ;; Hide headers and handle the part. + (save-restriction + (cond ((string= (car content-type) "message/rfc822") + (narrow-to-region end (point-max))) + ((not show-headers) + (delete-region (point-min) end))) + (rmail-mime-handle content-type content-disposition + content-transfer-encoding))))) + +(defun rmail-mime-insert-multipart (entity) + "Insert MIME-entity ENTITY of multipart type in the current buffer." + (let ((subtype (cadr (split-string (car (rmail-mime-entity-type entity)) + "/"))) + (disposition (rmail-mime-entity-disposition entity)) + (header (rmail-mime-entity-header entity)) + (children (rmail-mime-entity-children entity))) + (if header + (let ((pos (point))) + (or (bolp) + (insert "\n")) + (insert-buffer-substring rmail-buffer (car header) (cdr header)) + (rfc2047-decode-region pos (point)) + (insert "\n"))) + (cond + ((string= subtype "mixed") + (dolist (child children) + (rmail-mime-insert child '("text/plain") disposition))) + ((string= subtype "digest") + (dolist (child children) + (rmail-mime-insert child '("message/rfc822") disposition))) + ((string= subtype "alternative") + (let (best-plain-text best-text) + (dolist (child children) + (if (string= (or (car (rmail-mime-entity-disposition child)) + (car disposition)) + "inline") + (if (string-match "text/plain" + (car (rmail-mime-entity-type child))) + (setq best-plain-text child) + (if (string-match "text/.*" + (car (rmail-mime-entity-type child))) + (setq best-text child))))) + (if (or best-plain-text best-text) + (rmail-mime-insert (or best-plain-text best-text)) + ;; No child could be handled. Insert all. + (dolist (child children) + (rmail-mime-insert child nil disposition))))) + (t + ;; Unsupported subtype. Insert all as attachment. + (dolist (child children) + (rmail-mime-insert-bulk child)))))) + +(defun rmail-mime-parse () + "Parse the current Rmail message as a MIME message. +The value is a MIME-entiy object (see `rmail-mime-enty-new')." + (save-excursion + (goto-char (point-min)) + (rmail-mime-process nil t))) + +(defun rmail-mime-insert (entity &optional content-type disposition) + "Insert a MIME-entity ENTITY in the current buffer. + +This function will be called recursively if multiple parts are +available." + (if (rmail-mime-entity-children entity) + (rmail-mime-insert-multipart entity) + (setq content-type + (or (rmail-mime-entity-type entity) content-type)) + (setq disposition + (or (rmail-mime-entity-disposition entity) disposition)) + (if (and (string= (car disposition) "inline") + (string-match "text/.*" (car content-type))) + (rmail-mime-insert-text entity) + (rmail-mime-insert-bulk entity)))) (define-derived-mode rmail-mime-mode fundamental-mode "RMIME" "Major mode used in `rmail-mime' buffers." @@ -479,6 +742,50 @@ attachments as specfied by `rmail-mime-attachment-dirs-alist'." (error "%s; type: %s; disposition: %s; encoding: %s" message type disposition encoding)) +(defun rmail-show-mime () + (let ((mbox-buf rmail-buffer)) + (condition-case nil + (let ((entity (rmail-mime-parse))) + (with-current-buffer rmail-view-buffer + (let ((inhibit-read-only t) + (rmail-buffer mbox-buf)) + (erase-buffer) + (rmail-mime-insert entity)))) + (error + ;; Decoding failed. Insert the original message body as is. + (let ((region (with-current-buffer mbox-buf + (goto-char (point-min)) + (re-search-forward "^$" nil t) + (forward-line 1) + (cons (point) (point-max))))) + (with-current-buffer rmail-view-buffer + (let ((inhibit-read-only t)) + (erase-buffer) + (insert-buffer-substring mbox-buf (car region) (cdr region)))) + (message "MIME decoding failed")))))) + +(setq rmail-show-mime-function 'rmail-show-mime) + +(defun rmail-insert-mime-forwarded-message (forward-buffer) + (let ((mbox-buf (with-current-buffer forward-buffer rmail-view-buffer))) + (save-restriction + (narrow-to-region (point) (point)) + (message-forward-make-body-mime mbox-buf)))) + +(setq rmail-insert-mime-forwarded-message-function + 'rmail-insert-mime-forwarded-message) + +(defun rmail-insert-mime-resent-message (forward-buffer) + (insert-buffer-substring + (with-current-buffer forward-buffer rmail-view-buffer)) + (goto-char (point-min)) + (when (looking-at "From ") + (forward-line 1) + (delete-region (point-min) (point)))) + +(setq rmail-insert-mime-resent-message-function + 'rmail-insert-mime-resent-message) + (provide 'rmailmm) ;; Local Variables: diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index 80c65cdfb57..2d8019b6834 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -31,6 +31,7 @@ ;; For rmail-select-summary. (require 'rmail) +(require 'rfc2047) (defcustom rmail-summary-scroll-between-messages t "Non-nil means Rmail summary scroll commands move between messages. @@ -363,13 +364,15 @@ The current buffer contains the unrestricted message collection." (aset rmail-summary-vector (1- msgnum) line)) line)) -(defcustom rmail-summary-line-decoder (function identity) +(defcustom rmail-summary-line-decoder (function rfc2047-decode-string) "Function to decode a Rmail summary line. It receives the summary line for one message as a string and should return the decoded string. -By default, it is `identity', which returns the string unaltered." +By default, it is `rfc2047-decode-string', which decodes MIME-encoded +subject." :type 'function + :version "23.3" :group 'rmail-summary) (defun rmail-create-summary-line (msgnum) @@ -588,10 +591,17 @@ the message being processed." (t (- mch 14)))) (min len (+ lo 25))))))))) (concat (if (re-search-forward "^Subject:" nil t) - (progn (skip-chars-forward " \t") - (buffer-substring (point) - (progn (end-of-line) - (point)))) + (let (pos str) + (skip-chars-forward " \t") + (setq pos (point)) + (forward-line 1) + (setq str (buffer-substring pos (1- (point)))) + (while (looking-at "\\s ") + (setq str (concat str " " + (buffer-substring (match-end 0) + (line-end-position)))) + (forward-line 1)) + str) (re-search-forward "[\n][\n]+" nil t) (buffer-substring (point) (progn (end-of-line) (point)))) "\n"))) From 3d9ee611b87c0663e031f0838520c9c38c183285 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 26 Nov 2010 16:58:35 +0900 Subject: [PATCH 25/30] mail/rmail.el: Require rfc2047. --- lisp/ChangeLog | 4 ++++ lisp/mail/rmail.el | 1 + 2 files changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 812c66d3df6..ecaf4ac9123 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-11-26 Kenichi Handa + + * mail/rmail.el: Require rfc2047. + 2010-11-26 Kenichi Handa * mail/rmailmm.el (rmail-mime-entity, rmail-mime-entity-type) diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 70c84a242f5..ff04b76bf82 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -39,6 +39,7 @@ ;; (require 'mail-utils) +(require 'rfc2047) (defconst rmail-attribute-header "X-RMAIL-ATTRIBUTES" "The header that stores the Rmail attribute data.") From afde451abef73d7b4b21af427c48621dedc60f4b Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 26 Nov 2010 21:58:41 +0900 Subject: [PATCH 26/30] mail/rmailmm.el (rmail-mime-insert-multipart): For unsupported multipart subtypes, insert all as usual. --- lisp/ChangeLog | 3 +++ lisp/mail/rmailmm.el | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ecaf4ac9123..1b35c13377c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-11-26 Kenichi Handa + * mail/rmailmm.el (rmail-mime-insert-multipart): For unsupported + multipart subtypes, insert all as usual. + * mail/rmail.el: Require rfc2047. 2010-11-26 Kenichi Handa diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 6dfa92aa93a..2c1269ee3f1 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -681,9 +681,9 @@ modified." (dolist (child children) (rmail-mime-insert child nil disposition))))) (t - ;; Unsupported subtype. Insert all as attachment. + ;; Unsupported subtype. Insert all of them. (dolist (child children) - (rmail-mime-insert-bulk child)))))) + (rmail-mime-insert child)))))) (defun rmail-mime-parse () "Parse the current Rmail message as a MIME message. From 09ffa822f8c0ff82d7a277d1bc673cc0831010b6 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 26 Nov 2010 16:33:21 -0500 Subject: [PATCH 27/30] * emacs-lisp/smie.el (smie-prec2->grammar): Simplify handling of :smie-open/close-alist. (smie-next-sexp): Make it accept a "start token" as argument. (smie-indent-keyword): Be careful not to misidentify tokens that span more than one line, as empty lines. Add argument `token'. --- lisp/ChangeLog | 8 +++ lisp/emacs-lisp/smie.el | 120 ++++++++++++++++++++++------------------ 2 files changed, 74 insertions(+), 54 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1b35c13377c..3ac8fd7a270 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2010-11-26 Stefan Monnier + + * emacs-lisp/smie.el (smie-prec2->grammar): Simplify handling + of :smie-open/close-alist. + (smie-next-sexp): Make it accept a "start token" as argument. + (smie-indent-keyword): Be careful not to misidentify tokens that span + more than one line, as empty lines. Add argument `token'. + 2010-11-26 Kenichi Handa * mail/rmailmm.el (rmail-mime-insert-multipart): For unsupported diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 179e0a9f094..a7021b3cf7b 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -76,8 +76,6 @@ ;; TODO & BUGS: ;; -;; - FIXME: I think the behavior on empty lines is wrong. It shouldn't -;; look at the next token on subsequent lines. ;; - Using the structural information SMIE gives us, it should be possible to ;; implement a `smie-align' command that would automatically figure out what ;; there is to align and how to do it (something like: align the token of @@ -470,7 +468,7 @@ PREC2 is a table as returned by `smie-precs->prec2' or (to (cdar eqs))) (setq eqs (cdr eqs)) (if (eq to from) - nil ;Nothing to do. + nil ;Nothing to do. (dolist (other-eq eqs) (if (eq from (cdr other-eq)) (setcdr other-eq to)) (when (eq from (car other-eq)) @@ -523,24 +521,23 @@ PREC2 is a table as returned by `smie-precs->prec2' or (setcar (car eq) (cadr eq)) ;; (smie-check-grammar table prec2 'step2) ) - ;; Finally, fill in the remaining vars (which only appeared on the - ;; right side of the < constraints). - (let ((classification-table (gethash :smie-open/close-alist prec2))) - (dolist (x table) - ;; When both sides are nil, it means this operator binds very - ;; very tight, but it's still just an operator, so we give it - ;; the highest precedence. - ;; OTOH if only one side is nil, it usually means it's like an - ;; open-paren, which is very important for indentation purposes, - ;; so we keep it nil if so, to make it easier to recognize. - (unless (or (nth 1 x) - (eq 'opener (cdr (assoc (car x) classification-table)))) - (setf (nth 1 x) i) - (incf i)) ;See other (incf i) above. - (unless (or (nth 2 x) - (eq 'closer (cdr (assoc (car x) classification-table)))) - (setf (nth 2 x) i) - (incf i))))) ;See other (incf i) above. + ;; Finally, fill in the remaining vars (which did not appear on the + ;; left side of any < constraint). + (dolist (x table) + (unless (nth 1 x) + (setf (nth 1 x) i) + (incf i)) ;See other (incf i) above. + (unless (nth 2 x) + (setf (nth 2 x) i) + (incf i)))) ;See other (incf i) above. + ;; Mark closers and openers. + (dolist (x (gethash :smie-open/close-alist prec2)) + (let* ((token (car x)) + (cons (case (cdr x) + (closer (cddr (assoc token table))) + (opener (cdr (assoc token table)))))) + (assert (numberp (car cons))) + (setf (car cons) (list (car cons))))) (let ((ca (gethash :smie-closer-alist prec2))) (when ca (push (cons :smie-closer-alist ca) table))) ;; (smie-check-grammar table prec2 'step3) @@ -611,6 +608,8 @@ OP-FORW is the accessor to the forward level of the level data. OP-BACK is the accessor to the backward level of the level data. HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the first token we see is an operator, skip over its left-hand-side argument. +HALFSEXP can also be a token, in which case it means to parse as if +we had just successfully passed this token. Possible return values: (FORW-LEVEL POS TOKEN): we couldn't skip TOKEN because its back-level is too high. FORW-LEVEL is the forw-level of TOKEN, @@ -619,7 +618,10 @@ Possible return values: (nil POS TOKEN): we skipped over a paren-like pair. nil: we skipped over an identifier, matched parentheses, ..." (catch 'return - (let ((levels ())) + (let ((levels + (if (stringp halfsexp) + (prog1 (list (cdr (assoc halfsexp smie-grammar))) + (setq halfsexp nil))))) (while (let* ((pos (point)) (token (funcall next-token)) @@ -697,6 +699,8 @@ Possible return values: "Skip over one sexp. HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the first token we see is an operator, skip over its left-hand-side argument. +HALFSEXP can also be a token, in which case we should skip the text +assuming it is the left-hand-side argument of that token. Possible return values: (LEFT-LEVEL POS TOKEN): we couldn't skip TOKEN because its right-level is too high. LEFT-LEVEL is the left-level of TOKEN, @@ -714,7 +718,9 @@ Possible return values: (defun smie-forward-sexp (&optional halfsexp) "Skip over one sexp. HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the -first token we see is an operator, skip over its left-hand-side argument. +first token we see is an operator, skip over its right-hand-side argument. +HALFSEXP can also be a token, in which case we should skip the text +assuming it is the right-hand-side argument of that token. Possible return values: (RIGHT-LEVEL POS TOKEN): we couldn't skip TOKEN because its left-level is too high. RIGHT-LEVEL is the right-level of TOKEN, @@ -791,7 +797,7 @@ Possible return values: (push (car other) found)))))) (cond ((null found) (error "No known closer for opener %s" open)) - ;; FIXME: what should we do if there are various closers? + ;; What should we do if there are various closers? (t (car found)))))))))) (unless (save-excursion (skip-chars-backward " \t") (bolp)) (newline)) @@ -1094,9 +1100,6 @@ Only meaningful when called from within `smie-rules-function'." ;; line, in which case we want to align it with its enclosing parent. (cond ((and (eq method :before) (smie-rule-bolp) (not (smie-rule-sibling-p))) - ;; FIXME: Rather than consult the number of spaces, we could *set* the - ;; number of spaces so as to align the separator with the close-paren - ;; while aligning the content with the rest. (let ((parent-col (cdr (smie-rule-parent))) (parent-pos-col ;FIXME: we knew this when computing smie--parent. (save-excursion @@ -1225,39 +1228,48 @@ in order to figure out the indentation of some other (further down) point." (smie-indent-virtual)) ;:not-hanging (scan-error nil))))) -(defun smie-indent-keyword () - ;; Align closing token with the corresponding opening one. - ;; (e.g. "of" with "case", or "in" with "let"). +(defun smie-indent-keyword (&optional token) + "Indent point based on the token that follows it immediately. +If TOKEN is non-nil, assume that that is the token that follows point. +Returns either a column number or nil if it considers that indentation +should not be computed on the basis of the following token." (save-excursion (let* ((pos (point)) - (toklevels (smie-indent-forward-token)) - (token (pop toklevels))) + (toklevels + (if token + (assoc token smie-grammar) + (let* ((res (smie-indent-forward-token))) + ;; Ignore tokens on subsequent lines. + (if (and (< pos (line-beginning-position)) + ;; Make sure `token' also *starts* on another line. + (save-excursion + (smie-indent-backward-token) + (< pos (line-beginning-position)))) + nil + (goto-char pos) + res))))) + (setq token (pop toklevels)) (cond - ((< pos (line-beginning-position)) - ;; The token we just read is actually not on the line where we started. - nil) + ((null (cdr toklevels)) nil) ;Not a keyword. ((not (numberp (car toklevels))) - (save-excursion - (goto-char pos) - ;; Different cases: - ;; - smie-indent--bolp: "indent according to others". - ;; - common hanging: "indent according to others". - ;; - SML-let hanging: "indent like parent". - ;; - if-after-else: "indent-like parent". - ;; - middle-of-line: "trust current position". - (cond - ((null (cdr toklevels)) nil) ;Not a keyword. - ((smie-indent--rule :before token)) - ((smie-indent--bolp) ;I.e. non-virtual indent. - ;; For an open-paren-like thingy at BOL, always indent only - ;; based on other rules (typically smie-indent-after-keyword). - nil) - (t - ;; By default use point unless we're hanging. - (unless (smie-indent--hanging-p) (current-column)))))) + ;; Different cases: + ;; - smie-indent--bolp: "indent according to others". + ;; - common hanging: "indent according to others". + ;; - SML-let hanging: "indent like parent". + ;; - if-after-else: "indent-like parent". + ;; - middle-of-line: "trust current position". + (cond + ((smie-indent--rule :before token)) + ((smie-indent--bolp) ;I.e. non-virtual indent. + ;; For an open-paren-like thingy at BOL, always indent only + ;; based on other rules (typically smie-indent-after-keyword). + nil) + (t + ;; By default use point unless we're hanging. + (unless (smie-indent--hanging-p) (current-column))))) (t ;; FIXME: This still looks too much like black magic!! - (let* ((parent (smie-backward-sexp 'halfsexp))) + (let* ((parent (smie-backward-sexp token))) ;; Different behaviors: ;; - align with parent. ;; - parent + offset. From da2b5401e8747adb28558684b48328806bf43e1e Mon Sep 17 00:00:00 2001 From: Joe Matarazzo Date: Sat, 27 Nov 2010 11:29:22 +0200 Subject: [PATCH 28/30] Fix bug #7446 with overrunning input buffer in ebrowse. ebrowse.c (yylex): If end of input buffer encountered while searching for a newline after "//", return YYEOF. --- lib-src/ChangeLog | 5 +++++ lib-src/ebrowse.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index ba98132521d..0f518445a45 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,8 @@ +2010-11-27 Joe Matarazzo (tiny change) + + * ebrowse.c (yylex): If end of input buffer encountered while + searching for a newline after "//", return YYEOF. (Bug#7446) + 2010-11-10 YAMAMOTO Mitsuharu * emacsclient.c (set_local_socket) [DARWIN_OS]: Add fall-back diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index b51b4aa6965..67c9637daba 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -1784,6 +1784,11 @@ yylex () case '/': while (GET (c) && c != '\n') ; + /* Don't try to read past the end of the input buffer if + the file ends in a C++ comment without a newline. */ + if (c == 0) + return YYEOF; + INCREMENT_LINENO; break; From d1882ac7c91cbaa51aeea68433f1867e73a431c2 Mon Sep 17 00:00:00 2001 From: Eduard Wiebe Date: Sat, 27 Nov 2010 11:56:49 +0200 Subject: [PATCH 29/30] Fix bug #7308 with `locate' on MS-Windows. dired.el (dired-get-filename): Replace backslashes with slashes in file names on MS-Windows, needed by `locate'. locate.el (locate-default-make-command-line): Don't consider drive letter and root directory part of `directory-listing-before-filename-regexp'. (locate-post-command-hook, locate-post-command-hook): New defcustoms. --- lisp/ChangeLog | 9 +++++++++ lisp/dired.el | 8 ++++++++ lisp/locate.el | 14 ++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3ac8fd7a270..e8dda581208 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2010-11-27 Eduard Wiebe + + * dired.el (dired-get-filename): Replace backslashes with slashes + in file names on MS-Windows, needed by `locate'. (Bug#7308) + * locate.el (locate-default-make-command-line): Don't consider + drive letter and root directory part of + `directory-listing-before-filename-regexp'. (Bug#7308) + (locate-post-command-hook, locate-post-command-hook): New defcustoms. + 2010-11-26 Stefan Monnier * emacs-lisp/smie.el (smie-prec2->grammar): Simplify handling diff --git a/lisp/dired.el b/lisp/dired.el index bb0cc223281..b2bd082b1a6 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2012,6 +2012,14 @@ Otherwise, an error occurs in these cases." ;; with quotation marks in their names. (while (string-match "\\(?:[^\\]\\|\\`\\)\\(\"\\)" file) (setq file (replace-match "\\\"" nil t file 1))) + + (when (eq system-type 'windows-nt) + (save-match-data + (let ((start 0)) + (while (string-match "\\\\" file start) + (aset file (match-beginning 0) ?/) + (setq start (match-end 0)))))) + (setq file (read (concat "\"" file "\""))) ;; The above `read' will return a unibyte string if FILE ;; contains eight-bit-control/graphic characters. diff --git a/lisp/locate.el b/lisp/locate.el index ce1154c9739..d5caf8615cd 100644 --- a/lisp/locate.el +++ b/lisp/locate.el @@ -145,6 +145,11 @@ the version.)" :type 'string :group 'locate) +(defcustom locate-post-command-hook nil + "List of hook functions run after `locate' (see `run-hooks')." + :type 'hook + :group 'locate) + (defvar locate-history-list nil "The history list used by the \\[locate] command.") @@ -226,6 +231,11 @@ that is, with a prefix arg, you get the default behavior." :group 'locate :type 'boolean) +(defcustom locate-mode-hook nil + "List of hook functions run by `locate-mode' (see `run-mode-hooks')." + :type 'hook + :group 'locate) + ;; Functions (defun locate-default-make-command-line (search-string) @@ -471,9 +481,9 @@ do not work in subdirectories. (make-local-variable 'directory-listing-before-filename-regexp) ;; This should support both Unix and Windoze style names (setq directory-listing-before-filename-regexp - (concat "^." + (concat "^.\\(" (make-string (1- locate-filename-indentation) ?\s) - "\\(/\\|[A-Za-z]:\\)\\|" + "\\)\\|" (default-value 'directory-listing-before-filename-regexp))) (make-local-variable 'dired-actual-switches) (setq dired-actual-switches "") From 402c8a49571227f8a4e678d4a6cdd6ba7841aef9 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 27 Nov 2010 14:41:49 -0500 Subject: [PATCH 30/30] Fix log-edit-font-lock-keywords (Bug#6465). * log-edit.el (log-edit-font-lock-keywords): Don't try matching stand-alone lines, since that is handled by log-edit-match-to-eoh (Bug#6465). --- lisp/ChangeLog | 6 ++++++ lisp/log-edit.el | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e8dda581208..c6da166726b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-11-27 Chong Yidong + + * log-edit.el (log-edit-font-lock-keywords): Don't try matching + stand-alone lines, since that is handled by log-edit-match-to-eoh + (Bug#6465). + 2010-11-27 Eduard Wiebe * dired.el (dired-get-filename): Replace backslashes with slashes diff --git a/lisp/log-edit.el b/lisp/log-edit.el index 0d3061ad2df..ddc0f601701 100644 --- a/lisp/log-edit.el +++ b/lisp/log-edit.el @@ -350,17 +350,16 @@ automatically." (defvar log-edit-font-lock-keywords ;; Copied/inspired by message-font-lock-keywords. `((log-edit-match-to-eoh - (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp - "\\|\\(.*\\)") + (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp) (progn (goto-char (match-beginning 0)) (match-end 0)) nil (1 (if (assoc (match-string 2) log-edit-headers-alist) 'log-edit-header 'log-edit-unknown-header) nil lax) + ;; From `log-edit-header-contents-regexp': (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist)) 'log-edit-header) - nil lax) - (4 font-lock-warning-face))))) + nil lax))))) ;;;###autoload (defun log-edit (callback &optional setup params buffer mode &rest ignore)