commit 4b35dd653d35ba95c4d304bee69b69d41301ec3b (HEAD, refs/remotes/origin/master) Author: Katsumi Yamaoka Date: Thu May 11 05:49:45 2017 +0000 Kill modified buffers silently when quitting (bug#26862) * lisp/gnus/gnus-start.el (gnus-clear-system): Run do-auto-save to make sure that latest drafts are saved, and kill modified buffers silently. diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 90f3cb48c2..aaa8ab9a88 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -731,7 +731,13 @@ the first newsgroup." (kill-buffer (get-file-buffer (gnus-newsgroup-kill-file nil)))) (gnus-kill-buffer nntp-server-buffer) ;; Kill Gnus buffers. + (do-auto-save t) (dolist (buffer (gnus-buffers)) + (when (gnus-buffer-exists-p buffer) + (with-current-buffer buffer + (set-buffer-modified-p nil) + (when (local-variable-p 'kill-buffer-hook) + (setq kill-buffer-hook nil)))) (gnus-kill-buffer buffer)) ;; Remove Gnus frames. (gnus-kill-gnus-frames)) commit 7df0777945efbab390cad0e87b92dd92e0d1853f Author: Perry E. Metzger Date: Wed May 10 20:57:21 2017 +0300 Implement 1-based column numbering in mode line * src/xdisp.c (decode_mode_spec): Implement the %C construct. * lisp/bindings.el (column-number-indicator-zero-based): New defcustom. (mode-line-position): Use %C when column-number-indicator-zero-based is nil. * src/xdisp.c (syms_of_xdisp) : * src/buffer.c (syms_of_buffer) : * doc/lispref/modes.texi (%-Constructs): * doc/lispref/frames.texi (Frame Titles): Document the %C construct. * doc/emacs/display.texi (Optional Mode Line): Document 'column-number-indicator-zero-based'. * etc/NEWS: Mention 'column-number-indicator-zero-based' and the %C construct. diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 15c700892b..d07913cefb 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1338,13 +1338,19 @@ indicate what it is. @cindex mode, Column Number @findex column-number-mode Similarly, you can display the current column number by turning on -Column number mode with @kbd{M-x column-number-mode}. The column +Column Number mode with @kbd{M-x column-number-mode}. The column number is indicated by the letter @samp{C}. However, when both of these modes are enabled, the line and column numbers are displayed in parentheses, the line number first, rather than with @samp{L} and @samp{C}. For example: @samp{(561,2)}. @xref{Minor Modes}, for more information about minor modes and about how to use these commands. +@vindex column-number-indicator-zero-based + In Column Number mode, the displayed column number counts from zero +starting at the left margin of the window. If you would prefer for +the displayed column number to count from one, you may set +@code{column-number-indicator-zero-based} to @code{nil}. + @cindex narrowing, and line number display If you have narrowed the buffer (@pxref{Narrowing}), the displayed line number is relative to the accessible portion of the buffer. diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index bed7873fe3..fc7956d12e 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -2239,7 +2239,7 @@ frame is redisplayed. This variable specifies how to compute a name for a frame when you have not explicitly specified one. The variable's value is actually a mode line construct, just like @code{mode-line-format}, except that the -@samp{%c} and @samp{%l} constructs are ignored. @xref{Mode Line +@samp{%c}, @samp{%C}, and @samp{%l} constructs are ignored. @xref{Mode Line Data}. @end defvar diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 2e7d769f93..eb72fcfd36 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2111,7 +2111,12 @@ The current buffer name, obtained with the @code{buffer-name} function. @xref{Buffer Names}. @item %c -The current column number of point. +The current column number of point, counting from zero starting at the +left margin of the window. + +@item %C +The current column number of point, counting from one starting at the +left margin of the window. @item %e When Emacs is nearly out of memory for Lisp objects, a brief message diff --git a/etc/NEWS b/etc/NEWS index 4c0f4d2904..3b830c9342 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -342,6 +342,16 @@ suppresses display of return values from the server process. * Editing Changes in Emacs 26.1 +++ +** New variable 'column-number-indicator-zero-based'. +Traditionally, in Column Number mode, the displayed column number +counts from zero starting at the left margin of the window. This +behavior is now controlled by 'column-number-indicator-zero-based'. +If you would prefer for the displayed column number to count from one, +you may set this variable to nil. (Behind the scenes, there is now a +new mode line construct, '%C', which operates exactly as '%c' does +except that it counts from one.) + ++++ ** Two new user options 'list-matching-lines-jump-to-current-line' and 'list-matching-lines-current-line-face' to show highlighted the current line in *Occur* buffer. diff --git a/lisp/bindings.el b/lisp/bindings.el index a77fd4d599..85a5408717 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -354,6 +354,17 @@ mouse-3: Toggle minor modes" map) "\ Keymap to display on column and line numbers.") +(defcustom column-number-indicator-zero-based t + "When non-nil, mode line displays column numbers zero-based. + +This variable has effect only when Column Number mode is turned on, +which displays column numbers in the mode line. +If the value is non-nil, the displayed column numbers start from +zero, otherwise they start from one." + :type 'boolean + :group 'mode-line + :version "26.1") + (defvar mode-line-position `((-3 ,(propertize "%p" @@ -372,12 +383,19 @@ mouse-1: Display Line and Column Mode Menu")) mouse-1: Display Line and Column Mode Menu"))) (line-number-mode ((column-number-mode - (10 ,(propertize - " (%l,%c)" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Line number and Column number\n\ + (column-number-indicator-zero-based + (10 ,(propertize + " (%l,%c)" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Line number and Column number\n\ mouse-1: Display Line and Column Mode Menu")) + (10 ,(propertize + " (%l,%C)" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Line number and Column number\n\ +mouse-1: Display Line and Column Mode Menu"))) (6 ,(propertize " L%l" 'local-map mode-line-column-line-number-mode-map @@ -385,12 +403,19 @@ mouse-1: Display Line and Column Mode Menu")) 'help-echo "Line Number\n\ mouse-1: Display Line and Column Mode Menu")))) ((column-number-mode - (5 ,(propertize - " C%c" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Column number\n\ -mouse-1: Display Line and Column Mode Menu")))))) + (column-number-indicator-zero-based + (5 ,(propertize + " C%c" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Column number\n\ +mouse-1: Display Line and Column Mode Menu")) + (5 ,(propertize + " C%C" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Column number\n\ +mouse-1: Display Line and Column Mode Menu"))))))) "Mode line construct for displaying the position in the buffer. Normally displays the buffer percentage and, optionally, the buffer size, the line number and the column number.") diff --git a/src/buffer.c b/src/buffer.c index 33ffdf8eb8..80dbd3318d 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5486,8 +5486,11 @@ A string is printed verbatim in the mode line except for %-constructs: For a modified read-only buffer, %* gives % and %+ gives *. %s -- print process status. %l -- print the current line number. %c -- print the current column number (this makes editing slower). + Columns are numbered starting from the left margin, and the + leftmost column is displayed as zero. To make the column number update correctly in all cases, `column-number-mode' must be non-nil. + %C -- Like %c, but the leftmost column is displayed as one. %i -- print the size of the buffer. %I -- like %i, but use k, M, G, etc., to abbreviate. %p -- print percent of buffer above top of window, or Top, Bot or All. diff --git a/src/xdisp.c b/src/xdisp.c index c730cdae05..cdea20993c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -476,7 +476,7 @@ int windows_or_buffers_changed; used to track down the cause for this full-redisplay). Since the frame title uses the same %-constructs as the mode line - (except %c and %l), if this variable is non-zero, we also consider + (except %c, %C, and %l), if this variable is non-zero, we also consider redisplaying the title of each frame, see x_consider_frame_title. The `redisplay' bits are the same as those used for @@ -11530,7 +11530,7 @@ window_buffer_changed (struct window *w) return (BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star; } -/* True if W has %c in its mode line and mode line should be updated. */ +/* True if W has %c or %C in its mode line and mode line should be updated. */ static bool mode_line_update_needed (struct window *w) @@ -23690,7 +23690,8 @@ decode_mode_spec (struct window *w, register int c, int field_width, break; case 'c': - /* %c and %l are ignored in `frame-title-format'. + case 'C': + /* %c, %C, and %l are ignored in `frame-title-format'. (In redisplay_internal, the frame title is drawn _before_ the windows are updated, so the stuff which depends on actual window contents (such as %l) may fail to render properly, or @@ -23700,8 +23701,9 @@ decode_mode_spec (struct window *w, register int c, int field_width, else { ptrdiff_t col = current_column (); + int disp_col = (c == 'C') ? col + 1 : col; w->column_number_displayed = col; - pint2str (decode_mode_spec_buf, width, col); + pint2str (decode_mode_spec_buf, width, disp_col); return decode_mode_spec_buf; } @@ -23749,7 +23751,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, ptrdiff_t topline, nlines, height; ptrdiff_t junk; - /* %c and %l are ignored in `frame-title-format'. */ + /* %c, %C, and %l are ignored in `frame-title-format'. */ if (mode_line_target == MODE_LINE_TITLE) return ""; @@ -31725,7 +31727,7 @@ This variable is not guaranteed to be accurate except while processing \(Assuming the window manager supports this feature.) This variable has the same structure as `mode-line-format', except that -the %c and %l constructs are ignored. It is used only on frames for +the %c, %C, and %l constructs are ignored. It is used only on frames for which no explicit name has been set (see `modify-frame-parameters'). */); DEFVAR_LISP ("icon-title-format", Vicon_title_format, commit e124e07faede2f2d4c6f16af84d796f6305cb8d9 Author: Eli Zaretskii Date: Wed May 10 20:06:15 2017 +0300 Ensure cursor's foreground color is in sync with 'default' face * src/w32term.c (x_set_cursor_gc): Don't reuse cursor GC if its foreground color is different from the background of the glyph string's face. (Bug#26851) diff --git a/src/w32term.c b/src/w32term.c index 0f9dce9190..712bdae5fc 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -954,6 +954,10 @@ x_set_cursor_gc (struct glyph_string *s) if (s->font == FRAME_FONT (s->f) && s->face->background == FRAME_BACKGROUND_PIXEL (s->f) && s->face->foreground == FRAME_FOREGROUND_PIXEL (s->f) + /* Sometimes we are not called for each change in the default + face's background color (e.g., bug#26851), so the additional + test in the next line gives us a chance to resync. */ + && s->f->output_data.w32->cursor_gc->foreground == s->face->background && !s->cmp) s->gc = s->f->output_data.w32->cursor_gc; else commit de53dfcea3e1fdc6af171678300deb591b509cc4 Author: Eli Zaretskii Date: Wed May 10 19:58:06 2017 +0300 Fix vertical cursor motion when columns are of unequal size * lisp/simple.el (line-move-finish): In line-move-visual mode, use vertical-motion to move to the goal column, as the goal column should in that case be interpreted in units of frame's canonical character width. (Bug#26852) diff --git a/lisp/simple.el b/lisp/simple.el index edc822eb51..dfa30372dd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6399,7 +6399,12 @@ If NOERROR, don't signal an error if we can't move that many lines." (point)))) ;; Move to the desired column. - (line-move-to-column (truncate column)) + (if line-move-visual + ;; Under line-move-visual, goal-column should be + ;; interpreted in units of the frame's canonical character + ;; width, which is exactly what vertical-motion does. + (vertical-motion (cons column 0)) + (line-move-to-column (truncate column))) ;; Corner case: suppose we start out in a field boundary in ;; the middle of a continued line. When we get to