Michael Albinus [Sun, 3 Jun 2018 12:30:41 +0000 (14:30 +0200)]
Extend file-name-non-special
* lisp/files.el (insert-file-contents-literally):
Bind `inhibit-file-name-handlers' the default way.
(file-name-non-special): Rework, mainly for operations with two
file name arguments.
(file-name-unquote-non-special): New defsubst.
(file-name-unquote): Use it.
* test/lisp/files-tests.el (files-test-bug-18141): Skip if needed.
(files-tests--with-temp-non-special): Add docstring. Delete also
`non-special-name' if the file/directory exists.
(files-tests--special-file-name-extension)
(files-tests--special-file-name-regexp): New defconst.
(files-tests--special-file-name-handler, files-tests--new-name):
New defuns.
(files-tests--with-temp-non-special-and-file-name-handler): New macro.
(files-tests-file-name-non-special-access-file)
(files-tests-file-name-non-special-add-name-to-file)
(files-tests-file-name-non-special-byte-compiler-base-file-name)
(files-tests-file-name-non-special-copy-directory)
(files-tests-file-name-non-special-copy-file)
(files-tests-file-name-non-special-delete-directory)
(files-tests-file-name-non-special-delete-file)
(files-tests-file-name-non-special-diff-latest-backup-file)
(files-tests-file-name-non-special-directory-file-name)
(files-tests-file-name-non-special-directory-files)
(files-tests-file-name-non-special-directory-files-and-attributes)
(files-tests-file-name-non-special-dired-compress-handler)
(files-tests-file-name-non-special-dired-uncache)
(files-tests-file-name-non-special-expand-file-name)
(files-tests-file-name-non-special-file-accessible-directory-p)
(files-tests-file-name-non-special-file-acl)
(files-tests-file-name-non-special-file-attributes)
(files-tests-file-name-non-special-file-directory-p)
(files-tests-file-name-non-special-file-equal-p)
(files-tests-file-name-non-special-file-executable-p)
(files-tests-file-name-non-special-file-exists-p)
(files-tests-file-name-non-special-file-in-directory-p)
(files-tests-file-name-non-special-file-local-copy)
(files-tests-file-name-non-special-file-modes)
(files-tests-file-name-non-special-file-name-all-completions)
(files-tests-file-name-non-special-file-name-as-directory)
(files-tests-file-name-non-special-file-name-case-insensitive-p)
(files-tests-file-name-non-special-file-name-completion)
(files-tests-file-name-non-special-file-name-directory)
(files-tests-file-name-non-special-file-name-nondirectory)
(files-tests-file-name-non-special-file-name-sans-versions)
(files-tests-file-name-non-special-file-newer-than-file-p)
(files-tests-file-name-non-special-notify-handlers)
(files-tests-file-name-non-special-file-ownership-preserved-p)
(files-tests-file-name-non-special-file-readable-p)
(files-tests-file-name-non-special-file-regular-p)
(files-tests-file-name-non-special-file-remote-p)
(files-tests-file-name-non-special-file-selinux-context)
(files-tests-file-name-non-special-file-symlink-p)
(files-tests-file-name-non-special-file-truename)
(files-tests-file-name-non-special-file-writable-p)
(files-tests-file-name-non-special-find-backup-file-name)
(files-tests-file-name-non-special-get-file-buffer)
(files-tests-file-name-non-special-insert-directory)
(files-tests-file-name-non-special-insert-file-contents)
(files-tests-file-name-non-special-load)
(files-tests-file-name-non-special-make-auto-save-file-name)
(files-tests-file-name-non-special-make-directory)
(files-tests-file-name-non-special-make-directory-internal)
(files-tests-file-name-non-special-make-symbolic-link)
(files-tests-file-name-non-special-rename-file)
(files-tests-file-name-non-special-set-file-acl)
(files-tests-file-name-non-special-set-file-modes)
(files-tests-file-name-non-special-set-file-selinux-context)
(files-tests-file-name-non-special-set-file-times)
(files-tests-file-name-non-special-set-visited-file-modtime)
(files-tests-file-name-non-special-shell-command)
(files-tests-file-name-non-special-start-file-process)
(files-tests-file-name-non-special-substitute-in-file-name)
(files-tests-file-name-non-special-temporary-file-directory)
(files-tests-file-name-non-special-unhandled-file-name-directory)
(files-tests-file-name-non-special-vc-registered)
(files-tests-file-name-non-special-write-region): Extends tests to
quoted file names, which would require a file name handler if unquoted.
(files-test-no-file-write-contents): Make test more robust.
* test/lisp/net/tramp-tests.el (tramp-test21-file-links): Adapt test.
(tramp--test-emacs25-p): New defun.
(tramp-test34-vc-registered): Use it.
Glenn Morris [Sat, 2 Jun 2018 17:29:38 +0000 (10:29 -0700)]
; Merge from origin/emacs-26
The following commits were skipped:
6e0ff4c Fix decoding of directories when "~" includes non-ASCII chars 35c1ab1 Don't remove highlight of misspelled word on pdict save aac541e Fix some problems in the Cairo build e96245a Avoid infloops in font_open_entity 3a06e72 Fix encoding of characters when using GB18030 fonts 7782550 Fix C-p and C-n when wrap-prefix is too wide 9804482 Avoid redisplay problems with too wide wrap-prefix 5ee9ccf Fix 'posn-at-point' when line numbers are displayed c4db766 Another followup to fixing 'window-text-pixel-width' a6cf7be Fix mouse-set-point when line numbers are displayed ae78b14 * src/xdisp.c (Fwindow_text_pixel_size): Fix last change. f1f12d8 Fix 'window-text-pixel-size' when display properties are around 8b2b4b5 Fix display of TABs in hscrolled windows with line numbers de69d28 Fix wait_reading_process_output wait_proc hang
Glenn Morris [Sat, 2 Jun 2018 17:29:37 +0000 (10:29 -0700)]
Merge from origin/emacs-26
90bea37 ; * etc/PROBLEMS: Fix fvwm version number in last commit af82d1f * etc/PROBLEMS: Document stickyness problem with FVWM (Bug#31... 4a3aed2 Update Emacs Lisp Intro to match current behavior 21f2247 Merge branch 'emacs-26' of git.savannah.gnu.org:/srv/git/emac... 3257085 Fix previous commit 6d23525 Fix typos in several manuals (Bug#31610) 9188291 Add detailed documentation about lock files e5471b2 Add commentary for subtle aspect of frame.el
Glenn Morris [Sat, 2 Jun 2018 17:25:50 +0000 (10:25 -0700)]
Merge from origin/emacs-26
ca3f0a8 ; * etc/NEWS: Belated announcement of 2 changes made in Emacs... 99f92da Improve documentation of 'directory-files-and-attributes' df8649a * lisp/gnus/message.el (message-remove-header): Don't remove ... b682a7e ; * etc/NEWS: Add headings for Emacs 26.2 aa175a4 Adapt hexl-mode to native line-number display b8e7749 Fix example in Tramp manual f212fe5 Handle case where Xft is found but not XRender 186280f * doc/misc/tramp.texi (Frequently Asked Questions): Adapt zsh... 24ba633 Improve read-multiple-choice docstring (Bug#31628)
Eli Zaretskii [Sat, 2 Jun 2018 10:04:15 +0000 (13:04 +0300)]
Un-obsolete 'string-to-unibyte'
* lisp/subr.el (string-to-unibyte): No longer obsolete. See the
emacs-devel discussion around this message:
http://lists.gnu.org/archive/html/emacs-devel/2018-05/msg00656.html.
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.
João Távora [Fri, 1 Jun 2018 23:12:30 +0000 (00:12 +0100)]
Minimally support Flymake in Emacs C sources
The check-syntax target is enabled the use of Flymake's "legacy"
backend, flymake-proc-legacy-flymake in src/*.c. It works quite well
with C sources. The green light for this change had already been
given some time ago in
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.
Alan Mackenzie [Thu, 31 May 2018 11:32:15 +0000 (11:32 +0000)]
Amend c-before-change-check-unbalanced-strings to handle a quote at EOB.
* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Before
going back a sexp from the \n marked with a string-fence syntax-table text
property, check that it is indeed a \n. If not, simply delete that text
property from the isolated quote, not the quote and the \n which otherwise
delimit an unterminated string. Should we encounter a double quote marked
with a string-fence syntax-table text property at the end of the last line,
remove that property.
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)
Roland Winkler [Wed, 30 May 2018 15:24:46 +0000 (10:24 -0500)]
bibtex-search-entry: Reuse the window displaying the buffer.
* textmodes/bibtex.el (bibtex-reposition-window): New optional arg
pos.
(bibtex-search-crossref, bibtex-search-entry): Use it.
(bibtex-search-entry): If possible, reuse the window displaying
the buffer that contains the entry found.
Simen Heggestøyl [Tue, 29 May 2018 17:14:34 +0000 (19:14 +0200)]
Add Imenu support to CSS mode and its derivatives
* lisp/textmodes/css-mode.el (css--join-nested-selectors)
(css--prev-index-position, css--extract-index-name): New helper
functions for supporting Imenu.
(css-mode): Set `imenu-space-replacement',
`imenu-prev-index-position-function', and
`imenu-extract-index-name-function'.
(css-current-defun-name): Reuse `css--prev-index-position' and
`css--extract-index-name' to support nested selectors.
* test/lisp/textmodes/css-mode-tests.el (css-test-current-defun-name):
Fix character index.
(css-test-join-nested-selectors): New tests for
`css--join-nested-selectors'.
Eli Zaretskii [Tue, 29 May 2018 17:52:17 +0000 (20:52 +0300)]
Allow access to MS-Windows Registry from Lisp programs
* src/w32.c (g_b_init_reg_open_key_ex_w)
(g_b_init_reg_query_value_ex_w)
(g_b_init_expand_environment_strings_w): New init flags.
(globals_of_w32): Initialize them at startup.
(RegOpenKeyExW_Proc, RegQueryValueExW_Proc)
(ExpandEnvironmentStringsW_Proc): New function typedefs.
(reg_open_key_ex_w, reg_query_value_ex_w)
(expand_environment_strings_w): New wrapper function.
(w32_read_registry): New function.
* src/w32fns.c (Fw32_read_registry) [WINDOWSNT]: New primitive.
(syms_of_w32fns) [WINDOWSNT]: Defsubr it. DEFSYM "HKLM", "HKCU",
etc. root keys.
Michael Albinus [Tue, 29 May 2018 08:07:21 +0000 (10:07 +0200)]
Merge from origin/emacs-26
9d6a3ac73a Mention pcase as a fifth conditional form 567cb9046d Overhaul pcase documentation 4d7e54acff Use EXPVAL in docstrings of patterns defined using pcase-d... 7e8227ed68 Introduce EXPVAL for pcase, pcase-defmacro docstrings e6de5b3d51 Ensure pcase doc shows `QPAT first among extensions
* 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.
Gemini Lasswell [Sun, 27 May 2018 18:38:00 +0000 (11:38 -0700)]
Make cl-print respect print-level and print-length (bug#31559)
* lisp/emacs-lisp/cl-print.el (cl-print--depth): New variable.
(cl-print-object) <cons>: Print ellipsis if printing depth greater
than 'print-level' or length of list greater than 'print-length'.
(cl-print-object) <vector>: Truncate printing with ellipsis if
vector is longer than 'print-length'.
(cl-print-object) <cl-structure-object>: Truncate printing with
ellipsis if structure has more slots than 'print-length'.
(cl-print-object) <:around>: Bind 'cl-print--depth'.
* test/lisp/emacs-lisp/cl-print-tests.el
(cl-print-tests-3, cl-print-tests-4): New tests.
This is needed to avoid losing user settings made under the obsolete
name (Bug#31603).
* lisp/epa.el (epa-pinentry-mode): Move obsolete varalias from here...
* lisp/epg-config.el (epg-pinentry-mode): ...to here.
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.
Paul Eggert [Sat, 26 May 2018 20:29:06 +0000 (13:29 -0700)]
Don’t set EMACS=t if Bash is 4.4 or newer
(Thanks to Stefan Monnier for improvements to this patch.)
* lisp/term.el (term--bash-needs-EMACS-status): New var.
(term--bash-needs-EMACSp): New function.
(term-exec-1): Use it instead of always setting EMACS.
Tino Calancha [Sat, 26 May 2018 15:58:48 +0000 (00:58 +0900)]
replace-tests.el: Refactor undo tests
* test/lisp/replace-tests.el (replace-tests-bind-read-string): New variable.
(replace-tests-with-undo): Add helper macro to generate the boilerplate code.
(replace-tests--query-replace-undo, query-replace-undo-bug31073)
(query-replace-undo-bug31492, query-replace-undo-bug31538): Use it.
Tino Calancha [Sat, 26 May 2018 03:45:55 +0000 (12:45 +0900)]
replace-tests.el: Fix broken tests
After previous commit, all tests using helper function
`replace-tests-clauses' fail: during the expansion
of macro `replace-tests-with-undo', the function
`replace-tests-clauses' is unbound.
Delete those helpers and reimplement test
`query-replace-undo-bug31538'.
* test/lisp/replace-tests.el (query-replace-undo-bug31538):
Reimplement this test without using any helper function/macro.
Tino Calancha [Sat, 26 May 2018 02:28:21 +0000 (11:28 +0900)]
query-replace undo: Handle when user edits the replacement string
* lisp/replace.el (perform-replace): Update the replacement string
after the user edit it (Fix Bug#31538).
* test/lisp/replace-tests.el (replace-tests-clauses): New function.
(replace-tests-bind-read-string): New variable.
(replace-tests-with-undo): Macro to create boilerplate code.
(query-replace-undo-bug31073): Use it.
(query-replace-undo-bug31538): New test.
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.