From 22c49c9acb1d68afc9f79e55a260005b5c4bf06e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 3 Jul 2014 12:29:22 -0400 Subject: [PATCH 01/25] * etc/NEWS: Fix description of incompatible change in `read-char'. --- etc/NEWS | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index c9af6348aac..f740a701a54 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -971,11 +971,11 @@ The new optional CHECK-TIMERS parameter allows for the prior behavior. Some languages match those as »...«, and others as «...», so it is better for Emacs to stay neutral by default. -** `read-event' does not return decoded chars in ttys any more. -As was the case in Emacs 22 and before, the decoding of terminal -input, according to `keyboard-coding-system', is not performed in -`read-event' any more. But unlike in Emacs 22, this decoding is still -done before `input-decode-map', `function-key-map', etc. +** `read-event' does not always decode chars in ttys any more. As was the case +in Emacs 22 and before, `read-event' (and `read-char') by default read raw +bytes from the terminal. If you want to read decoded chars instead (as was +always the case in Emacs-23, for example), pass a non-nil +`inherit-input-method' argument. ** In `symbol-function', nil and "unbound" are indistinguishable. `symbol-function' does not signal a `void-function' error any more. From 8abe20426b1e8e9911de1e355d82c66b8b1063aa Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 4 Jul 2014 02:48:24 +0300 Subject: [PATCH 02/25] * lisp/desktop.el (desktop-minor-mode-table): Add `defining-kbd-macro' and `isearch-mode' associated with nil. Fixes: debbugs:17849 --- lisp/ChangeLog | 5 +++++ lisp/desktop.el | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 73f1f286c43..78235d76879 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-03 Juri Linkov + + * desktop.el (desktop-minor-mode-table): Add `defining-kbd-macro' + and `isearch-mode' associated with nil. (Bug#17849) + 2014-07-02 Juri Linkov * desktop.el (desktop-save): Rename arg `auto-save' to diff --git a/lisp/desktop.el b/lisp/desktop.el index 4bb6fba3532..12207f3cdac 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -528,6 +528,8 @@ Furthermore the major mode function must be autoloaded.") (defcustom desktop-minor-mode-table '((auto-fill-function auto-fill-mode) + (defining-kbd-macro nil) + (isearch-mode nil) (vc-mode nil) (vc-dired-mode nil) (erc-track-minor-mode nil) From f35b80810d584b30397c5ce38acf2305e50c23db Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 4 Jul 2014 02:52:42 +0300 Subject: [PATCH 03/25] * doc/emacs/search.texi (Regexp Search): Update lax space matching that is not active in regexp search by default now. Fixes: debbugs:17901 --- doc/emacs/ChangeLog | 5 +++++ doc/emacs/search.texi | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 5457f2d1f42..e2a6b627a19 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2014-07-03 Juri Linkov + + * search.texi (Regexp Search): Update lax space matching that is + not active in regexp search by default now. (Bug#17901) + 2014-06-29 Glenn Morris * help.texi (Misc Help): diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 5331f7da1b9..64ecf165349 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -602,12 +602,13 @@ Incremental regexp and non-regexp searches have independent defaults. They also have separate search rings, which you can access with @kbd{M-p} and @kbd{M-n}. - Just as in ordinary incremental search, any @key{SPC} typed in -incremental regexp search matches any sequence of one or more -whitespace characters. The variable @code{search-whitespace-regexp} -specifies the regexp for the lax space matching, and @kbd{M-s @key{SPC}} -(@code{isearch-toggle-lax-whitespace}) toggles the feature. -@xref{Special Isearch}. + Unlike ordinary incremental search, incremental regexp search +do not use lax space matching by default. To toggle this feature +use @kbd{M-s @key{SPC}} (@code{isearch-toggle-lax-whitespace}). +Then any @key{SPC} typed in incremental regexp search will match +any sequence of one or more whitespace characters. The variable +@code{search-whitespace-regexp} specifies the regexp for the lax +space matching. @xref{Special Isearch}. In some cases, adding characters to the regexp in an incremental regexp search can make the cursor move back and start again. For From 7fe2ae672055afe911ee4b21e475d269001cc7d3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 3 Jul 2014 21:35:23 -0400 Subject: [PATCH 04/25] * lisp/progmodes/octave.el (inferior-octave-mode): Set comint-input-ring-size to a number. Fixes: debbugs:17912 --- lisp/ChangeLog | 5 +++++ lisp/progmodes/octave.el | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 78235d76879..021b0693654 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-04 Stefan Monnier + + * progmodes/octave.el (inferior-octave-mode): + Set comint-input-ring-size to a number (bug#17912). + 2014-07-03 Juri Linkov * desktop.el (desktop-minor-mode-table): Add `defining-kbd-macro' diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 3fdcec219d3..25b081545a3 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -747,9 +747,10 @@ Key bindings: (setq-local info-lookup-mode 'octave-mode) (setq-local eldoc-documentation-function 'octave-eldoc-function) - (setq comint-input-ring-file-name - (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist") - comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024)) + (setq-local comint-input-ring-file-name + (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")) + (setq-local comint-input-ring-size + (string-to-number (or (getenv "OCTAVE_HISTSIZE") "1024"))) (comint-read-input-ring t) (setq-local comint-dynamic-complete-functions inferior-octave-dynamic-complete-functions) From c247c7753ea0b44525bd99c2cc7f35cbef1505d9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 Jul 2014 10:35:22 +0300 Subject: [PATCH 05/25] Minor updates in etc/TODO and etc/NEWS. etc/TODO: Remove items that were already done. Rearrange a few items that are closely related. Update a couple of items with new information. etc/NEWS: Mention 'network-interface-list' and 'network-interface-info' being available on MS-Windows. --- etc/ChangeLog | 9 ++++++++ etc/NEWS | 5 ++++- etc/TODO | 57 ++++++++++++++------------------------------------- 3 files changed, 28 insertions(+), 43 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 9493fc0a64f..d30c03f1c20 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,12 @@ +2014-07-04 Eli Zaretskii + + * TODO: Remove items that were already done. Rearrange a few + items that are closely related. Update a couple of items with new + information. + + * NEWS: Mention 'network-interface-list' and 'network-interface-info' + being available on MS-Windows. + 2014-06-29 Glenn Morris * refcards/calccard.tex (section{Getting Help}): diff --git a/etc/NEWS b/etc/NEWS index f740a701a54..2f3a3d0e38e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1324,10 +1324,13 @@ edited in another Emacs session or by another user. See the node "Interlocking" in the Emacs User Manual for the details. To disable file locking, customize `create-lockfiles' to nil. -** The "generate a backtrace on fatal error" feature now works on MS Windows. +** The "generate a backtrace on fatal error" feature now works on MS-Windows. The backtrace is written to the 'emacs_backtrace.txt' file in the directory where Emacs was running. +** The `network-interface-list' and `network-interface-info' functions +are now available on MS-Windows. + ** The variable `buffer-file-type' is no longer supported. Setting it has no effect, and %t in the mode-line format is ignored. Likewise, `file-name-buffer-file-type-alist' is now obsolete, and diff --git a/etc/TODO b/etc/TODO index 18dd54d4582..192136b0c29 100644 --- a/etc/TODO +++ b/etc/TODO @@ -167,14 +167,6 @@ http://lists.gnu.org/archive/html/emacs-devel/2007-04/msg00782.html ** Find a proper fix for rcirc multiline nick adding. http://lists.gnu.org/archive/html/emacs-devel/2007-04/msg00684.html -** Implement `network-interface-list' and `network-interface-info' -on MS-Windows. Hint: the information is present in the Registry, -under the keys -HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Linkage\ -and -HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\\ -where is the network device found under the first key. - ** Check for any included packages that define obsolete bug-reporting commands. Change them to use report-emacs-bug. *** Related functions: @@ -232,8 +224,15 @@ Perspectives also need to interact with the tabs. ** FFI (foreign function interface) See eg http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00246.html +One way of doing this is to start with fx's dynamic loading, and use it +to implement things like auto-loaded buffer parsers and database +access in cases which need more than Lisp. + ** Replace unexec with a more portable form of dumping See eg http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01034.html + http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00452.html + +One way is to provide portable undumping using mmap (per gerd design). ** Imenu could be extended into a file-structure browsing mechanism using code like that of customize-groups. @@ -260,13 +259,15 @@ scroll bars are extensible. by http://savannah.nongnu.org/projects/emacs-rtf/, which is still in very early stages. + Another place to look is the Wikipedia article at + http://en.wikipedia.org/wiki/Rich_Text_Format + + It currently points to the latest spec of RTF v1.9.1 at + http://www.microsoft.com/en-us/download/details.aspx?id=10725 + ** Implement primitive and higher-level functions to allow filling properly with variable-pitch faces. -** Implement a smoother vertical scroll facility, one that allows - C-v to scroll through a tall image. The primitive operations - posn-at-point and posn-at-x-y should now make it doable in elisp. - ** Implement intelligent search/replace, going beyond query-replace (see http://groups.csail.mit.edu/uid/projects/clustering/chi04.pdf). @@ -301,9 +302,6 @@ specified filters, specified timers, and specified hooks. Maybe making Lucid menus work like Gtk's (i.e. just force utf-8) is good enough now that Emacs can encode most chars into utf-8. -** Remove the limitation that window and frame widths and heights can - be only full columns/lines. - ** The GNUstep port needs some serious attention, ideally from someone familiar with GNUstep and Objective C. @@ -311,6 +309,7 @@ familiar with GNUstep and Objective C. ** Allow frames(terminals) created by emacsclient to inherit their environment from the emacsclient process. + ** Remove the default toggling behavior of minor modes when called from elisp rather than interactively. This a trivial one-liner in easy-mode.el. @@ -382,23 +381,6 @@ rather than interactively. This a trivial one-liner in easy-mode.el. user-selected input method, with the default being the union of latin-1-prefix and latin-1-postfix. -** Switch the Windows port to using Unicode keyboard input (maybe). - Based on http://msdn2.microsoft.com/en-us/library/ms633586.aspx, - this boils down to (1) calling RegisterClassW function to register - Emacs windows, and (2) modifying ALL system messages to use Unicode. - In particular, WM_CHAR messages, which result from keyboard input, - will then come in encoded in UTF-16. - - One advantage of switching to Unicode is to toss encoded-kbd usage, - which will solve the problem with binding non-ASCII keys with modifiers. - - Problem: using this on Windows 9x/ME requires installing the - Microsoft Layer for Unicode (MSLU), which might not implement all - the required functionality that is available built-in on Windows XP - and later. We should not make this change if it would pressure - users of unauthorized copies of older versions of Windows to - downgrade to versions that require activation. - ** Implement a clean way to use different major modes for different parts of a buffer. This could be useful in editing Bison input files, for instance, or other kinds of text @@ -444,9 +426,6 @@ rather than interactively. This a trivial one-liner in easy-mode.el. multiple inheritance ? faster where-is ? no more fix_submap_inheritance ? what else ? -** Provide real menus on ttys. The MS-DOS implementation can serve as - an example how to do part of this; see the XMenu* functions on msdos.c. - ** Implement popular parts of the rest of the CL functions as compiler macros in cl-macs. [Is this still relevant now that cl-lib exists?] @@ -510,15 +489,9 @@ rather than interactively. This a trivial one-liner in easy-mode.el. tree displays generally, mode-line mail indicator. [See work done already for Emacs 23 and consult fx.] -** Do something to make rms happy with fx's dynamic loading, and use it - to implement things like auto-loaded buffer parsers and database - access in cases which need more than Lisp. - ** Extend ps-print to deal with multiple font sizes, images, and extra encodings. -** Provide portable undumping using mmap (per gerd design). - ** Make byte-compile avoid binding an expanded defsubst's args when the body only calls primitives. @@ -727,7 +700,7 @@ preferring the ImageMagick loader? The user might like zooming etc in jpegs. Try (setq image-type-header-regexps nil) for a quick hack to prefer ImageMagick over the jpg loader. -*** For some reason its unbearably slow to look at a page in a large +*** For some reason it's unbearably slow to look at a page in a large image bundle using the :index feature. The ImageMagick "display" command is also a bit slow, but nowhere near as slow as the Emacs code. It seems ImageMagick tries to unpack every page when loading the From f0f34bc8b91dad77474f8f8c8d9f4bda568eaace Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 Jul 2014 10:40:08 +0300 Subject: [PATCH 06/25] src/w32.c (network_interface_info): Make sure the argument is a Lisp string. --- src/ChangeLog | 5 +++++ src/w32.c | 1 + 2 files changed, 6 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index f84fe133c7e..24343faa407 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-07-04 Eli Zaretskii + + * w32.c (network_interface_info): Make sure the argument is a + Lisp string. + 2014-07-01 Eli Zaretskii * dispnew.c (prepare_desired_row): Accept 2 additional arguments: diff --git a/src/w32.c b/src/w32.c index 0892f932bc2..15e53600d95 100644 --- a/src/w32.c +++ b/src/w32.c @@ -8611,6 +8611,7 @@ network_interface_list (void) Lisp_Object network_interface_info (Lisp_Object ifname) { + CHECK_STRING (ifname); return network_interface_get_info (ifname); } From 5b5953c070455773f3bdfb9ebcc7ecc15dde0611 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 Jul 2014 16:22:04 +0300 Subject: [PATCH 07/25] Fix bug #17905 with display of point in partially visible line at end of window. src/xdisp.c (redisplay_window): If redisplay of a window ends up with point in a partially visible line at end of the window, make sure the amended position of point actually has smaller Y coordinate; if not, give up and scroll the display. src/window.c (window_scroll_pixel_based): When point ends up at the last fully visible line, don't let move_it_to stop at the left edge of the line and dupe us into thinking point is inside the scroll margin. --- src/ChangeLog | 10 ++++++++++ src/window.c | 26 ++++++++++++++++++++++++++ src/xdisp.c | 12 ++++++++++++ 3 files changed, 48 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 24343faa407..a88c6caacfd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,15 @@ 2014-07-04 Eli Zaretskii + * xdisp.c (redisplay_window): If redisplay of a window ends up + with point in a partially visible line at end of the window, make + sure the amended position of point actually has smaller Y + coordinate; if not, give up and scroll the display. (Bug#17905) + + * window.c (window_scroll_pixel_based): When point ends up at the + last fully visible line, don't let move_it_to stop at the left + edge of the line and dupe us into thinking point is inside the + scroll margin. + * w32.c (network_interface_info): Make sure the argument is a Lisp string. diff --git a/src/window.c b/src/window.c index 8e8252d3b76..5e9dd0ec718 100644 --- a/src/window.c +++ b/src/window.c @@ -5167,6 +5167,32 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); + /* If PT is in the screen line at the last fully visible line, + move_it_to will stop at X = 0 in that line, because the + required Y coordinate is reached there. See if we can get to + PT without descending lower in Y, and if we can, it means we + reached PT before the scroll margin. */ + if (charpos != PT) + { + struct it it2; + void *it_data; + + it2 = it; + it_data = bidi_shelve_cache (); + move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); + if (IT_CHARPOS (it) == PT && it.current_y == it2.current_y) + { + charpos = IT_CHARPOS (it); + bytepos = IT_BYTEPOS (it); + bidi_unshelve_cache (it_data, 1); + } + else + { + it = it2; + bidi_unshelve_cache (it_data, 0); + } + } + /* See if point is on a partially visible line at the end. */ if (it.what == IT_EOB) partial_p = it.current_y + it.ascent + it.descent > it.last_visible_y; diff --git a/src/xdisp.c b/src/xdisp.c index 459edf4367f..fe5d0f579d8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -16106,6 +16106,18 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) /* Point does appear, but on a line partly visible at end of window. Move it back to a fully-visible line. */ new_vpos = window_box_height (w); + /* But if window_box_height suggests a Y coordinate that is + not less than we already have, that line will clearly not + be fully visible, so give up and scroll the display. + This can happen when the default face uses a font whose + dimensions are different from the frame's default + font. */ + if (new_vpos >= w->cursor.y) + { + w->cursor.vpos = -1; + clear_glyph_matrix (w->desired_matrix); + goto try_to_scroll; + } } else if (w->cursor.vpos >= 0) { From 8069993ef72ba8578a84091dae1994f4d19140be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Fri, 4 Jul 2014 17:15:02 +0200 Subject: [PATCH 08/25] Backport from trunk. * xfns.c (create_frame_xic): Pass XNStatusAttributes to XCreateIC only if xic_style calls for it. This change allows Emacs to work with ibus. Also, don't leak resources if create_frame_xic fails, and stop caching xic_style across different displays. (supported_xim_styles): Make const. (best_xim_style): Remove first parameter: it's always just supported_xim_styles. Change to look at supported_xim_styles directly. Fixes: debbugs:17928 --- src/ChangeLog | 12 +++++ src/xfns.c | 143 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 106 insertions(+), 49 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index a88c6caacfd..3d6311c765b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2014-07-04 Daniel Colascione + + Backport from trunk. + * xfns.c (create_frame_xic): Pass XNStatusAttributes to XCreateIC + only if xic_style calls for it. This change allows Emacs to work + with ibus. Also, don't leak resources if create_frame_xic fails, + and stop caching xic_style across different displays (Bug#17928). + (supported_xim_styles): Make const. + (best_xim_style): Remove first parameter: it's always just + supported_xim_styles. Change to look at supported_xim_styles + directly. + 2014-07-04 Eli Zaretskii * xdisp.c (redisplay_window): If redisplay of a window ends up diff --git a/src/xfns.c b/src/xfns.c index 5dbc7053fd9..692504ef762 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1641,12 +1641,12 @@ hack_wm_protocols (struct frame *f, Widget widget) #ifdef HAVE_X_I18N static XFontSet xic_create_xfontset (struct frame *); -static XIMStyle best_xim_style (XIMStyles *, XIMStyles *); +static XIMStyle best_xim_style (XIMStyles *); /* Supported XIM styles, ordered by preference. */ -static XIMStyle supported_xim_styles[] = +static const XIMStyle supported_xim_styles[] = { XIMPreeditPosition | XIMStatusArea, XIMPreeditPosition | XIMStatusNothing, @@ -1941,14 +1941,16 @@ xic_free_xfontset (struct frame *f) input method XIM. */ static XIMStyle -best_xim_style (XIMStyles *user, XIMStyles *xim) +best_xim_style (XIMStyles *xim) { int i, j; + int nr_supported = + sizeof (supported_xim_styles) / sizeof (supported_xim_styles[0]); - for (i = 0; i < user->count_styles; ++i) + for (i = 0; i < nr_supported; ++i) for (j = 0; j < xim->count_styles; ++j) - if (user->supported_styles[i] == xim->supported_styles[j]) - return user->supported_styles[i]; + if (supported_xim_styles[i] == xim->supported_styles[j]) + return supported_xim_styles[i]; /* Return the default style. */ return XIMPreeditNothing | XIMStatusNothing; @@ -1956,42 +1958,41 @@ best_xim_style (XIMStyles *user, XIMStyles *xim) /* Create XIC for frame F. */ -static XIMStyle xic_style; - void create_frame_xic (struct frame *f) { XIM xim; XIC xic = NULL; XFontSet xfs = NULL; + XVaNestedList status_attr = NULL; + XVaNestedList preedit_attr = NULL; + XRectangle s_area; + XPoint spot; + XIMStyle xic_style; if (FRAME_XIC (f)) - return; + goto out; + + xim = FRAME_X_XIM (f); + if (!xim) + goto out; + + /* Determine XIC style. */ + xic_style = best_xim_style (FRAME_X_XIM_STYLES (f)); /* Create X fontset. */ - xfs = xic_create_xfontset (f); - xim = FRAME_X_XIM (f); - if (xim) + if (xic_style & (XIMPreeditPosition | XIMStatusArea)) { - XRectangle s_area; - XPoint spot; - XVaNestedList preedit_attr; - XVaNestedList status_attr; + xfs = xic_create_xfontset (f); + if (!xfs) + goto out; - s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1; + FRAME_XIC_FONTSET (f) = xfs; + } + + if (xic_style & XIMPreeditPosition) + { spot.x = 0; spot.y = 1; - - /* Determine XIC style. */ - if (xic_style == 0) - { - XIMStyles supported_list; - supported_list.count_styles = (sizeof supported_xim_styles - / sizeof supported_xim_styles[0]); - supported_list.supported_styles = supported_xim_styles; - xic_style = best_xim_style (&supported_list, - FRAME_X_XIM_STYLES (f)); - } - preedit_attr = XVaCreateNestedList (0, XNFontSet, xfs, XNForeground, @@ -2003,31 +2004,75 @@ create_frame_xic (struct frame *f) : NULL), &spot, NULL); - status_attr = XVaCreateNestedList (0, - XNArea, - &s_area, - XNFontSet, - xfs, - XNForeground, - FRAME_FOREGROUND_PIXEL (f), - XNBackground, - FRAME_BACKGROUND_PIXEL (f), - NULL); - xic = XCreateIC (xim, - XNInputStyle, xic_style, - XNClientWindow, FRAME_X_WINDOW (f), - XNFocusWindow, FRAME_X_WINDOW (f), - XNStatusAttributes, status_attr, - XNPreeditAttributes, preedit_attr, - NULL); - XFree (preedit_attr); - XFree (status_attr); + if (!preedit_attr) + goto out; } + if (xic_style & XIMStatusArea) + { + s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1; + status_attr = XVaCreateNestedList (0, + XNArea, + &s_area, + XNFontSet, + xfs, + XNForeground, + FRAME_FOREGROUND_PIXEL (f), + XNBackground, + FRAME_BACKGROUND_PIXEL (f), + NULL); + + if (!status_attr) + goto out; + } + + if (preedit_attr && status_attr) + xic = XCreateIC (xim, + XNInputStyle, xic_style, + XNClientWindow, FRAME_X_WINDOW (f), + XNFocusWindow, FRAME_X_WINDOW (f), + XNStatusAttributes, status_attr, + XNPreeditAttributes, preedit_attr, + NULL); + else if (preedit_attr) + xic = XCreateIC (xim, + XNInputStyle, xic_style, + XNClientWindow, FRAME_X_WINDOW (f), + XNFocusWindow, FRAME_X_WINDOW (f), + XNPreeditAttributes, preedit_attr, + NULL); + else if (status_attr) + xic = XCreateIC (xim, + XNInputStyle, xic_style, + XNClientWindow, FRAME_X_WINDOW (f), + XNFocusWindow, FRAME_X_WINDOW (f), + XNStatusAttributes, status_attr, + NULL); + else + xic = XCreateIC (xim, + XNInputStyle, xic_style, + XNClientWindow, FRAME_X_WINDOW (f), + XNFocusWindow, FRAME_X_WINDOW (f), + NULL); + + if (!xic) + goto out; + FRAME_XIC (f) = xic; FRAME_XIC_STYLE (f) = xic_style; - FRAME_XIC_FONTSET (f) = xfs; + xfs = NULL; /* Don't free below. */ + + out: + + if (xfs) + free_frame_xic (f); + + if (preedit_attr) + XFree (preedit_attr); + + if (status_attr) + XFree (status_attr); } From 95fab4ba13c785ff350fb8c1a7b67f2643d1f878 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Fri, 4 Jul 2014 17:53:25 +0200 Subject: [PATCH 09/25] * calendar/todo-mode.el: Fix two bugs. Shorten Commentary and refer to the Todo mode Info manual. Update the comment on requiring cl-lib. (todo-find-filtered-items-file): Add todo-prefix overlays. (todo-filter-items): Reorder a let-bound variable to avoid a wrong-type-argument error on canceling the file choice dialog. --- lisp/ChangeLog | 9 +++++ lisp/calendar/todo-mode.el | 77 +++++++++++++------------------------- 2 files changed, 35 insertions(+), 51 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 021b0693654..e9c492dc013 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2014-07-04 Stephen Berman + + * calendar/todo-mode.el: Fix two bugs. Shorten Commentary and + refer to the Todo mode Info manual. Update the comment on + requiring cl-lib. + (todo-find-filtered-items-file): Add todo-prefix overlays. + (todo-filter-items): Reorder a let-bound variable to avoid a + wrong-type-argument error on canceling the file choice dialog. + 2014-07-04 Stefan Monnier * progmodes/octave.el (inferior-octave-mode): diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index b4945c542c5..a1da75c20e8 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -24,63 +24,37 @@ ;;; Commentary: -;; This package provides facilities for making, displaying, navigating -;; and editing todo lists, which are prioritized lists of todo items. -;; Todo lists are identified with named categories, so you can group -;; together and separately prioritize thematically related todo items. -;; Each category is stored in a file, which thus provides a further -;; level of organization. You can create as many todo files, and in -;; each as many categories, as you want. +;; This package provides facilities for making and maintaining +;; prioritized lists of things to do. These todo lists are identified +;; with named categories, so you can group together thematically +;; related todo items. Each category is stored in a file, providing a +;; further level of organization. You can create as many todo files, +;; and in each as many categories, as you want. ;; With Todo mode you can navigate among the items of a category, and ;; between categories in the same and in different todo files. You -;; can edit todo items, reprioritize them within their category, move -;; them to another category, delete them, or mark items as done and -;; store them separately from the not yet done items in a category. -;; You can add new todo files, edit and delete them. You can add new -;; categories, rename and delete them, move categories to another file -;; and merge the items of two categories. You can also reorder the -;; sequence of categories in a todo file for the purpose of -;; navigation. You can display summary tables of the categories in a -;; file and the types of items they contain. And you can compile -;; lists of existing items from multiple categories in one or more -;; todo files, which are filtered by various criteria. +;; can add and edit todo items, reprioritize them, move them to +;; another category, or delete them. You can also mark items as done +;; and store them within their category or in separate archive files. +;; You can include todo items in the Emacs Fancy Diary display and +;; treat them as appointments. You can add new todo files, and rename +;; or delete them. You can add new categories to a file, rename or +;; delete them, move a category to another file and merge the items of +;; two categories. You can also reorder the sequence of categories in +;; a todo file for the purpose of navigation. You can display +;; sortable summary tables of the categories in a file and the types +;; of items they contain. And you can filter items by various +;; criteria from multiple categories in one or more todo files to +;; create prioritizable cross-category overviews of your todo items. -;; To get started, load this package and type `M-x todo-show'. This -;; will prompt you for the name of the first todo file, its first -;; category and the category's first item, create these and display -;; them in Todo mode. Now you can insert further items into the list -;; (i.e., the category) and assign them priorities by typing `i i'. - -;; You will probably find it convenient to give `todo-show' a global -;; key binding in your init file, since it is one of the entry points -;; to Todo mode; a good choice is `C-c t', since `todo-show' is -;; bound to `t' in Todo mode. - -;; To see a list of all Todo mode commands and their key bindings, -;; including other entry points, type `C-h m' in Todo mode. Consult -;; the documentation strings of the commands for details of their use. -;; The `todo' customization group and its subgroups list the options -;; you can set to alter the behavior of many commands and various -;; aspects of the display. - -;; This package is a new version of Oliver Seidel's todo-mode.el. -;; While it retains the same basic organization and handling of todo -;; lists and the basic UI, it significantly extends these and adds -;; many features. This required also making changes to the internals, -;; including the file format. If you have a todo file in old format, -;; then the first time you invoke `todo-show' (i.e., before you have -;; created any todo file in the current format), it will ask you -;; whether to convert that file and show it. If you choose not to -;; convert the old-style file at this time, you can do so later by -;; calling the command `todo-convert-legacy-files'. +;; To get started, type `M-x todo-show'. For full details of the user +;; interface, commands and options, consult the Todo mode user manual, +;; which is included in the Info documentation. ;;; Code: (require 'diary-lib) -;; For cl-remove-duplicates (in todo-insertion-commands-args) and -;; cl-oddp. -(require 'cl-lib) +(require 'cl-lib) ; For cl-oddp and cl-assert. ;; ----------------------------------------------------------------------------- ;;; Setting up todo files, categories, and items @@ -3971,7 +3945,8 @@ regexp items." (setq file (cdr (assoc-string file falist))) (find-file file) (unless (derived-mode-p 'todo-filtered-items-mode) - (todo-filtered-items-mode)))) + (todo-filtered-items-mode)) + (todo-prefix-overlays))) (defun todo-go-to-source-item () "Display the file and category of the filtered item at point." @@ -4080,7 +4055,6 @@ multifile commands for further details." (progn (todo-multiple-filter-files) todo-multiple-filter-files)) (list todo-current-todo-file))) - (multi (> (length flist) 1)) (fname (if (equal flist 'quit) ;; Pressed `cancel' in t-m-f-f file selection dialog. (keyboard-quit) @@ -4089,6 +4063,7 @@ multifile commands for further details." (cond (top ".todt") (diary ".tody") (regexp ".todr"))))) + (multi (> (length flist) 1)) (rxfiles (when regexp (directory-files todo-directory t ".*\\.todr$" t))) (file-exists (or (file-exists-p fname) rxfiles)) From 661b90d8b657a68fa2101533302728c2c531df3c Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Fri, 4 Jul 2014 21:09:29 +0200 Subject: [PATCH 10/25] * todo-mode.texi (Levels of Organization): Comment out statement that Emacs recognizes todo files by their extension, since this feature has been removed due to bug#17482. --- doc/misc/ChangeLog | 6 ++++++ doc/misc/todo-mode.texi | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 8547299aafc..84dea26ca32 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,9 @@ +2014-07-04 Stephen Berman + + * todo-mode.texi (Levels of Organization): Comment out statement + that Emacs recognizes todo files by their extension, since this + feature has been removed due to bug#17482. + 2014-06-29 Glenn Morris * info.texi, mh-e.texi: "Online help" doesn't mean what it diff --git a/doc/misc/todo-mode.texi b/doc/misc/todo-mode.texi index e63bc2c64a2..092137268f7 100644 --- a/doc/misc/todo-mode.texi +++ b/doc/misc/todo-mode.texi @@ -158,11 +158,10 @@ you want. All todo files reside in a single directory, whose location is specified by the user option @code{todo-directory}. This directory may also contain other types of Todo files, which are discussed later -(@pxref{Todo Archive Mode} and @ref{Todo Filtered Items Mode}). Emacs -recognizes Todo files by their extension, so when you visit the files -the buffer is in the appropriate mode and the current category is -correctly displayed. - +(@pxref{Todo Archive Mode} and @ref{Todo Filtered Items Mode}). +@c Emacs recognizes Todo files by their extension, so when you visit +@c the files the buffer is in the appropriate mode and the current +@c category is correctly displayed. When you use a Todo mode command to create a todo file, the extension @samp{.todo} is automatically added to the base name you choose (as a rule, this name is also used for the other types of Todo files, which From 6246df666bc864c82e9436f929c1e04d200d1d25 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 4 Jul 2014 22:17:14 -0400 Subject: [PATCH 11/25] * src/syntax.c (find_defun_start): Try the cache even if !open_paren_in_column_0_is_defun_start. (back_comment): If find_defun_start was pessimistic, use the scan_sexps_forward result to improve the cache. Fixes: debbugs:16526 --- src/ChangeLog | 10 ++++++++-- src/syntax.c | 36 +++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3d6311c765b..6048522cdc4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-07-05 Stefan Monnier + + * syntax.c (find_defun_start): Try the cache even + if !open_paren_in_column_0_is_defun_start. + (back_comment): If find_defun_start was pessimistic, use the + scan_sexps_forward result to improve the cache (bug#16526). + 2014-07-04 Daniel Colascione Backport from trunk. @@ -7,8 +14,7 @@ and stop caching xic_style across different displays (Bug#17928). (supported_xim_styles): Make const. (best_xim_style): Remove first parameter: it's always just - supported_xim_styles. Change to look at supported_xim_styles - directly. + supported_xim_styles. Change to look at supported_xim_styles directly. 2014-07-04 Eli Zaretskii diff --git a/src/syntax.c b/src/syntax.c index f2451332b19..0ee48bb3725 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -530,17 +530,6 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) { ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; - if (!open_paren_in_column_0_is_defun_start) - { - find_start_value = BEGV; - find_start_value_byte = BEGV_BYTE; - find_start_buffer = current_buffer; - find_start_modiff = MODIFF; - find_start_begv = BEGV; - find_start_pos = pos; - return BEGV; - } - /* Use previous finding, if it's valid and applies to this inquiry. */ if (current_buffer == find_start_buffer /* Reuse the defun-start even if POS is a little farther on. @@ -552,6 +541,13 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) && MODIFF == find_start_modiff) return find_start_value; + if (!open_paren_in_column_0_is_defun_start) + { + find_start_value = BEGV; + find_start_value_byte = BEGV_BYTE; + goto found; + } + /* Back up to start of line. */ scan_newline (pos, pos_byte, BEGV, BEGV_BYTE, -1, 1); @@ -582,13 +578,14 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) /* Record what we found, for the next try. */ find_start_value = PT; find_start_value_byte = PT_BYTE; + TEMP_SET_PT_BOTH (opoint, opoint_byte); + + found: find_start_buffer = current_buffer; find_start_modiff = MODIFF; find_start_begv = BEGV; find_start_pos = pos; - TEMP_SET_PT_BOTH (opoint, opoint_byte); - return find_start_value; } @@ -841,7 +838,9 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, else { struct lisp_parse_state state; + bool adjusted; lossage: + adjusted = true; /* We had two kinds of string delimiters mixed up together. Decode this going forwards. Scan fwd from a known safe place (beginning-of-defun) @@ -852,6 +851,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, { defun_start = find_defun_start (comment_end, comment_end_byte); defun_start_byte = find_start_value_byte; + adjusted = (defun_start > BEGV); } do { @@ -860,6 +860,16 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, comment_end, TYPE_MINIMUM (EMACS_INT), 0, Qnil, 0); defun_start = comment_end; + if (!adjusted) + { + adjusted = true; + find_start_value + = CONSP (state.levelstarts) ? XINT (XCAR (state.levelstarts)) + : state.thislevelstart >= 0 ? state.thislevelstart + : find_start_value; + find_start_value_byte = CHAR_TO_BYTE (find_start_value); + } + if (state.incomment == (comnested ? 1 : -1) && state.comstyle == comstyle) from = state.comstr_start; From bf97132f839ca4717ffd173c7aa80d48feb254d5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Jul 2014 10:38:13 +0300 Subject: [PATCH 12/25] Fix bug #17942 with pos-visible-in-window-p and image and BOB. src/xdisp.c (pos_visible_p): If CHARPOS is at BEGV, and there is a display property at BEGV, don't call move_it_to to move to a position before BEGV. --- src/ChangeLog | 6 ++++++ src/xdisp.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6048522cdc4..dde148dc165 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-07-05 Eli Zaretskii + + * xdisp.c (pos_visible_p): If CHARPOS is at BEGV, and there is a + display property at BEGV, don't call move_it_to to move to a + position before BEGV. (Bug#17942) + 2014-07-05 Stefan Monnier * syntax.c (find_defun_start): Try the cache even diff --git a/src/xdisp.c b/src/xdisp.c index fe5d0f579d8..f5ddf828314 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1585,7 +1585,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, /* Move to the last buffer position before the display property. */ start_display (&it3, w, top); - move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); + if (start > BEGV) + move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); /* Move forward one more line if the position before the display string is a newline or if it is the rightmost character on a line that is From f2c74bf38322ec715bb93c259e3570c015af78cf Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Jul 2014 11:24:07 +0300 Subject: [PATCH 13/25] A better fix for bug #17942. src/xdisp.c (pos_visible_p): If CHARPOS is at beginning of window, and there is a display property at that position, don't call move_it_to to move to a position before window start. --- src/ChangeLog | 6 +++--- src/xdisp.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index dde148dc165..a3210b557c7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,8 @@ 2014-07-05 Eli Zaretskii - * xdisp.c (pos_visible_p): If CHARPOS is at BEGV, and there is a - display property at BEGV, don't call move_it_to to move to a - position before BEGV. (Bug#17942) + * xdisp.c (pos_visible_p): If CHARPOS is at beginning of window, + and there is a display property at that position, don't call + move_it_to to move to a position before window start. (Bug#17942) 2014-07-05 Stefan Monnier diff --git a/src/xdisp.c b/src/xdisp.c index f5ddf828314..f49710b21e5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1585,7 +1585,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, /* Move to the last buffer position before the display property. */ start_display (&it3, w, top); - if (start > BEGV) + if (start > CHARPOS (top)) move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); /* Move forward one more line if the position before the display string is a newline or if it is the From 546c26b394b5b9c14cfef71c36ba8d8f6af8217d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Jul 2014 12:53:50 +0300 Subject: [PATCH 14/25] Fix bug #17944 with pos-visible-in-window-p when there's image at window start. src/xdisp.c (pos_visible_p): Fix condition for finding CHARPOS by the first call to move_it_to. --- src/ChangeLog | 2 ++ src/xdisp.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index a3210b557c7..89621bd54ec 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,8 @@ * xdisp.c (pos_visible_p): If CHARPOS is at beginning of window, and there is a display property at that position, don't call move_it_to to move to a position before window start. (Bug#17942) + Fix condition for finding CHARPOS by the first call to move_it_to. + (Bug#17944) 2014-07-05 Stefan Monnier diff --git a/src/xdisp.c b/src/xdisp.c index f49710b21e5..913b57ed44b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1436,7 +1436,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, (charpos >= 0 ? MOVE_TO_POS : 0) | MOVE_TO_Y); if (charpos >= 0 - && (((!it.bidi_p || it.bidi_it.scan_dir == 1) + && (((!it.bidi_p || it.bidi_it.scan_dir != -1) && IT_CHARPOS (it) >= charpos) /* When scanning backwards under bidi iteration, move_it_to stops at or _before_ CHARPOS, because it stops at or to From bff2d1ffc49d635a7545fd31786ac9e6966016ba Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Jul 2014 13:24:11 +0300 Subject: [PATCH 15/25] src/xdisp.c (pos_visible_p): Fix inaccurate comment. --- src/xdisp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index 913b57ed44b..28752a42cb9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1689,7 +1689,9 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, } else { - /* We were asked to provide info about WINDOW_END. */ + /* Either we were asked to provide info about WINDOW_END, or + CHARPOS is in the partially visible glyph row at end of + window. */ struct it it2; void *it2data = NULL; From d66146bf1851fd65a903b1b67b3deee3aba2082e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 5 Jul 2014 14:37:45 -0400 Subject: [PATCH 16/25] * lisp/progmodes/ruby-mode.el (ruby-mode-variables): Don't meddle with require-final-newline since prog-mode already took care of it. Fixes: debbugs:17947 --- lisp/ChangeLog | 5 +++++ lisp/progmodes/ruby-mode.el | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e9c492dc013..b34f9cf1fef 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-05 Stefan Monnier + + * progmodes/ruby-mode.el (ruby-mode-variables): Don't meddle with + require-final-newline since prog-mode already took care of it (bug#17947). + 2014-07-04 Stephen Berman * calendar/todo-mode.el: Fix two bugs. Shorten Commentary and diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 3c20279600e..2f23e338f81 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -749,7 +749,6 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." :forward-token #'ruby-smie--forward-token :backward-token #'ruby-smie--backward-token) (setq-local indent-line-function 'ruby-indent-line)) - (setq-local require-final-newline t) (setq-local comment-start "# ") (setq-local comment-end "") (setq-local comment-column ruby-comment-column) From b16a9348e471253f67ad4520f013184404c008a1 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 5 Jul 2014 15:11:59 -0400 Subject: [PATCH 17/25] * lisp/emacs-lisp/edebug.el (edebug-eval-defun): Print result using proper Lisp quoting. Fixes: debbugs:17934 --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/edebug.el | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b34f9cf1fef..388adea5627 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2014-07-05 Stefan Monnier + * emacs-lisp/edebug.el (edebug-eval-defun): Print result using + proper Lisp quoting (bug#17934). + * progmodes/ruby-mode.el (ruby-mode-variables): Don't meddle with require-final-newline since prog-mode already took care of it (bug#17947). diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index e2d38ffe858..892fa7f2d37 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -497,7 +497,7 @@ the minibuffer." (setq edebug-result (eval (eval-sexp-add-defvars form) lexical-binding)) (if (not edebugging) (prog1 - (princ edebug-result) + (prin1 edebug-result) (let ((str (eval-expression-print-format edebug-result))) (if str (princ str)))) edebug-result))) From 41cd2704e2972a1aac00aa5d538d2f66c5f6f664 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Sun, 6 Jul 2014 22:28:38 +0200 Subject: [PATCH 18/25] * calendar/todo-mode.el: Fix wrong-type-argument error when marking multiple consecutive items. (todo-toggle-mark-item): Don't try to mark the empty lines at the end of the todo and done items sections. Note in doc string that items marked by passing a numeric prefix argument can include the last todo and first done items. (todo-mark-category): Don't try to mark the empty line between the todo and done items sections. --- lisp/ChangeLog | 11 +++++++ lisp/calendar/todo-mode.el | 60 +++++++++++++++++++++++--------------- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 388adea5627..d97faa780c2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2014-07-06 Stephen Berman + + * calendar/todo-mode.el: Fix wrong-type-argument error when + marking multiple consecutive items. + (todo-toggle-mark-item): Don't try to mark the empty lines at the + end of the todo and done items sections. Note in doc string that + items marked by passing a numeric prefix argument can include the + last todo and first done items. + (todo-mark-category): Don't try to mark the empty line between the + todo and done items sections. + 2014-07-05 Stefan Monnier * emacs-lisp/edebug.el (edebug-eval-defun): Print result using diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index a1da75c20e8..d8bca81ed9b 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -1710,31 +1710,40 @@ means prompt user and omit comment only on confirmation." (defun todo-toggle-mark-item (&optional n) "Mark item with `todo-item-mark' if unmarked, otherwise unmark it. -With a positive numerical prefix argument N, change the -marking of the next N items." +With positive numerical prefix argument N, change the marking of +the next N items in the current category. If both the todo and +done items sections are visible, the sequence of N items can +consist of the the last todo items and the first done items." (interactive "p") (when (todo-item-string) (unless (> n 1) (setq n 1)) - (dotimes (i n) - (let* ((cat (todo-current-category)) - (marks (assoc cat todo-categories-with-marks)) - (ov (progn - (unless (looking-at todo-item-start) - (todo-item-start)) - (todo-get-overlay 'prefix))) - (pref (overlay-get ov 'before-string))) - (if (todo-marked-item-p) - (progn - (overlay-put ov 'before-string (substring pref 1)) - (if (= (cdr marks) 1) ; Deleted last mark in this category. - (setq todo-categories-with-marks - (assq-delete-all cat todo-categories-with-marks)) - (setcdr marks (1- (cdr marks))))) - (overlay-put ov 'before-string (concat todo-item-mark pref)) - (if marks - (setcdr marks (1+ (cdr marks))) - (push (cons cat 1) todo-categories-with-marks)))) - (todo-forward-item)))) + (catch 'end + (dotimes (i n) + (let* ((cat (todo-current-category)) + (marks (assoc cat todo-categories-with-marks)) + (ov (progn + (unless (looking-at todo-item-start) + (todo-item-start)) + (todo-get-overlay 'prefix))) + (pref (overlay-get ov 'before-string))) + (if (todo-marked-item-p) + (progn + (overlay-put ov 'before-string (substring pref 1)) + (if (= (cdr marks) 1) ; Deleted last mark in this category. + (setq todo-categories-with-marks + (assq-delete-all cat todo-categories-with-marks)) + (setcdr marks (1- (cdr marks))))) + (overlay-put ov 'before-string (concat todo-item-mark pref)) + (if marks + (setcdr marks (1+ (cdr marks))) + (push (cons cat 1) todo-categories-with-marks)))) + (todo-forward-item) + ;; Don't try to mark the empty lines at the end of the todo + ;; and done items sections. + (when (looking-at "^$") + (if (eobp) + (throw 'end nil) + (todo-forward-item))))))) (defun todo-mark-category () "Mark all visible items in this category with `todo-item-mark'." @@ -1751,7 +1760,12 @@ marking of the next N items." (if marks (setcdr marks (1+ (cdr marks))) (push (cons cat 1) todo-categories-with-marks)))) - (todo-forward-item))))) + (todo-forward-item) + ;; Don't try to mark the empty line between the todo and done + ;; items sections. + (when (looking-at "^$") + (unless (eobp) + (todo-forward-item))))))) (defun todo-unmark-category () "Remove `todo-item-mark' from all visible items in this category." From 50802fa8e234ba241036c7fded8a57c6088722ea Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 6 Jul 2014 16:58:52 -0700 Subject: [PATCH 19/25] * cua-rect.el (cua--activate-rectangle): Avoid setting cua--rectangle to nil. Fixes: debbugs:17877 --- lisp/ChangeLog | 5 +++++ lisp/emulation/cua-rect.el | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d97faa780c2..bfa5c5cd24b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-06 Glenn Morris + + * emulation/cua-rect.el (cua--activate-rectangle): + Avoid setting cua--rectangle to nil. (Bug#17877) + 2014-07-06 Stephen Berman * calendar/todo-mode.el: Fix wrong-type-argument error when diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el index d516bd4c7cc..31dd137a6b9 100644 --- a/lisp/emulation/cua-rect.el +++ b/lisp/emulation/cua-rect.el @@ -726,11 +726,11 @@ If command is repeated at same position, delete the rectangle." ;; Set cua--rectangle to indicate we're marking a rectangle. ;; Be careful if we are already marking a rectangle. (setq cua--rectangle - (if (and cua--last-rectangle + (or (and cua--last-rectangle (eq (car cua--last-rectangle) (current-buffer)) - (eq (car (cdr cua--last-rectangle)) (point))) - (cdr (cdr cua--last-rectangle)) - (cua--rectangle-get-corners)) + (eq (car (cdr cua--last-rectangle)) (point)) + (cdr (cdr cua--last-rectangle))) + (cua--rectangle-get-corners)) cua--status-string (if (cua--rectangle-virtual-edges) " [R]" "") cua--last-rectangle nil) (activate-mark)) From b08e34f03ac827e43310fe8aaa0c25bc7f12a034 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 8 Jul 2014 11:55:00 +0300 Subject: [PATCH 20/25] * lisp/facemenu.el (list-colors-print): In help-echo format use %.2f instead of %d because now HSV values are floating-point components between 0.0 and 1.0. --- lisp/ChangeLog | 6 ++++++ lisp/facemenu.el | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bfa5c5cd24b..4803ca0f1e1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-07-08 Juri Linkov + + * facemenu.el (list-colors-print): In help-echo format use %.2f + instead of %d because now HSV values are floating-point components + between 0.0 and 1.0. + 2014-07-06 Glenn Morris * emulation/cua-rect.el (cua--activate-rectangle): diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 24613ecd236..678aca24c12 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -620,7 +620,7 @@ color. The function should accept a single argument, the color name." 'help-echo (let ((hsv (apply 'color-rgb-to-hsv (color-name-to-rgb (car color))))) - (format "H:%d S:%d V:%d" + (format "H:%.2f S:%.2f V:%.2f" (nth 0 hsv) (nth 1 hsv) (nth 2 hsv))))) (when callback (make-text-button From 6dc311adc3908257011bd9d21426a5d4d92616eb Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 8 Jul 2014 12:03:23 +0300 Subject: [PATCH 21/25] * lisp/faces.el (face-name): Return input arg `face' as is when it's not a symbol. (x-resolve-font-name): Don't check if the face is a symbol. Fixes: debbugs:17956 --- lisp/ChangeLog | 7 +++++++ lisp/faces.el | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4803ca0f1e1..d346ac65def 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2014-07-08 Juri Linkov + + * faces.el (face-name): Return input arg `face' as is + when it's not a symbol. + (x-resolve-font-name): Don't check if the face is a symbol. + (Bug#17956) + 2014-07-08 Juri Linkov * facemenu.el (list-colors-print): In help-echo format use %.2f diff --git a/lisp/faces.el b/lisp/faces.el index 7caba9a96c2..d0e768c834e 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -359,7 +359,10 @@ If `inhibit-x-resources' is non-nil, this function does nothing." (defun face-name (face) "Return the name of face FACE." - (symbol-name (check-face face))) + (check-face face) + (if (symbolp face) + (symbol-name face) + face)) (defun face-all-attributes (face &optional frame) @@ -2731,8 +2734,8 @@ If PATTERN is nil, return the name of the frame's base font, which never contains wildcards. Given optional arguments FACE and FRAME, return a font which is also the same size as FACE on FRAME, or fail." - (or (symbolp face) - (setq face (face-name face))) + (when face + (setq face (face-name face))) (and (eq frame t) (setq frame nil)) (if pattern From 7acd41f38f21b03dd73256e7ef5a7db2c733df00 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 8 Jul 2014 12:17:09 +0300 Subject: [PATCH 22/25] * lisp/startup.el (command-line): Append displaying the warning about the errors in the init file to the end of `after-init-hook'. Fixes: debbugs:17927 --- lisp/ChangeLog | 6 ++++++ lisp/startup.el | 25 ++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d346ac65def..13cb52acc1c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-07-08 Juri Linkov + + * startup.el (command-line): Append displaying the warning about + the errors in the init file to the end of `after-init-hook'. + (Bug#17927) + 2014-07-08 Juri Linkov * faces.el (face-name): Return input arg `face' as is diff --git a/lisp/startup.el b/lisp/startup.el index 2f1d9af1cf1..a229207a2c8 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1183,18 +1183,25 @@ please check its value") (funcall inner) (setq init-file-had-error nil)) (error - (display-warning - 'initialization - (format "An error occurred while loading `%s':\n\n%s%s%s\n\n\ + ;; Postpone displaying the warning until all hooks + ;; in `after-init-hook' like `desktop-read' will finalize + ;; possible changes in the window configuration. + (add-hook + 'after-init-hook + (lambda () + (display-warning + 'initialization + (format "An error occurred while loading `%s':\n\n%s%s%s\n\n\ To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the `--debug-init' option to view a complete error backtrace." - user-init-file - (get (car error) 'error-message) - (if (cdr error) ": " "") - (mapconcat (lambda (s) (prin1-to-string s t)) - (cdr error) ", ")) - :warning) + user-init-file + (get (car error) 'error-message) + (if (cdr error) ": " "") + (mapconcat (lambda (s) (prin1-to-string s t)) + (cdr error) ", ")) + :warning)) + t) (setq init-file-had-error t)))) (if (and deactivate-mark transient-mark-mode) From 9aac592d887c360c9cae88db350ec69019ded573 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 8 Jul 2014 18:12:39 +0300 Subject: [PATCH 23/25] Fix bug #17969 with vertical-motion through continuation lines with TABs. src/xdisp.c (move_it_to): Adjust calculation of line_start_x to what x_produce_glyphs does when it generates a stretch glyph that represents a TAB. --- src/ChangeLog | 6 ++++++ src/xdisp.c | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 89621bd54ec..d2f1999b546 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-07-08 Eli Zaretskii + + * xdisp.c (move_it_to): Adjust calculation of line_start_x to what + x_produce_glyphs does when it generates a stretch glyph that + represents a TAB. (Bug#17969) + 2014-07-05 Eli Zaretskii * xdisp.c (pos_visible_p): If CHARPOS is at beginning of window, diff --git a/src/xdisp.c b/src/xdisp.c index 28752a42cb9..61d1fa24c68 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9250,6 +9250,25 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos { line_start_x = it->current_x + it->pixel_width - it->last_visible_x; + if (FRAME_WINDOW_P (it->f)) + { + struct face *face = FACE_FROM_ID (it->f, it->face_id); + struct font *face_font = face->font; + + /* When display_line produces a continued line + that ends in a TAB, it skips a tab stop that + is closer than the font's space character + width (see x_produce_glyphs where it produces + the stretch glyph which represents a TAB). + We need to reproduce the same logic here. */ + eassert (face_font); + if (face_font) + { + if (line_start_x < face_font->space_width) + line_start_x + += it->tab_width * face_font->space_width; + } + } set_iterator_to_next (it, 0); } } From c838708452e293d8d55f1476f599eff28b94f255 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 8 Jul 2014 14:24:39 -0400 Subject: [PATCH 24/25] * doc/lispref/debugging.texi (Function Debugging, Debugger Commands): Update debug-on-entry w.r.t behavior after redefinitions. Fixes: debbugs:17902 --- doc/lispref/ChangeLog | 5 +++++ doc/lispref/debugging.texi | 19 ++----------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 2464eda28cb..a3353c66f71 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2014-07-08 Stefan Monnier + + * debugging.texi (Function Debugging, Debugger Commands): + Update debug-on-entry w.r.t behavior after redefinitions (bug#17902). + 2014-06-29 Glenn Morris * help.texi (Help Functions): "Online" help doesn't mean what it diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index a9d0c1c4ed0..66f12a022cb 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -226,9 +226,7 @@ function, and then step through its caller. @deffn Command debug-on-entry function-name This function requests @var{function-name} to invoke the debugger each -time it is called. It works by inserting the form -@code{(implement-debug-on-entry)} into the function definition as the -first form. +time it is called. Any function or macro defined as Lisp code may be set to break on entry, regardless of whether it is interpreted code or compiled code. @@ -244,11 +242,6 @@ When @code{debug-on-entry} is called interactively, it prompts for up to invoke the debugger on entry, @code{debug-on-entry} does nothing. @code{debug-on-entry} always returns @var{function-name}. -@strong{Warning:} if you redefine a function after using -@code{debug-on-entry} on it, the code to enter the debugger is -discarded by the redefinition. In effect, redefining the function -cancels the break-on-entry feature for that function. - Here's an example to illustrate use of this function: @example @@ -277,12 +270,6 @@ Debugger entered--entering a function: ------ Buffer: *Backtrace* ------ @end group -@group -(symbol-function 'fact) - @result{} (lambda (n) - (debug (quote debug)) - (if (zerop n) 1 (* n (fact (1- n))))) -@end group @end example @end deffn @@ -461,9 +448,7 @@ You can't use @kbd{r} when the debugger was entered due to an error. @item l Display a list of functions that will invoke the debugger when called. This is a list of functions that are set to break on entry by means of -@code{debug-on-entry}. @strong{Warning:} if you redefine such a -function and thus cancel the effect of @code{debug-on-entry}, it may -erroneously show up in this list. +@code{debug-on-entry}. @item v Toggle the display of local variables of the current stack frame. From d8899d09b992d733dc1cc6ec93b11cb75ce84f5d Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 8 Jul 2014 14:38:07 -0400 Subject: [PATCH 25/25] * lisp/progmodes/sh-script.el (sh-smie-sh-rules): Don't align with a && in the middle of a line. Fixes: debbugs:17896 --- lisp/ChangeLog | 5 +++++ lisp/progmodes/sh-script.el | 7 ++++--- test/indent/shell.sh | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 13cb52acc1c..0333e366beb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-08 Stefan Monnier + + * progmodes/sh-script.el (sh-smie-sh-rules): Don't align with a && in + the middle of a line (bug#17896). + 2014-07-08 Juri Linkov * startup.el (command-line): Append displaying the warning about diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 1601b6c81ae..724d22ab69b 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1989,9 +1989,10 @@ May return nil if the line should not be treated as continued." (<= indent initial))))) `(column . ,(+ initial sh-indentation))) (`(:before . ,(or `"(" `"{" `"[")) - (when (smie-rule-hanging-p) - (if (not (smie-rule-prev-p "&&" "||" "|")) - (smie-rule-parent) + (if (not (smie-rule-prev-p "&&" "||" "|")) + (when (smie-rule-hanging-p) + (smie-rule-parent)) + (unless (smie-rule-bolp) (smie-backward-sexp 'halfexp) `(column . ,(smie-indent-virtual))))) ;; FIXME: Maybe this handling of ;; should be made into diff --git a/test/indent/shell.sh b/test/indent/shell.sh index 4a30739e2d9..e3619057d6e 100755 --- a/test/indent/shell.sh +++ b/test/indent/shell.sh @@ -41,6 +41,12 @@ for foo in bar; do # bug#17721 } done +for foo in bar; do # bug#17896 + [ -e $foo ] && [ -e $bar ] && { + echo just fine thanks + } +done + filter_3 () # bug#17842 { tr -d '"`' | tr ' ' ' ' | \