Alan Mackenzie [Thu, 25 Aug 2016 16:21:55 +0000 (16:21 +0000)]
Fix an infinite loop in C++ Mode when we have "{ .... [ .... }"
* lisp/progmodes/cc-fonts.el (c-font-lock-c++-lambda-captures): In the inner
`while' form's condition, check for "\\s)" rather than merely "\\]", so that
the loop won't hang at a "terminating" paren of a different type (due to the
c-syntactic-re-search-forward at the end of the loop stopping at such
characters).
Tino Calancha [Thu, 25 Aug 2016 13:17:56 +0000 (22:17 +0900)]
call-shell-region: New defun
Suggested by Stefan Monnier in Bug#22679.
* lisp/subr.el (call-shell-region): New defun; execute a command
in an inferior shell with the buffer region as input.
* lisp/simple.el (shell-command-on-region): Use it.
* lisp/gnus/message.el (message-do-fcc): Idem.
* doc/lispref/processes.texi: Document call-shell-region in the manual.
;* etc/NEWS: Add entry for this new function.
Martin Rudalics [Thu, 25 Aug 2016 08:53:27 +0000 (10:53 +0200)]
Some fixes around `delete-other-frames' and `next-frame'
* src/frame.c (Fdelete_frame): Clarify doc-string.
* lisp/frame.el (delete-other-frames): Delete other frames on
FRAME's terminal instead of the current terminal. Delete
non-minibuffer-only surrogate frames too. See
http://lists.gnu.org/archive/html/emacs-devel/2016-08/msg00467.html
* doc/lispref/frames.texi (Deleting Frames): Minor fixes for
docs of `delete-frame' and `frame-live-p'. Add entry for
`delete-other-frames'.
(Finding All Frames): Fix doc of `next-frame'.
Alan Third [Thu, 18 Aug 2016 18:55:52 +0000 (19:55 +0100)]
Fix macOS 12 deprecation notices
* src/nsterm.h: Add #defines to allow older versions of macOS to use the
new constant names.
* src/nsmenu.m: Replace old constant names with
new.
(fillWithWidgetValue): Remove calls to deprecated
setMenuChangedMessagesEnabled.
* src/nsterm.m: Replace old constant names with new.
* src/nsfns.m: Replace old constant names with new.
Noah Friedman [Wed, 24 Aug 2016 00:13:31 +0000 (17:13 -0700)]
* src/xfns.c (Fx_change_window_property): Modify previous change.
Instead of forcing format to 8 for strings, check that the length of
the string is appropriate for whatever format given.
(Fx_window_property_attributes): If prop isn't found on frame's inner window,
try its outer window. This mimics the behavior of Fx_window_property.
Paul Eggert [Mon, 22 Aug 2016 21:38:49 +0000 (14:38 -0700)]
Merge from origin/emacs-25
8c2946e In NEWS describe new handling of window margins (Bug#24193) 0cee66c Facultatively ignore margins when splitting and resizing wind... 8d68147 Document CATEGORY arg to modify-category-entry 8342e74 Document char-script-table's effect on word motion e9ff485 Further fix for 'url-http-create-request' and multibyte strings 0695235 Fix docstring of eval-expression 98b01dd Clarify when 'cursor' property is in effect 75f1882 Convert the remaining strings to unibyte before concatenating d2db5dd Fix bug with handling the bidi cache ccd0e92 * doc/lispref/text.texi (Change Hooks): Minor copyedits. f785ff4 Clarify documentation of before/after-change-functions 3c9cb57 Document use of vectors in keymaps
Eli Zaretskii [Mon, 22 Aug 2016 17:19:35 +0000 (20:19 +0300)]
Display mini-window resized even when there are several frames
* src/xdisp.c (x_consider_frame_title): Bind inhibit-redisplay to
t to avoid resizing back the mini-window as result of considering
the title of other frames. (Bug#24285)
(redisplay_window): No need to bind inhibit-redisplay here.
Noah Friedman [Sun, 21 Aug 2016 21:03:46 +0000 (14:03 -0700)]
Fix interpretation of signed vs unsigned values when retrieving X
Window properties, and make sure the full value is returned when not
parsed.
New subr to export type and format information about X Window
properties to lisp.
* src/xselect.c (selection_data_to_lisp_data): Treat any data as
unsigned unless its actual type is INTEGER.
CARDINALs, in particular, are unsigned.
* src/xfns.c (Fx_change_window_property): If value is a string, ignore
any provided format and force to 8.
(x_window_property_intern): If returning value as a string, the length
is actual_size times the actual format of each element, which is not
necessarily bytes.
(Fx_window_property_attributes): New subr.
(syms_of_xfns): Declare it.
Alan Mackenzie [Sun, 21 Aug 2016 16:00:15 +0000 (16:00 +0000)]
Adapt CC Mode for C++11 uniform initialization.
For fontification, introduce a new "context", 'non-decl, to be used for
brace
lists; also a new value for the property 'c-type, called 'c-not-decl.
* lisp/progmodes/cc-engine.el (c-back-over-compound-identifier): Check that
an ostensible symbol we're going to move over isn't a keyword.
(c-forward-decl-or-cast-1): CASE 1: Where we have two consecutive identifiers
(hence a declaration), and an unmatched open paren, perform
c-fdoc-shift-type-backwards to recognize the partial construct correctly.
Whilst checking a type decl expression, check for and handle C++11's "copy
initialization", where we have <type>(<constant>). Recognize
<id><id>(... (where the paren is unclosed) as a declaration.
(c-looking-at-or-maybe-in-bracelist): New function, extracted from
c-inside-bracelist-p. Recognize as bracelists "{"s which are preceded by
valid tokens other than "=". Recognize a bracelist when preceded by a
template declaration.
(c-inside-bracelist-p): Call c-looking-at-or-maybe-in-bracelist in place of
much inline code.
(c-looking-at-inexpr-block): Amend so that it won't wrongly recognise an
initialization starting "({" as an in-expression block, by checking for
semicolons, as opposed to commas, separating elements inside it.
(c-guess-continued-construct): (CASE B-2): Recognize a brace-list-open by
calling c-looking-at-or-maybe-in-bracelist rather than checking for a
preceding "=". (CASE B-5): New code to recognize new construct "return {
...}".
(c-guess-basic-syntax): (CASE 5A.3): Additionally recognize a "{" preceded by
"return", or "{" preceded by <type><identifier> as a bracelist.
* lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Recognize brace
lists, giving them `context' 'non-decl. Pass over elements of one by regexp
search for "," rather than calling c-forward-decl-or-cast-1.
* lisp/progmodes/cc-langs.el (c-return-kwds, c-return-key): New lang
constants/variables to recognize "return".
(c-pre-id-bracelist-key): New lang constant/variable to recognize tokens
which, when preceding an identifier followed by a brace, signify the brace as
a bracelist.
* lisp/progmodes/cc-mode.el (c-fl-decl-start): When searching outwards for
the start of a "local" declaration, move out from an enclosing brace when
that is the start of a brace list.
Paul Eggert [Sun, 21 Aug 2016 11:25:24 +0000 (04:25 -0700)]
Update from gnulib
This incorporates:
2016-08-17 maint: preprocessor changes to support z/OS
2016-08-17 string: rename to avoid '__string'
* doc/misc/texinfo.tex, lib/alloca.in.h, lib/string.in.h:
Copy from gnulib.
Paul Eggert [Sun, 21 Aug 2016 11:02:06 +0000 (04:02 -0700)]
Minor text-quoting-style fixes
* src/charset.c (check_iso_charset_parameter):
* src/frame.c (store_frame_param):
* src/xselect.c (x_fill_property_data):
Use grave accent for left single quote in ‘error’ format strings.
Martin Rudalics [Sun, 21 Aug 2016 09:36:11 +0000 (11:36 +0200)]
Fix semantics of 'minibuffer' frame parameter
The 'minibuffer' frame parameter is now t for a normal frame
(a frame with a root window plus a minibuffer window) and the
frame's minibuffer window for a minibuffer-less frame (a frame
whose minibuffer window is on another frame). See also:
https://lists.gnu.org/archive/html/emacs-devel/2016-07/msg01259.html
* src/frame.c (make_frame, make_frame_without_minibuffer)
(make_minibuffer_frame): When assigning the frame's minibuffer
window also store corresponding 'minibuffer' frame parameter.
(store_frame_param): Move the 'minibuffer' parameter checks to
the beginning so we can silently override the value before it
gets stored in the parameter alist. Fix error handling.
(Fframe_parameters): Return value of 'minibuffer' parameter
unmodified.
* lisp/frameset.el (frameset-filter-minibuffer): When the cdr of
the parameter is a minibuffer window, save (minibuffer . nil)
instead of (minibuffer . t).
(frameset--reuse-frame): To find a non-minibuffer-only frame
look out for a frame whose 'minibuffer' parameter is t instead
of that frame's minibuffer window.
(frameset-minibufferless-first-p): To find a minibuffer-less
frame look out for a frame whose 'minibuffer' parameter is a
window instead of nil.
Philipp Stephani [Fri, 19 Aug 2016 19:23:24 +0000 (21:23 +0200)]
Some assorted documentation clarifications
* src/fileio.c (Fwrite_region): Clarify that END is ignored if
START is nil.
* src/editfns.c (Fbuffer_size): Add short discussion about
narrowing.
* src/callproc.c (Fcall_process_region): Discuss behavior when
START and END are not buffer positions.
Alan Mackenzie [Sat, 20 Aug 2016 14:12:06 +0000 (14:12 +0000)]
In c-\(go-\)?-\(up-\|down-\)?list-\(forward\|backward\) check limit isn't nil
Check the limit both at macro expansion time (for a hard coded nil) and at run
time in the generated code. Tidy up these macros generally.
* lisp/progmodes/cc-defs.el (c-safe-scan-lists): Check `limit' is present and
not identically nil before generating a narrow-to-region call. Generate code
to check `limit' is not nil at run time.
(c-go-list-forward, c-go-list-backward): Remove the generation of redundant
narrow-to-region, instead calling c-safe-scan-lists directly.
(c-go-up-list-forward, c-go-up-list-backward, c-go-down-list-forward)
(c-go-down-list-backward): Invoke the corresponding macros without the "go-"
to determine the destination position instead of generating a redundant
narrow-to-region.
The docstring referenced a non-existant parameter, as well as a
parameter that has been renamed since the docstring was written. Fix
both errors, fixing (Bug#24182).
Alan Mackenzie [Fri, 19 Aug 2016 16:03:05 +0000 (16:03 +0000)]
Amend hack-local-variables-prop-line not always to return any mode on line 1.
This fixes bug #24266.
* lisp/files.el (hack-local-variables-prop-line): Change the name of the
parameter mode-only to handle-mode. Change its meaning, such that it being
set to a value non-nil and not t removes any mode parameter from the result
list. Leave its values nil and t with the same meanings they had.
(hack-local-variables): Call hack-local-variables-prop-line appropriately.
Tino Calancha [Fri, 19 Aug 2016 08:04:42 +0000 (17:04 +0900)]
Add tests for Bug#24264
* test/lisp/emacs-lisp/cl-seq-tests.el (cl-seq-test-bug24264):
Add test for Bug#24264.
(cl-seq-fill-test, cl-seq-replace-test)
(cl-seq-remove-test ,cl-seq-delete-test)
(cl-seq-remove-duplicates-test, cl-seq-substitute-test)
(cl-seq-nsubstitute-test, cl-seq-position-test)
(cl-seq-count-test, cl-seq-mismatch-test)
(cl-seq-search-test, cl-seq-test-bug24264):
Add tests for all functions in the file; test all keywords.
Johan Bockgård [Thu, 18 Aug 2016 19:25:11 +0000 (21:25 +0200)]
Fix bug in --eval reply message from server
* lisp/server.el (server-reply-print): Fix check for truncated quote
sequence at end of message. Problem reported in:
http://lists.gnu.org/archive/html/emacs-devel/2016-08/msg00101.html
Eli Zaretskii [Thu, 18 Aug 2016 14:23:22 +0000 (17:23 +0300)]
Improve commentary in src/character.h
* src/character.h (BYTES_BY_CHAR_HEAD, MULTIBYTE_LENGTH)
(MULTIBYTE_LENGTH_NO_CHECK, STRING_CHAR_AND_LENGTH): Remove stale
info from commentary and improve it.
Andreas Politz [Thu, 18 Aug 2016 08:27:05 +0000 (10:27 +0200)]
Don't let window start override window point in `window-state-put' (Bug#24240)
* lisp/window.el (window--state-put-2): Set 'noforce argument
when restoring a window's start position. This avoids that the
effect of `set-window-point' gets overidden by that of
`set-window-start' (Bug#24240).
Alan Mackenzie [Wed, 17 Aug 2016 19:37:19 +0000 (19:37 +0000)]
Fontify constructs following "::" in C++ argument lists correctly - part 2.
This fixes bug #24246.
* lisp/progmodes/cc-engine.el (c-find-decl-prefix-search): Put a
`save-match-data' around the new `looking-at' introduced by the previous CC
Mode patch this evening.
Alan Mackenzie [Wed, 17 Aug 2016 18:06:24 +0000 (18:06 +0000)]
Fontify constructs following "::" in C++ argument lists correctly.
This fixes bug #24246.
* lisp/progmodes/cc-engine.el (c-find-decl-prefix-search): In the "pseudo
match" loop, test a found string for a match with c-opt-identifier-concat-key
(e.g. with "::").
K. Handa [Wed, 17 Aug 2016 14:37:17 +0000 (23:37 +0900)]
Fix hz encoding and decoding (bug#23814)
* lisp/language/china-util.el (decode-hz-region): Pay
attention to "~~}" sequence at the end of Chinese character
range.
(hz-category-table): New variable.
(encode-hz-region): Convert non-encodable characters to
\u... and \U... Preserve ESC on ecoding. Put
`chinese-gb2312' `charset' text property in advance to force
iso-2022-encoding to select chinese-gb2312 designation.
Tino Calancha [Tue, 16 Aug 2016 09:18:44 +0000 (18:18 +0900)]
Allow not erase output buffer in shell commands
* lisp/simple.el (shell-command-not-erase-buffer): New option to allow
not erasing the output buffer between shell commands. Defaults to nil.
(shell-command-on-region): Use it.
(shell-command--save-pos-or-erase): New defun; store a buffer position
if 'shell-command-not-erase-buffer' is non-nil; otherwise
erase the output buffer of the shell command.
(shell-command, shell-command-on-region): Use it.
(shell-command--set-point-after-cmd): New defun;
if 'shell-command-not-erase-buffer' is non-nil, set point
in the output buffer to the position in 'shell-command-saved-pos'.
(shell-command-sentinel, shell-command-on-region): Use it.
* doc/emacs/misc.texi (shell-command-not-erase-buffer):
Document this feature in the manual.
; * etc/NEWS: Add entry for this new feature.
See discussion on:
http://lists.gnu.org/archive/html/emacs-devel/2016-07/msg00610.html
Martin Rudalics [Tue, 16 Aug 2016 07:19:18 +0000 (09:19 +0200)]
Facultatively ignore margins when splitting and resizing windows (Bug#24193)
Provide a new window parameter 'min-margins' which allows to
ignore the actual widths of a window's margins when splitting or
resizing that window horizontally. This should serve as a
workaround for handling the problems raised by Bug#24193.
* lisp/window.el (window--min-size-1): Handle new window
parameter 'min-margins'.
(split-window): Fix text of error messages.
* doc/lispref/windows.texi (Window Parameters): Describe new
parameter 'min-margins'.
Alan Mackenzie [Mon, 15 Aug 2016 16:22:36 +0000 (16:22 +0000)]
Fix minor bug in c-syntactic-re-search-forward.
Bug was: when NOERROR is neither nil nor t, BOUND is non-nil, PAREN-LEVEL is
non-nil, and the first internal search attempt fails, point wrongly ends up at
BOUND, rather than just before the next closing paren.
* lisp/progmodes/cc-engine.el (c-syntactic-re-search-forward): Guard against
the above situation.
Alan Mackenzie [Mon, 15 Aug 2016 11:52:32 +0000 (11:52 +0000)]
Handle C++11 lambda functions.
* lisp/progmodes/cc-engine.el (c-looking-at-inexpr-block): Enhance also to
handle C++ lambda functions.
(c-looking-at-c++-lambda-capture-list): New function.
* lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Recognize the
parameter list of a lambda function and set `context' and
`c-restricted-<>-arglists' suitably for it.
(c-font-lock-c++-lambda-captures): New function.
(c-complex-decl-matchers): Insert c-font-lock-c++-lambda-captures into it.
* lisp/progmodes/cc-langs.el (c-pre-lambda-tokens, c-pre-lambda-tokens-re):
New language constants/variables.
(c-paren-nontype-kwds): Include "noexcept" in the C++ value.
* lisp/progmodes/cc-mode.el (c-fl-decl-start): Handle being in a C++ lambda
function capture list.
Michael Albinus [Sun, 14 Aug 2016 11:31:07 +0000 (13:31 +0200)]
Improve handling of defcustoms in tramp
* doc/misc/tramp.texi: Protect all multi-line examples by
@group ... @end group. Use proper `custom-set-variables'
examples. Use consequently @option for user options. Remove
superfluous @cindex and @vindex entries.
(Top): Remove reference to outdated mail archives.
(Configuration): Tune references.
(Default Method): Make `tramp-default-method' and
`tramp-default-method-alist' a @defopt.
(Default User): Make `tramp-default-user' and
`tramp-default-user-alist' a @defopt.
(Default Host): Make `tramp-default-host' and
`tramp-default-host-alist' a @defopt.
Paul Eggert [Sun, 14 Aug 2016 04:30:55 +0000 (23:30 -0500)]
Minor text-quoting-style fixes
* lisp/cus-edit.el (custom-buffer-create-internal):
* lisp/recentf.el (recentf-edit-list):
Follow text-quoting-style preference when quoting in UI strings.
* src/doc.c (Fsubstitute_command_keys): Don’t say that curved
quotes are substituted for, as this is no longer true.
Paul Eggert [Sun, 14 Aug 2016 04:26:00 +0000 (23:26 -0500)]
Fix substitute-command-keys unibyte, alloc bugs
* src/doc.c (Fsubstitute_command_keys): Fix some problems with
unibyte strings and with buffer allocation. Make strings
multibyte, to avoid problems with unibyte strings that are not
valid UTF-8 (Bug#24206). Redo buffer allocation so that it is
O(N), not O(N**2). Avoid going past the end of the input string
when given invalid input. Avoid some unlikely problems in
accessing the wrong storage after a GC.
Joakim Jalap [Sat, 13 Aug 2016 09:26:27 +0000 (12:26 +0300)]
Fix "C-u" when an input method is active
* lisp/international/quail.el (quail-input-method): Defer to the
input method iff 'overriding-terminal-local-map' is
'universal-argument-map' and the given key has no binding there.
(Bug#22958)
Noam Postavsky [Fri, 12 Aug 2016 23:29:16 +0000 (19:29 -0400)]
Fix docstring of eval-expression
* lisp/simple.el (eval-expression): Fix the docstring to reflect the
fact that the prefix argument does not affect formatting for
integers (Bug #20691).
Paul Eggert [Thu, 11 Aug 2016 18:24:54 +0000 (11:24 -0700)]
Fix process leak with make-network-process
This problem was introduced by the recent async changes (Bug#23808).
* src/process.c (Fmake_process): Move USE_SAFE_ALLOCA later,
so that it follows the start_process_unwind unwind-protect.
Set pid to -1 while the process is being created.
(start_process_unwind): Omit unnecessary emacs_abort test.
(connect_network_socket): Simplify use of counts. Unwind
bind_polling_period a bit earlier, so that a remove_process
unwind-protect can be added when needed; this is the heart of
the fix. Undo the unwind-protect just before returning.
Eli Zaretskii [Thu, 11 Aug 2016 15:11:26 +0000 (18:11 +0300)]
Fix bug with handling the bidi cache
* src/xdisp.c (redisplay_window): Save and restore the state of
the bidi cache before reusing the iterator after calls to
try_window and try_window_reusing_current_matrix.
Eli Zaretskii [Thu, 11 Aug 2016 15:04:42 +0000 (18:04 +0300)]
Avoid annoying re-scroll when buffer has many overlay strings
* src/xdisp.c (redisplay_window): Add better recovery from a
situation where window-start is on buffer position which has a
before-string that includes newlines, with the result that point
is not visible in the window, because the display engine starts
displaying with the before-string. (Bug#24179)
Tino Calancha [Wed, 10 Aug 2016 14:23:18 +0000 (23:23 +0900)]
cl-delete-duplicates: Parse :if to have cl-if bound
* lisp/emacs-lisp/cl-seq.el (cl--delete-duplicates):
We need also to parse keyword :if, otherwise cl-if
is unbound.
This reverts commit: 68fdbeb917b80e29e0b15506f18f7ed41d8ffdfd
Vincent Belaïche [Wed, 10 Aug 2016 08:13:27 +0000 (10:13 +0200)]
Handle nil cell value in compiled printer functions.
* doc/misc/ses.texi (Quick Tutorial): Minor clarification about the
ses-range `!' modifier.
(More on cell printing): Fix this that the fallback printer is
`ses-prin1', not "%S". That makes a difference for any cell value for
which "%S" would insert a backslash characters.
* lisp/ses.el (ses-local-printer-compile): Handle the nil cell value
--- contrary to emacs-25 branches ses-call-printer does not handle
prior to calling a function printer. Not doing this would still work
because the compiled function would throw and error and SES would in
the end resort to the ses-prin1 fallback, however this way would not
be in line with the raison d'être of compiling printer which is speed.
Mark Oteiza [Wed, 10 Aug 2016 04:15:55 +0000 (00:15 -0400)]
Nudge WoMan toward lexical-binding
* lisp/woman.el (woman-parse-man.conf, woman-manpath-add-locales):
Use cl-pushnew instead of add-to-list.
(woman-justify-list): Rename to woman-justify-styles.
(woman-justify-styles): New array.
(woman-justify, woman-decode-region, woman2-ad, woman2-na): Use it.
(woman-cached-data): Use cl-pushnew instead of add-to-list.
Fix ses-delete-blanks to delete only blanks + documentation.
* doc/misc/ses.texi (Quick Tutorial): Mention the '!'
'ses-range' modifier as an alternative to 'ses+'.
(Advanced Features): Add a refernce to node 'Nonrelocatable
references' concerning function 'ses-rename-cell'.
(Standard formula functions): Mention the '!' 'ses-range'
modifier as an alternative to 'ses-delete-blanks'.
(More on cell printing): Fix fallback printer
definition. Minor editorial formatting changes.
(Nonrelocatable references): Document the use of
'ses-rename-cell' as a better way to make cell reference
non-relocatable.
(The data area): Document the presence of local printer
definitions in the data area.
* lisp/ses.el (ses-delete-blanks): Do not remove
*error*. Any error in an argument should propagate into the
using formula rather than being silently hidden !
Stefan Monnier [Tue, 9 Aug 2016 17:05:03 +0000 (13:05 -0400)]
* lisp/emacs-lisp/cconv.el: Fix λ-lifting in the presence of shadowing
Change the code which detects and circumvents the case where one of the
variables used in λ-lifting is shadowed, so that it also works when the
shadowing comes before the λ-lifted function (bug#24171).
(cconv--remap-llv): New function, extracted from cconv-convert.
(cconv-convert): Use it, but differently for `let' and `let*'.