Tino Calancha [Wed, 7 Dec 2016 12:07:45 +0000 (21:07 +0900)]
ediff-context-diff-label-regexp: Detect the end of second file
* lisp/vc/ediff-ptch.el (ediff-context-diff-label-regexp): Skip
'\n' in file names (Bug#25010).
* test/lisp/vc/ediff-ptch-tests.el: New file.
(ibuffer-test-bug25010): Add test for Bug#25010.
Tino Calancha [Wed, 7 Dec 2016 11:47:34 +0000 (20:47 +0900)]
ibuffer-decompose-filter: Avoid side effects on error
* lisp/ibuf-ext.el (ibuffer-decompose-filter):
Update 'ibuffer-filtering-qualifiers' only if there is no error (Bug#24997).
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug24997):
Update test result as pass.
Tino Calancha [Wed, 7 Dec 2016 11:37:01 +0000 (20:37 +0900)]
ibuffer: compare marks with EQ
* lisp/ibuffer (ibuffer-update-title-and-summary, ibuffer-redisplay-current)
(ibuffer-buffer-name-face, ibuffer-unmark-all)
(ibuffer-count-deletion-lines, ibuffer-buffer-names-with-mark):
Use 'eq' instead of 'char-equal' when comparing mark characters (Bug#25000).
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25000):
Update test result as pass.
Fix Bug#25049.
* lisp/ibuf-ext.el (ibuffer-saved-filters): Remove extra
nesting level; add transparent setter to adjust old-format values;
update doc string.
(ibuffer-save-filters): Remove extra level of nesting
in ibuffer-saved-filters values when saving new filters.
(ibuffer-old-saved-filters-warning): New variable with
clickable message with repair options to be displayed
as a warning if 'ibuffer-repair-saved-filters' detects
a format mismatch.
(ibuffer-repair-saved-filters): Add new command to check and
repair saved filters format.
(ibuffer-included-in-filter-p, ibuffer-decompose-filter):
Change access of saved filter data (cadr->cdr) to account
for reduced nesting.
* test/lisp/ibuffer-tests.el (ibuffer-save-filters):
New test; check that filters are saved in the proper format.
Paul Eggert [Wed, 7 Dec 2016 05:38:32 +0000 (21:38 -0800)]
Simplify FUNCTIONP implementation
* src/bytecode.c (exec_byte_code):
* src/image.c (parse_image_spec):
Prefer FUNCTIONP (x) to !NILP (Ffunctionp (x)).
* src/eval.c (FUNCTIONP): Move here ...
* src/lisp.h: ... from here. No longer inline, as that
bloats the text and does not help speed (at least on my platform).
(functionp): Remove this name, since callers use FUNCTIONP.
Noam Postavsky [Sun, 27 Nov 2016 19:41:02 +0000 (14:41 -0500)]
Give test-completion's PREDICATE the hashtable key
For hashtable entries with symbol keys, `test-completion' would convert
the key to a string before calling PREDICATE, unlike `try-completion'
and `all-completions'.
* src/minibuf.c (Ftest_completion): Pass original key from hashtable.
Noam Postavsky [Sun, 27 Nov 2016 15:04:48 +0000 (10:04 -0500)]
Give test-completion's PREDICATE full alist entry
Since 2016-06-26 "Fix test-completion with completion-regexp-list", when
calling test-completion with an alist collection, the predicate was
recieving the string value instead of the alist entry (Bug#24966).
* src/minibuf.c (Ftest_completion): Don't modify the found element, just
test STRING against `completion-regexp-list'.
* test/src/minibuf-tests.el: New tests for `try-completion',
`all-completions', and `test-completion'.
Noam Postavsky [Mon, 22 Aug 2016 02:58:37 +0000 (22:58 -0400)]
Fix ert-tests when running compiled
* test/lisp/emacs-lisp/ert-tests.el (ert-test-deftest): Don't test for
specific macroexpansion, just check result of evaluation.
(ert-test-record-backtrace): Don't hardcode representation of closure in
expected backtrace, this lets the test succeed even when the test code
is compiled.
* lisp/emacs-lisp/ert.el (ert--expand-should-1): Also pass
`byte-compile-macro-environment' to `macroexpand', this allows the
`should' macro to properly handle macroexpansion of macros that were
defined in the same file when it's being compiled (Bug #17851).
Paul Eggert [Tue, 6 Dec 2016 23:25:54 +0000 (15:25 -0800)]
Change two _Noreturn functions to return void
This is a bit clearer than _Noreturn functions that (do not)
return a non-void type.
* src/callproc.c (call_process) [MSDOS]:
Use 'status' local to record status.
(child_setup): Return CHILD_SETUP_TYPE.
* src/data.c, src/lisp.h (wrong_type_argument): Return void.
All callers changed.
* src/lisp.h (CHILD_SETUP_TYPE): New macro.
Paul Eggert [Tue, 6 Dec 2016 06:40:36 +0000 (22:40 -0800)]
Fix GPG bug introduced by Oct file-missing change
Problem with visiting nonexistent .gpg file
reported by Herbert J Skuhra.
* lisp/epa-file.el (epa-file--find-file-not-found-function):
(epa-file-insert-file-contents, epa-file-write-region):
Signal file-missing or file-error instead of epa-error.
Katsumi Yamaoka [Mon, 5 Dec 2016 23:32:36 +0000 (23:32 +0000)]
Make TAB and M-TAB run widget-forward and widget-backward (bug#25091)
* lisp/gnus/mm-decode (mm-convert-shr-links): Avoid `shr-next-link'
and `shr-previous-link' so TAB and M-TAB run `widget-forward' and
`widget-backward' instead (bug#25091).
Mark Oteiza [Sun, 4 Dec 2016 18:43:03 +0000 (13:43 -0500)]
More image-dired refactoring
* lisp/image-dired.el: Remove TODO comment. This appears to have been
implemented in 5d7433a "image-dired: Signal an error before calling a
missing executable".
(image-dired-cmd-create-standard-thumbnail-command): Use %p specifier.
Add :version.
(image-dired-display-thumbs, image-dired-create-thumbs): Use dolist and
when. Remove superfluous call to image-dired-thumb-name. Move single nil
binding and setq into dolist form.
Glenn Morris [Sun, 4 Dec 2016 01:59:36 +0000 (17:59 -0800)]
Stop flymake using dialog boxes for errors (Bug#16622)
* lisp/progmodes/flymake.el (flymake-gui-warnings-enabled):
Mark as obsolete.
(flymake-display-warning): Turn into an obsolete alias.
(flymake-report-fatal-status): Just use message for a warning that
was formerly displayed by default.
Mark Oteiza [Sat, 3 Dec 2016 21:18:48 +0000 (16:18 -0500)]
Clean up keymap and menu code in image-dired
A function to populate these maps is not necessary, just define the maps
once and for all.
* lisp/image-dired.el (image-dired-show-all-from-dir): Make prompt
clearer and in the spirit of dired's.
(image-dired-define-display-image-mode-keymap):
(image-dired-define-thumbnail-mode-keymap): Remove.
(image-dired-thumbnail-mode-map):
(image-dired-thumbnail-mode-line-up-map):
(image-dired-thumbnail-mode-tag-map): Assimilate all define-key and mode
menu code from the aforementioned removed functions. Reorder so that
the definitions are inherited properly.
(image-dired-display-current-image-sized): Fix erroneous message.
(image-dired-thumbnail-mode):
(image-dired-display-image-mode): Remove defunct call.
Mark Oteiza [Sat, 3 Dec 2016 18:05:39 +0000 (13:05 -0500)]
Clean up uses of cl-foo in image-dired
Both instances here are just emulating cl-find-if.
* lisp/image-dired.el: Use cl-lib at compile time.
(image-dired-dired-toggle-marked-thumbs): Don't need let* at the top.
Replace the cl-foo instances with equivalent cl-loops.
Mark Oteiza [Fri, 2 Dec 2016 21:53:02 +0000 (16:53 -0500)]
Display window before calculating width
* lisp/image-dired.el (image-dired-display-thumbs): Display the buffer
before calling image-dired-line-up and friends, which in turn calculate
the window width. Otherwise, the thumbnail layout will be wrong in
a side-by-side split.
Noam Postavsky [Sat, 21 Nov 2015 22:02:42 +0000 (17:02 -0500)]
Ensure redisplay using variable watcher
This replaces looking up the variable name in redisplay--variables when
setting it.
* lisp/frame.el: Replace redisplay--variables with add-variable-watcher
calls.
* src/xdisp.c (Fset_buffer_redisplay): Rename from maybe_set_redisplay,
set the redisplay flag unconditionally.
(Vredisplay__variables): Remove it.
* src/data.c (set_internal): Remove maybe_set_redisplay call.
Noam Postavsky [Fri, 20 Nov 2015 00:50:06 +0000 (19:50 -0500)]
Add lisp watchpoints
This allows calling a function whenever a symbol-value is changed.
* src/lisp.h (lisp_h_SYMBOL_TRAPPED_WRITE_P):
(SYMBOL_TRAPPED_WRITE_P): New function/macro.
(lisp_h_SYMBOL_CONSTANT_P): Check for SYMBOL_NOWRITE specifically.
(enum symbol_trapped_write): New enumeration.
(struct Lisp_Symbol): Rename field constant to trapped_write.
(make_symbol_constant): New function.
* src/data.c (Fadd_variable_watcher, Fremove_variable_watcher):
(set_symbol_trapped_write, restore_symbol_trapped_write):
(harmonize_variable_watchers, notify_variable_watchers): New functions.
* src/data.c (Fset_default): Call `notify_variable_watchers' for trapped
symbols.
(set_internal): Change bool argument BIND to 3-value enum and call
`notify_variable_watchers' for trapped symbols.
Reuben Thomas [Tue, 8 Nov 2016 22:04:52 +0000 (22:04 +0000)]
Remove obsolete comments and commented code from dired-x.el
* lisp/dired-x.el (dired-mark-sexp): Remove a query from 1993 and its
1997 answer about whether dired-mark-sexp is used.
* lisp/dired-x.el (dired-buffers-for-dir-exact): Remove this function
commented out since before dired-x.el was added to RCS in 1994.
Reuben Thomas [Tue, 8 Nov 2016 22:01:59 +0000 (22:01 +0000)]
Remove pre-customize dired-x.el documentation
* lisp/dired-x.el (Commentary): Remove USAGE section explaining how to
use dired-x from .emacs. It is now fully customizable.
* lisp/dired-x.el (dired-guess-shell-alist-user): Remove explanation of
how to set this custom variable in .emacs. It should be customized.
Reuben Thomas [Tue, 8 Nov 2016 17:42:24 +0000 (17:42 +0000)]
Allow files to be matched case-sensitively in dired-x
* lisp/dired-x.el (dired-mark-unmarked-files): Add an argument which
controls case folding for matching the regex (Bug#18716).
(dired-omit-case-fold): New variable. Defaults to `t' on case-sensitive
systems, `nil' otherwise.
(dired-mark-omitted, dired-omit-expunge): Use dired-omit-case-fold.
* doc/misc/dired-x.texi, etc/NEWS: Document dired-omit-case-fold.
Reuben Thomas [Tue, 8 Nov 2016 11:53:20 +0000 (11:53 +0000)]
Add support for curly quotation marks to electric-pair-mode
* lisp/elec-pair.el (electric-pair-pairs, electric-pair-text-pairs): Add
entries for left/right single/double quotation marks, from
electric-quote-chars. Note that this is safe for single quotation marks,
unlike with the ASCII apostrophe, since, although the right quotation
mark can be used as an apostrophe, it is the left quotation mark that is
typed to get a pair (Bug#24901).
Michael Albinus [Fri, 2 Dec 2016 10:38:19 +0000 (11:38 +0100)]
Handle quoted file names in Tramp
* lisp/net/tramp.el (tramp-file-name-handler): Handle also the
case the file name is quoted. This is not trapped by the
reassigned `tramp-file-name-regexp' anymore.
Paul Eggert [Fri, 2 Dec 2016 05:47:12 +0000 (21:47 -0800)]
Make struct font_drivers read-only
This simplifies the code a bit, and makes the structs more
shareable and less likely to become corrupt.
* src/alloc.c (cleanup_vector):
* src/font.c (valid_font_driver, font_prepare_cache)
(font_finish_cache, font_get_cache, font_clear_cache)
(register_font_driver, font_update_drivers):
* src/font.h (struct font, struct font_driver_list)
(valid_font_driver):
struct font_drivers are now const.
* src/font.c, src/ftcrfont.c, src/ftfont.c, src/nsfont.m, src/xfont.c:
Omit no-longer-necessary decls.
* src/ftcrfont.c (syms_of_ftcrfont):
* src/ftxfont.c (syms_of_ftxfont):
* src/xftfont.c (syms_of_xftfont):
Omit no-longer-necessary initialization code.
* src/ftcrfont.c (ftcrfont_driver):
* src/ftfont.c (ftfont_driver):
* src/ftxfont.c (ftxfont_driver):
* src/macfont.m (macfont_driver):
* src/nsfont.m (nsfont_driver):
* src/xfont.c (xfont_driver):
* src/xftfont.c (xftfont_driver):
Use C99-style initializer for ease of maintenance, and make it const.
* src/ftcrfont.c, src/ftxfont.c, src/xftfont.c:
Refer to functions like ftfont_text_extents directly.
* src/ftfont.c (ftfont_get_cache, ftfont_list, ftfont_list_family)
(ftfont_has_char, ftfont_encode_char, ftfont_text_extents)
(ftfont_get_bitmap, ftfont_anchor_point, ftfont_otf_capability)
(ftfont_variation_glyphs, ftfont_filter_properties)
(ftfont_combining_capability):
* src/xfont.c (xfont_get_cache):
Now extern, so that other modules’ struct font_drivers can use
them directly.
* src/macfont.m (macfont_descriptor_entity):
* src/nsfont.m (nsfont_open):
Use constant directly; this is clearer.
Helmut Eller [Thu, 1 Dec 2016 16:58:08 +0000 (18:58 +0200)]
Forth related improvements for etags
Generate correct tags names for things like "(foo)".
Previously "(foo" created.
Fix a bug where a tag for "-bar" was created when encountering things
like "create-bar".
Recognize more words from the Forth-2012 Standard.
* lib-src/etags.c (Forth_words): Check for whitespace after defining
words. Create tag with make_tag instead of get_tag to avoid notiname
which isn't appropriate for Forth.
* test/manual/etags/forth-src/test-forth.fth: Add some test cases.
* test/manual/etags/ETAGS.good_1:
* test/manual/etags/ETAGS.good_2:
* test/manual/etags/ETAGS.good_3:
* test/manual/etags/ETAGS.good_4:
* test/manual/etags/ETAGS.good_5:
* test/manual/etags/ETAGS.good_6:
* test/manual/etags/CTAGS.good: Adapt to the changes in etags.c and
new test cases.
Eli Zaretskii [Thu, 1 Dec 2016 16:49:51 +0000 (18:49 +0200)]
Fix bugs with buffer-local tags tables
* lisp/progmodes/etags.el (visit-tags-table): After
'visit-tags-table-buffer' returns, retrieve the value of
'tags-file-name' from the buffer we started in. Force
recomputation of 'tags-completion-table' next time it is used,
since the list of tags table has changed.
(visit-tags-table-buffer): Accept an additional optional argument
CBUF, the buffer in which to start processing, and switch to that
buffer if CBUF is non-nil. All callers changed to supply a
non-nil CBUF when they call 'visit-tags-table-buffer' in a loop.
Doc fix.
(tags-completion-table): Accept an optional argument, the buffer
for which to build 'tags-completion-table', and build that
buffer's completion table.
(tags-lazy-completion-table): Pass the current buffer to
'tags-completion-table'.
(tags-file-name): Don't say in the doc string that setting this
variable directly is enough; say that 'visit-tags-table' should be
used for that. (Bug#158) (Bug#17326) (Bug#23164)
* doc/emacs/maintaining.texi (Select Tags Table): Delete the
advice to set 'tags-file-name' directly.
Paul Eggert [Tue, 29 Nov 2016 21:12:24 +0000 (13:12 -0800)]
Pacify Sun C 5.14
* src/lisp.h (enum Lisp_Save_Type): Put SAVE_UNUSED,
SAVED_INTEGER, SAVE_FUNCPOINTER, SAVE_POINTER, and SAVE_OBJECT
into this enum rather than into an anonymous enum. This avoids
diagnostics from Sun C 5.14 and is a bit clearer anyway.
Katsumi Yamaoka [Tue, 29 Nov 2016 10:20:51 +0000 (10:20 +0000)]
shr.el: Don't render a normal table twice
* lisp/net/shr.el (shr-collect-extra-strings-in-table):
Don't render a table if it is called for the first time,
IOW, recognize it to never be invalid (bug#25051).
Navigation and use of diff buffers had several annoying corner cases
that this patch fixes. These corner cases were largely due to
inconsistent treatment of file headers. Say you have a diff such as
this:
The file headers here are the '---' and '+++' lines. With the point on
such a line, hunk operations would sometimes refer to the next hunk and
sometimes to the previous hunk. Most of the time it would be the
previous hunk, which is not what the user would expect. This patch
consistently treats such headers as the next hunk. So with this patch,
if the point is on the '--- ccc' line, the point is seen as referring to
hunk3.
Specific behaviors this fixes are:
1. It should be possible to place the point in the middle of a diff
buffer, and press M-k repeatedly to kill hunks in the order they appear
in the buffer. With the point on hunk1, M-k M-k would kill hunk1 then
hunk2. With the point on hunk3, it would kill hunk3 then hunk4; this is
fine. However, with the point on hunk2, it'd kill hunk2 then hunk1.
This is fixed by this patch.
2. Similarly, it should be possible to apply hunks in order. Previously
with the point at the start, C-c C-a would apply the hunk1, then move
the point to the first @@ header, and thus C-c C-a would try to apply
the same hunk again.
* lisp/vc/diff-mode.el (diff--wrap-navigation): New function to add better
navigation logic to diff-{hunk,file}-{next,prev}.
(diff-hunk-next, diff-hunk-prev):
(diff-file-next, diff-file-prev): Better navigation logic if
skip-hunk-start is true, which happens when called interactively.
(diff-bounds-of-hunk, diff-find-source-location):
(diff-apply-hunk, diff-current-defun, diff-refine-hunk): Small tweaks to
improve hunk navigation.
Noam Postavsky [Fri, 18 Nov 2016 21:26:53 +0000 (16:26 -0500)]
Upcase Path and ComSpec in process-environment
Since 2016-07-18 "Keep w32 environment settings internal only", the
upcasing of environment variables "Path" and "ComSpec" occured after
initializing process-environment. This meant that Lisp code trying to
override "PATH" environment had no effect (Bug #24956).
* src/w32.c (init_environment): Upcase the "Path" and "ComSpec" entries
in Vprocess_environment.
Philipp Stephani [Tue, 22 Nov 2016 20:32:11 +0000 (21:32 +0100)]
Guard terminal parameter in XTerm mouse mode
It has been observed (in the HTerm terminal emulator) that the
event stored in the 'xterm-mouse-last-down' terminal parameter gets
overwritten during a mouse drag operation, causing Emacs to attempt to
synthesize the non-existing <drag-mouse-0> event. Copy the event into
the terminal parameter to protect against such modifications.
* lisp/xt-mouse.el (xterm-mouse-translate-1): Guard against modification
of input event list.
Reuse already existing lisp symbols for ignore_event (bug#19547).
* lisp/subr.el (while-no-input-ignore-events): Use them instead.
* src/keyboard.c (kbd_buffer_store_buffered_event):
Use help-echo for HELP_EVENT, iconify-frame for ICONIFY_EVENT,
and make-frame-visible for DEICONIFY_EVENT.
(syms_of_keyboard): Remove unneeded symbols.
Allow configuring which event throw-on-input should ignore (bug#19547).
* src/keyboard.c (kbd_buffer_store_buffered_event):
Translate event to corresponding symbol from `while-no-input-ignore-events`
and check them with Fmemq.
(syms_of_keyboard): Declare new lisp variable `while-no-input-ignore-events`
and its symbols.
Paul Eggert [Sat, 26 Nov 2016 08:19:08 +0000 (00:19 -0800)]
Don't access pointers to freed storage in regex.c
Remove __BOUNDED_POINTERS__ code, which does not work with
-fcheck-pointer-bound and which has undefined behavior anyway.
Problem found when trying to port to gcc -fcheck-pointer-bounds.
(This code was removed from glibc and gnulib regex.c many years ago.)
* src/regex.c (ELSE_EXTEND_BUFFER_HIGH_BOUND): Remove.
(EXTEND_BUFFER): Use a more-portable approach that avoids
undefined behavior due to inspecting pointers to freed storage.
Paul Eggert [Sat, 26 Nov 2016 05:24:28 +0000 (21:24 -0800)]
Port build to gcc -fcheck-pointer-bounds
This does not let Emacs run, just build.
* lib-src/etags.c (main):
* lib-src/profile.c (main):
Use return, not exit.
* src/bytecode.c (BYTE_CODE_THREADED) [__CHKP__]:
Do not define, as -fcheck-pointer-bounds is incompatible with taking
addresses of labels.
* src/menu.c (Fx_popup_dialog): Use eassume, not eassert,
to pacify gcc -fcheck-pointer-bounds -Wnull-dereference.
Hong Xu [Fri, 25 Nov 2016 10:51:22 +0000 (12:51 +0200)]
Allow user control of progress messages in cpp.el
* progmodes/cpp.el (cpp-message-min-time-interval): New defcustom.
(cpp-progress-time): Use 'cpp-message-min-time-interval'. Improve
the doc string.
(cpp-highlight-buffer): Use 'cpp-progress-message' instead of
'message' to print messages. (Bug#24861)
Alan Mackenzie [Thu, 24 Nov 2016 20:34:42 +0000 (20:34 +0000)]
Handle correctly an (undocumented) bare mode in hack-local-variables.
lisp/files.el (hack-local-variables-prop-line): When a file's first line
contains only a mode specification without the string "mode:", return the mode
symbol only when `handle-mode' is t.
Dima Kogan [Thu, 24 Nov 2016 02:04:21 +0000 (18:04 -0800)]
Clarify ediff-directories prompt
* lisp/vc/ediff-mult.el (ediff-filegroup-action):
* lisp/vc/ediff.el (ediff-directories,ediff-directory-revisions,
ediff-directories3, ediff-merge-directories,
ediff-merge-directories-with-ancestor, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor): Clarify prompt message for
filename filter in interactive ediff. The new message makes it clear what is
being filtered
Mark Oteiza [Tue, 22 Nov 2016 07:42:47 +0000 (02:42 -0500)]
Make sure elided long buffer names have ellipses added (Bug#24972)
* lisp/ibuffer.el (ibuffer-compile-make-eliding-form): Restore the
string concat, and chop "strvar" less the width of the ellipsis.
(ibuffer-compile-make-substring-form): Add space as padding, to fix
off-by-one in alignment.
Tino Calancha [Tue, 22 Nov 2016 06:23:50 +0000 (15:23 +0900)]
buff-menu: Add command to unmark all buffers
Bind 'U' in buff-menu, bs and electric-buff-menu to commands
to unmark all buffers (Bug#24880).
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-header-overlay-p):
New predicate; return non-nil if tabulated-list has a fake header.
* lisp/buff-menu.el (Buffer-menu-unmark-all-buffers):
New command; remove all flags that use a particular mark from all the lines.
Bind it to 'M-DEL'.
(Buffer-menu-unmark-all):
New command; remove all flags from all the lines. Bind it to 'U'.
(Buffer-menu-marker-char, Buffer-menu-del-char): New variables.
(Buffer-menu-delete, Buffer-menu-mark): Use them.
(Buffer-menu-mode-map): Update menus.
(Buffer-menu-mode): Update mode doc.
* lisp/bs.el (bs-unmark-all, bs-unmark-previous): New commands.
(bs-mode-map): Bind them to 'U' and '<backspace>' respectively.
(bs-mode): Update mode doc.
* lisp/ebuff-menu.el (electric-buffer-menu-mode-map):
Bind Buffer-menu-unmark-all to 'U' and Buffer-menu-unmark-all-buffers
to 'M-DEL'.
(bs--down, bs-down, bs--up, bs-up, bs-unmark-current, bs-mark-current):
Use point instead of cursor in doc string.
(electric-buffer-list): Update mode doc.
* doc/emacs/buffers.texi (Several Buffers): Mention Buffer-menu-unmark-all
and Buffer-menu-unmark-all-buffers.
; * etc/NEWS: Add an entry per each new feature.