Stefan Monnier [Fri, 23 Mar 2018 15:29:06 +0000 (11:29 -0400)]
Fix bug#30846, along with misc cleanups found along the way
* test/src/data-tests.el (data-tests-kill-all-local-variables): New test.
* src/buffer.c (swap_out_buffer_local_variables): Remove.
Fuse the body of its loop into that of reset_buffer_local_variables.
(Fkill_buffer, Fkill_all_local_variables): Don't call it any more.
(reset_buffer_local_variables): Make sure the buffer's local binding
is swapped out before removing it from the alist (bug#30846).
Call watchers before actually killing the var.
* src/data.c (Fmake_local_variable): Simplify.
Use swap_in_global_binding to swap out any local binding, instead of
a mix of find_symbol_value followed by messing with where&found.
Don't call swap_in_symval_forwarding since the currently swapped
binding is never one we've modified.
(Fkill_local_variable): Use swap_in_global_binding rather than messing
with where&found to try and trick find_symbol_value into doing the same.
* src/alloc.c (mark_localized_symbol): 'where' can't be a frame any more.
Jay Kamat [Tue, 8 May 2018 19:04:00 +0000 (12:04 -0700)]
esh-opt.el: Fix improper parsing of first argument (Bug#28323)
Examples of broken behavior:
sudo -u root whoami
Outputs: -u
ls -I '*.txt' /dev/null
Errors with: *.txt: No such file or directory
* lisp/eshell/esh-opt.el (eshell--process-args): Refactor usage of
args to eshell--args, as we rely on modifications from
eshell--process-option and vice versa. These modifications were not
being propogated in the (if (= ai 0)) case, since popping the first
element of a list doesn't destructively modify the underlying list
object.
* lisp/emacs-lisp/cl-print.el (cl-print-object) <cons>: Push each
element of list being printed onto cl-print--currently-printing.
* test/lisp/emacs-lisp/cl-print-tests.el (cl-print-circle-2): New
test.
Noam Postavsky [Fri, 30 Mar 2018 20:44:24 +0000 (16:44 -0400)]
Fix another case of freed markers in the undo-list (Bug#30931)
* src/alloc.c (free_marker): Remove.
* src/editfns.c (save_restriction_restore):
* src/insdel.c (signal_before_change): Detach the markers from the
buffer when we're done with them instead of calling free_marker on
them.
* test/src/editfns-tests.el (delete-region-undo-markers-1)
(delete-region-undo-markers-2): New tests.
Noam Postavsky [Thu, 29 Mar 2018 23:11:47 +0000 (19:11 -0400)]
Don't wait for visible frames to become visible
For discussion, see thread starting at
https://lists.gnu.org/archive/html/emacs-devel/2018-03/msg00807.html.
* src/xterm.c (x_make_frame_visible): Check FRAME_VISIBLE_P before
calling x_wait_for_event.
Eli Zaretskii [Fri, 18 May 2018 13:34:19 +0000 (16:34 +0300)]
Fix decoding of directories when "~" includes non-ASCII chars
* src/fileio.c (Fexpand_file_name): Don't build multibyte strings
from unibyte non-ASCII strings when NAME and DEFAULT_DIRECTORY
have different multibyteness, as this adds bytes to the byte
sequence, and in some situations, e.g., when the home directory
includes non-ASCII characters, can fail file APIs. (Bug#30755)
* lisp/startup.el (normal-top-level): Make sure default-directory
is set to a multibyte string when decoded on MS-Windows.
Eli Zaretskii [Sun, 6 May 2018 18:20:31 +0000 (21:20 +0300)]
Don't remove highlight of misspelled word on pdict save
* lisp/textmodes/ispell.el (ispell-pdict-save): Don't restart
flyspell-mode, as bug#11963, which this was supposed to fix, is
fixed better by ispell-command-loop, when the user types 'i' or
'a'. Restarting Flyspell mode when the personal dictionary is
saved caused bug#31372 as side effect.
(ispell-command-loop): Test 'flyspell-mode', not whether
flyspell-unhighlight-at is fboundp, to determine whether Flyspell
mode is turned on in the current buffer.
(flyspell-unhighlight-at): Add declare-function form for it.
Eli Zaretskii [Sat, 5 May 2018 08:52:29 +0000 (11:52 +0300)]
Avoid infloops in font_open_entity
* src/font.c (font_open_entity): Fail after 15 iterations through
the loop that looks for a font whose average_width and height are
both positive. This avoids infinite loops for fonts that, e.g.,
report average_width of zero for any possible size we try.
(Bug#31316)
Eli Zaretskii [Sat, 5 May 2018 08:45:37 +0000 (11:45 +0300)]
Fix encoding of characters when using GB18030 fonts
* lisp/international/fontset.el (font-encoding-alist): Fix the
GB18030 entry to encode characters correctly when passing them to
the xfont back-end. (Bug#31315) See also
http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg00754.html.
Eli Zaretskii [Fri, 30 Mar 2018 12:57:57 +0000 (15:57 +0300)]
Fix C-p and C-n when wrap-prefix is too wide
* src/xdisp.c (move_it_in_display_line_to): Avoid looping in
previous/next-line when wrap-prefix is set to a too-wide
stretch of whitespace. (Bug#30432)
Eli Zaretskii [Thu, 8 Mar 2018 13:32:23 +0000 (15:32 +0200)]
Fix 'window-text-pixel-size' when display properties are around
* src/xdisp.c (Fwindow_text_pixel_size): Correct the result when
there's a display property at the TO position, and the call to
move_it_to overshoots. (Bug#30746)
Eli Zaretskii [Wed, 7 Mar 2018 18:40:44 +0000 (20:40 +0200)]
Fix display of TABs in hscrolled windows with line numbers
* src/dispextern.h (struct it): New members tab_offset and
line_number_produced_p.
* src/xdisp.c (display_line): Don't set row->x to a negative value
if line numbers are being displayed. (Bug#30582)
Reset the line_number_produced_p flag before laying out the glyph
row.
(x_produce_glyphs): Use the line_number_produced_p flag to decide
whether to offset the X coordinate due to line-number display.
Use the tab_offset member to restore the original TAB width for
alignment purposes.
(move_it_in_display_line_to): Don't produce line numbers when moving
in hscrolled window to the left of first_visible_x.
(maybe_produce_line_number): Set the line_number_produced_p flag.
(Bug#30584)
* src/term.c (produce_glyphs): Correct TAB width only when
line_number_produced_p flag is set.
Matthias Dahl [Fri, 16 Feb 2018 15:57:40 +0000 (17:57 +0200)]
Fix wait_reading_process_output wait_proc hang
* src/process.c (read_process_output): Track bytes read from
a process.
(wait_reading_process_output): If called recursively through
timers and/or process filters via accept-process-output, it is
possible that the output of wait_proc has already been read by
one of those recursive calls, leaving the original call hanging
forever if no further output arrives through that fd and no
timeout has been set. Fix that by using the process read
accounting to keep track of how many bytes have been read and
use that as a condition to break out of the infinite loop and
return to the caller as well as to calculate the proper return
value (if a wait_proc is given that is).
* src/process.h (struct Lisp_Process): Add nbytes_read to track
bytes read from a process.
* src/xdisp.c (move_it_in_display_line_to): Don't exit the loop
under truncate-lines if the glyph at TO_CHARPOS was not yet
produced. This avoids bailing out too early when we are at
TO_CHARPOS, but didn't yet produce glyphs for that buffer
position, because the last call to PRODUCE_GLYPHS at this position
was for an object other than the buffer. For further details, see
http://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00537.html.
Eli Zaretskii [Fri, 1 Jun 2018 14:11:36 +0000 (17:11 +0300)]
Update Emacs Lisp Intro to match current behavior
* doc/lispintro/emacs-lisp-intro.texi (Wrong Type of Argument)
(debug, debug-on-entry, Void Function, Void Variable): Update the
*Backtrace* buffer display to current Emacs. (Bug#31654)
Robert Pluim [Fri, 1 Jun 2018 13:05:23 +0000 (15:05 +0200)]
Add detailed documentation about lock files
* doc/emacs/files.texi (Interlocking): Point user at detailed
file locking description in lisp reference manual. Add index
entry for '.#' to improve disoverability of information about locking.
* doc/lispref/files.texi (File Locks): Describe in detail what
the form of the lock file is. Add index entry for '.#' to
improve disoverability of information about locking.
* src/filelock.c (create-lockfiles): Add cross reference to
file locking in user manual and to 'lock-buffer'. Add string
'.#' to help users find the doc string.
Eli Zaretskii [Wed, 30 May 2018 17:30:07 +0000 (20:30 +0300)]
Adapt hexl-mode to native line-number display
* lisp/hexl.el (hexl-mode-ruler): When display-line-numbers is in
effect, adjust offsets and columns to account for the line-number
display. (Bug#31595)
* lisp/net/tramp-cmds.el (tramp-change-syntax):
Use `customize-set-variable'.
* lisp/net/tramp-sh.el (tramp-open-connection-setup-interactive-shell):
Ensure proper EOL handling for Darwin.
(tramp-find-inline-compress): Improve command quoting for w32.
Reported by Chris Zheng <chriszheng99@gmail.com>.
(tramp-open-connection-setup-interactive-shell): Wrap both echo
calls in parentheses, in order to avoid double prompt.
* lisp/net/tramp.el (tramp-default-user-alist)
(tramp-default-host-alist): Fix docstring.
(tramp-dissect-file-name): Adapt docstring. (Bug#30904)
(tramp-make-tramp-file-name): Check, that method is
not empty. (Bug#30038)
(tramp-message-show-message): Change default.
* lisp/net/trampver.el: Change version to "2.3.4-pre".
* test/lisp/net/tramp-tests.el (ert-x): Require it.
(tramp-test10-write-region): Extend test.
(tramp--test-emacs27-p, tramp--test-windows-nt): New defuns.
(tramp-test11-copy-file, tramp-test12-rename-file)
(tramp-test21-file-links, tramp-test24-file-acl)
(tramp-test25-file-selinux, tramp--test-check-files): Use them.
(tramp-test21-file-links): Do not call `make-symbolic-link' on w32.
Fix file name quoting test.
(tramp-test32-environment-variables-and-port-numbers):
Adapt check for systems which do not support "echo -n". (Bug#29712)
(tramp-test36-find-backup-file-name): Call also
`convert-standard-filename' due to w32.
(tramp-test41-asynchronous-requests):
Use $REMOTE_PARALLEL_PROCESSES. Flush cache prior file operations.
(tramp-test42-auto-load, tramp-test42-delay-load)
(tramp-test42-recursive-load, tramp-test42-remote-load-path):
Quote command due to w32.
Thien-Thi Nguyen [Mon, 21 May 2018 15:11:55 +0000 (17:11 +0200)]
Introduce EXPVAL for pcase, pcase-defmacro docstrings
Suggested by Drew Adams (Bug#31311).
* lisp/emacs-lisp/pcase.el (pcase): Use EXPVAL in
docstring to stand for the result of evaluating EXP.
(pcase-defmacro): Add (fn ...) form in docstring
that includes [DOC], and the EXPVAL convention.
Thien-Thi Nguyen [Mon, 21 May 2018 14:57:49 +0000 (16:57 +0200)]
Ensure pcase doc shows `QPAT first among extensions
* lisp/emacs-lisp/pcase.el (pcase--make-docstring):
Split extensions display into two phases, collection
and display, separated by a reordering step that
ensures backquote is the first.
Noam Postavsky [Thu, 24 May 2018 23:49:11 +0000 (19:49 -0400)]
Note caveat for backward regexp searching in docstring (Bug#31584)
* src/search.c (Fre_search_backward): Emphasize that backwards
searches may give shorter than expected matches.
* doc/lispref/searching.texi (Regexp Search): Add an anchor for
re-search-backward to reference.
Eli Zaretskii [Thu, 24 May 2018 17:37:15 +0000 (20:37 +0300)]
More fixes of Intro to Emacs Lisp
* doc/lispintro/emacs-lisp-intro.texi (Finding More): Tell the
reader how to invoke 'M-.' without a tags table. Add a
cross-reference to the Emacs manual for when a tags table does
need to be created.
(append save-excursion): Rephrase a confusing sentence.
(Bug#31578)
Eli Zaretskii [Thu, 24 May 2018 16:49:34 +0000 (19:49 +0300)]
Add a footnote to Emacs Lisp Intro
* doc/lispintro/emacs-lisp-intro.texi (Run a Program): Describe
the detailed output of integer value evaluation in a footnote, to
prevent confusion. (Bug#31579)
Eli Zaretskii [Wed, 23 May 2018 16:31:38 +0000 (19:31 +0300)]
Fix some cross-references in emacs-lisp-intro.texi
* doc/lispintro/emacs-lisp-intro.texi (List Processing)
(Determining the Element, graph-body-print): Fix cross-references
to subsections that don't exist in the printed version of the
manual. (Bug#31567)
Eli Zaretskii [Mon, 21 May 2018 15:01:57 +0000 (18:01 +0300)]
Update binding of 'M-.' in Intro to Emacs Lisp
* doc/lispintro/emacs-lisp-intro.texi (On Reading this Text)
(Finding More, Buffer Related Review, Buffer Exercises)
(Find a File, Conclusion): 'M-.' is now bound to
'xref-find-definitions'. (Bug#31542)
Eli Zaretskii [Sun, 20 May 2018 07:11:05 +0000 (10:11 +0300)]
Minor fixes in the Emacs manual
* doc/emacs/misc.texi (Gnus Group Buffer): Fix a typo. (Bug#31534)
(Single Shell): Rephrase an unclear sentence. (Bug#31535)
(Remote Host): Use @command where appropriate. (Bug#31536)
João Távora [Fri, 11 May 2018 22:28:40 +0000 (23:28 +0100)]
Fix filesystem littering by Flymake's legacy backend
The Flymake legacy "proc" backend, which is active by default will try
to syntax-check foo.c/foo.cpp and many other types of files, but on
failing to find a suitable Makefile target, will fail. There's
nothing wrong with that except that it used to leave behind the
foo_flymake.c and foo_flymake.cpp auxiliary files behind, littering
the filesystem.
* lisp/progmodes/flymake-proc.el (flymake-proc-legacy-flymake):
Call init-function inside of the unwind-protect.
Eli Zaretskii [Fri, 11 May 2018 09:39:52 +0000 (12:39 +0300)]
More minor changes in shell-related nodes of Emacs manual
* doc/emacs/misc.texi (Interactive Shell): Clarify how the window
that displays "*shell*" is selected.
(Shell Prompts): Fix a typo. Reported by Jorge
<jorge+list@disroot.org> in emacs-manual-bugs.
Eli Zaretskii [Fri, 11 May 2018 09:32:31 +0000 (12:32 +0300)]
Fix inaccuracies in "Shell Ring" node of Emacs manual
* doc/emacs/misc.texi (Shell Ring): Don't mention 'M-s' and don't
insist on Shell history commands being "jsut like" similar
commands that operate on minibuffer history. Reported by Jorge
<jorge+list@disroot.org> in emacs-manual-bugs.