1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-31 20:02:42 +00:00
Commit Graph

135143 Commits

Author SHA1 Message Date
Stefan Monnier
42732e2f8d Rework last commit to icomplete and minibuffer.el.
Rather than let minibuffer-force-complete set up cycling and then undoing it,
better tell it directly not to setup cycling.  Also be a bit more careful
to remove the transient map.
Additionally to bug#34077 and bug#34116, this also relates to bug#25644.

* lisp/minibuffer.el (completion--flush-all-sorted-completions):
Also take down the transient cycling map if applicable.
(minibuffer-force-complete): New arg dont-cycle.
Set completion-cycling to the actual function that takes down the
transient map rather than just t.
(minibuffer-force-complete-and-exit):
* lisp/icomplete.el (icomplete-force-complete): Use new dont-cycle arg.
2019-01-23 12:30:54 -05:00
Michael Albinus
b3dfcf3e9f ; Instrument tramp-tests.el for hydra. 2019-01-23 18:07:40 +01:00
João Távora
b9add0a5a7 Force completion in icomplete with C-M-i, but don't cycle (bug#34077)
Cycling after forcing a completion with C-M-i in icomplete can be
confusing, as it leaves rotated prospects in the minibuffer.  In C-x
C-f, for example it is very difficult to understand if the prospects
refer to subdirectories of the directory being completed to, which
happens naturally when the completion is unique; or if they are a
cycled version of prospects that match the new completion pattern, in
case the completion happens to still match other items.

To resolve this confusion, never cycle with C-M-i in icomplete:
non-ambiguous cycling can be achieved with C-. and C-,

The former behaviour can still be restored with:

(define-key icomplete-minibuffer-map (kbd "C-M-i") 'minibuffer-force-complete)

* lisp/icomplete.el (icomplete-force-complete): New command.
(icomplete-minibuffer-map): Bind C-M-i to icomplete-force-complete.
2019-01-23 16:31:11 +00:00
João Távora
210e592e55 Avoid cycling in minibuffer-force-complete-and-exit (bug#34116)
* lisp/minibuffer.el (minibuffer-force-complete-and-exit): Check
completion-cycling before minibuffer-force-complete.
2019-01-23 16:31:08 +00:00
Paul Eggert
d9779c377d * src/keyboard.c (read_char): Use CALLN. 2019-01-23 08:02:04 -08:00
Stefan Monnier
3a0c7b1e60 * src/emacs.c (load_pdump): Minor simplification. 2019-01-23 10:56:26 -05:00
Eli Zaretskii
43cf9b968a Fix compilation of pdumper.c with old buggy GCC
* src/pdumper.c (emacs_ptr_at): Renamed from emacs_ptr, to
avoid compilation errors with GCC 4.7.  Reported by Martin
Rudalics <rudalics@gmx.at>.  All callers changed.
2019-01-23 17:40:10 +02:00
Michael Albinus
927d9f1217 * lisp/net/tramp.el (tramp-set-file-uid-gid): Fix thinko.
* test/lisp/net/tramp-tests.el (tramp--test-instrument-test-case):
Adapt docstring.
2019-01-23 15:23:57 +01:00
Michael Albinus
741c02d594 ; Further tramp-tests instrumentation 2019-01-23 08:53:24 +01:00
Michael Albinus
ec9f42bc5c ; Instrument tramp-tests 2019-01-23 00:01:26 +01:00
Stefan Monnier
dde33727b2 * lisp/emacs-lisp/package.el (package--alist): New
(package-activate-all): Use it so we only initialize the local part of
package.el (this reduces the impact of bug#24467 and speeds up startup).
(package-installed-p): Use it so it works even if package is not
fully initialized.
(package-delete): Use it so we only initialize the local part of
package.el.
2019-01-22 17:54:29 -05:00
Phillip Lord
7b31de4d10 Add hook for all events
* lisp/subr.el (input-event-functions): Add input-event-functions
* src/keyboard.c (read_char): Call input-event-functions on all hooks
2019-01-22 21:46:03 +00:00
João Távora
fd94312443 electric-layout-mode kicks in before electric-pair-mode
This aims to solve problems with indentation.  Previously in, say, a
js-mode buffer with electric-layout-rules set to

   (?\{ before after)
   (?\} before)

would produce an intended:

   function ()
   {
     <indented point>
   }

The initial state

  function () {

Would go immediately to the following by e-p-m

  function () {}

Only then would e-l-m be applied to } first, and then again to {.
This makes lines indent in the wrong order, which can be a problem in
some modes.

The way we fix this is by reversing the order of e-p-m and e-l-m in
the post-self-insert-hook (and also fixing a number of details that
this uncovered).  In the end this changes the sequence from

  function () {

By way of e-l-m becomes:

  function () <newline>
  {
  <newline>

The e-p-m inserts the pair

  function () <newline>
  {
  <newline>}

And then e-l-m kicks in for the pair again, yielding the desired result

  function () <newline>
  {
  <indented point>
  }

* lisp/elec-pair.el (electric-pair--insert): Bind
electric-layout-no-duplicate-newlines.
(electric-pair-inhibit-if-helps-balance)
(electric-pair-skip-if-helps-balance): Use insert-before-markers,
playing nice with save-excurion.
(electric-pair-post-self-insert-function): Go to correct position
before checking electric-pair-inhibit-predicate and
electric-pair-skip-self predicate.
(electric-pair-post-self-insert-function): Increase priority to
50.

* lisp/electric.el (electric-indent-post-self-insert-function):
Delete trailing space in reindented line only if line was
really reindented.  Rewrite comment.
(electric-layout-allow-duplicate-newlines): New variable.
(electric-layout-post-self-insert-function-1): Rewrite comments.
Honours electric-layout-allow-duplicate-newlines.  Don't reindent
previous line because racecar.

* test/lisp/electric-tests.el: New test.
(plainer-c-mode): Move up.
(electric-modes-int-main-allman-style)
(electric-layout-int-main-kernel-style): Simplify
electric-layout-rules.
(electric-layout-for-c-style-du-jour): New helper.
(electric-layout-plainer-c-mode-use-c-style): New test.
2019-01-22 16:42:43 +00:00
João Távora
6ca4626c9f Remove tests of electric-pair-mode and CC-based modes
The behaviour previously observed in cc-mode-based-modes (and every
other major-mode) when electric-pair-mode or electric-layout-mode is
turned on may no longer be observed: this because CC-mode goes around
the generic implementation of electric-pair-mode.

An alternative is to bind every delimiter key like '{', '}', etc to
'self-insert-command, like most major modes already do, at the cost of
losing c-auto-newline functionality (which was incompatible anyway
before the recent changes of bug#33794).

* test/lisp/electric-tests.el
(electric-pair-test-for): No longer set it.
(define-electric-pair-test): Use js-mode instead of c++ mode,
which broke recently.
(whitespace-chomping-2): Add failing C++ test explicitly.
(electric-layout-int-main-kernel-style): Use plainer-c-mode.
(electric-layout-int-main-allman-style): Deleted.
(electric-modes-int-main-allman-style): Renamed from
electric-layout-int-main-allman-style.
2019-01-22 16:41:01 +00:00
Alan Mackenzie
9eaf5e052a Extend electric-pair-mode actions to < and >, and also to ( and ) in literals
* lisp/progmodes/cc-cmds.el (c-electric-lt-gt): Actuate electric-pair-mode if
a < or > is typed in a context where this is meaningful (#include, or
template).
(c-electric-paren): Allow electric-pair-mode activity in a comment or string.

* lisp/progmodes/cc-defs.el (c-make-keywords-re): Fix a bug where lists of
source symbols could get overwritten when parameter adorn is set to
'appendable.

* list/progmodes/cc-langs.el (c-cpp-include-key): New lang const and var.
2019-01-22 14:37:54 +00:00
Alan Mackenzie
f97b734ffb Revert "Fix electric-pair-tests by disabling bug#33794's fix with a variable"
This reverts commit be505726b6.
2019-01-22 14:30:30 +00:00
Michael Albinus
6038fdb2f9 Make Tramp tests more robust
* test/lisp/net/tramp-tests.el (tramp-test06-directory-file-name):
Bind `tramp-default-method'.
(tramp--test-file-attributes-equal-p): New defsubst.
(tramp-test19-directory-files-and-attributes): Use it.
2019-01-22 15:22:52 +01:00
Michael Albinus
c580081578 Respect setgid bit of the upper directory in Tramp
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.4.2-pre".

* lisp/net/tramp.el: Bump version to 2.4.2-pre.
(tramp-set-file-uid-gid): Respect setgid bit of the upper directory.
(tramp-default-file-modes, tramp-handle-insert-file-contents)
(tramp-mode-string-to-int, tramp-make-tramp-temp-file):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy)
(tramp-adb-handle-write-region):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly)
(tramp-sh-handle-write-region): Use octal constants.
2019-01-22 10:38:49 +01:00
Stefan Monnier
5259fdf960 * lisp/international/titdic-cnv.el: Use lexical-binding
(tit-process-body): Remove unused vars 'template' and 'second'.
(tsang-quick-converter): Remove unused args 'name' and 'title'.
Remove unused var 'slot'.
(tsang-b5-converter, quick-b5-converter, tsang-cns-converter)
(quick-cns-converter, py-converter, ziranma-converter)
(ctlau-converter, ctlau-gb-converter, ctlau-b5-converter):
Remove unused args 'name' and 'title'.
(miscdic-convert): Remove unused var 'dicbuf'.
Don't pass 'name' and 'title' to the conversion function.
2019-01-21 17:20:00 -05:00
Paul Eggert
be73ed4338 Simplify pdumper-load via timespectod
Suggested by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2019-01/msg00458.html
* src/pdumper.c (pdumper_load): Simplify.
2019-01-21 12:49:00 -08:00
Stefan Monnier
657f6fe500 * src/pdumper.c (dump_string) [CHECK_STRUCTS]: Fix copy&paste error 2019-01-21 15:03:28 -05:00
Stefan Monnier
6896604bab * lisp/electric.el: Fix typo in last change. 2019-01-21 14:30:29 -05:00
Stefan Monnier
d1ea675d2c (electric--sort-post-self-insertion-hook): Accept non-symbol functions
* lisp/electric.el (electric--sort-post-self-insertion-hook):
Don't burp on non-symbol functions.
2019-01-21 13:52:51 -05:00
Alan Third
6e5ac1d1ff Fix occasional pdumper/bootstrap error
* src/Makefile.in (emacs$(EXEEXT)): Copy the new executable over
bootstrap-emacs.
2019-01-21 16:52:17 +00:00
Michael Albinus
7fcdabdcb0 * lisp/net/tramp-sh.el (tramp-set-remote-path): Fix usage of tmpfile. 2019-01-21 11:34:32 +01:00
Michael Albinus
e5ef4c660c Use `inhibit-read-only' in Tramp
* lisp/net/tramp.el (tramp-process-actions, tramp-accept-process-output)
(tramp-send-string):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process)
(tramp-adb-send-command-and-check, tramp-adb-wait-for-output):
* lisp/net/tramp-sh.el (tramp-sh-handle-make-process)
(tramp-wait-for-output, tramp-send-command-and-check):
* lisp/net/tramp-smb.el (tramp-smb-wait-for-output):
Use `inhibit-read-only'.
2019-01-21 09:48:55 +01:00
Michael Albinus
5961e4fa42 Use POSIX "df" in Tramp, if available
* lisp/net/tramp-sh.el (tramp-get-remote-df):
Support also POSIX.1 "df".
(tramp-sh-handle-file-system-info): Adapt accordingly.
2019-01-20 18:56:26 +01:00
Eli Zaretskii
67b1053dcd Support native image resizing on MS-Windows
* src/w32term.c (x_draw_image_foreground): Scale the image if
the requested dimensions are different from the bitmap
dimensions.
* src/image.c (Fimage_scaling_p): Return t when HAVE_NTGUI.
(x_set_image_size) [HAVE_NTGUI]: Record the scaled dimensions
in the image struct.
* src/dispextern.h (HAVE_NATIVE_SCALING): Define when
HAVE_NTGUI as well.

* etc/NEWS: Update the announcement of native image scaling.
2019-01-20 17:59:12 +02:00
Philipp Stephani
551051596f Improve error data when passing a wrong type to 'sort' (Bug#34104)
* src/fns.c (Fsort): Use 'list-or-vector-p' for error message.
(syms_of_fns): Define 'list-or-vector-p'.

* test/src/fns-tests.el (fns-tests-sort): Extend unit test.
2019-01-20 00:04:19 +01:00
Paul Eggert
3e12551723 pdumper-stats now returns s, not ms
* doc/lispref/internals.texi (pdumper-stats):
* src/pdumper.c (pdumper_load): Return seconds, not milliseconds.
Minimize rounding errors in the usual case.
2019-01-19 14:39:16 -08:00
Eli Zaretskii
b821a70cb9 ; Fix a recent change in pdumper.c
* src/pdumper.c (Fpdumper_stats): Don't expand dump filename, as we don't
record the directory relative to which it was specified.
2019-01-19 20:37:50 +02:00
Eli Zaretskii
8e2b2a2b17 Minor cleanup in pdumper.c
* src/pdumper (subtract_timespec): Function removed.
(pdumper_load): Use timespec_sub instead of subtract_timespec.
2019-01-19 20:21:25 +02:00
Eli Zaretskii
8bb5939efa Improve 'pdumper-stats' and its documentation
* src/pdumper.c (Fpdumper_stats): Improve formatting and
wording of the doc string.  Decode the pdump file name and
expand-file-name it.

* doc/lispref/internals.texi (Building Emacs): Document
'pdumper-stats'.
2019-01-19 20:09:38 +02:00
Eli Zaretskii
436c225f1b Unbreak the macOS NS build
* src/xdisp.c (expose_window_tree): Declare and define 'f' on
NS as well.  Reported by Herbert J. Skuhra <herbert@gojira.at>.
2019-01-19 13:32:59 +02:00
Dmitry Gutov
8198d4be6b ; Update the commentary 2019-01-19 03:57:58 +03:00
Dmitry Gutov
b6af090022 Misc ignore-related project.el changes
* lisp/progmodes/project.el (project-ignores): Don't append the
default ignores list, just use vc-directory-exclusion-list.
(project--dir-ignores): Use the default ignores if the dir is
outside of the current project.
(project-files): Use project--dir-ignores to support external
roots better.
2019-01-19 03:54:58 +03:00
João Távora
7717778e8b Revert "Remove leftover from previous electric-layout-rules API"
This is a backward-incompatible change, and removing it isn't really
necessary.

This reverts commit 942dad2b51.
2019-01-18 22:29:02 +00:00
Stefan Monnier
78725e49d2 (electric-layout-post-self-insert-function-1): Simplify.
Call electric--after-char-pos right from the start, and take advantage of the
fact that it guarantees to return the right position or nil.
2019-01-18 17:20:21 -05:00
João Távora
0621591687 Ensure fns in electric-layout-rules are called in right position
* lisp/electric.el (electric-layout-rules): Ensure rules are
called from right spot.
2019-01-18 22:05:50 +00:00
João Távora
942dad2b51 Remove leftover from previous electric-layout-rules API
An element of electric-layout-rules is either a function or a pair
(CHAR . WHERE), and WHERE can't be a function anymore.

* lisp/electric.el (electric-layout-post-self-insert-function-1):
Remove leftover line.
2019-01-18 22:05:50 +00:00
Paul Eggert
7818bcdd6c Port to platforms where NULL is a pointer
* src/image.c (x_create_x_image_and_pixmap):
The Picture type is an integer, not a pointer.
Come to think of it, Picture is really XID, and as
far as I can tell, all-bits-one is the invalid XID,
not all-bits-zero.  However that is a bigger issue;
for now, this patch just unbreaks the build.
2019-01-18 13:04:09 -08:00
Eli Zaretskii
6bac9ea177 Improve documentation of portable dumping
* src/pdumper.c (Fdump_emacs_portable): Improve the doc string
and the error messages.

* doc/lispref/internals.texi (Building Emacs): Document
portable dumping and the 'dump-emacs-portable' function.
2019-01-18 17:58:47 +02:00
Glenn Morris
957090b795 Merge from origin/emacs-26
b6d78a0 (origin/emacs-26) Fix a typo in ELisp manual
c9f6f86 Prevent redrawing if frame is garbaged
00ba226 Attempt to fix hangs on MS-Windows due to C-g
b26d637 Fix Calc graph output on MS-Windows
03818b0 Fix a minor mistake in ELisp manual
6ac5985 ; Fix some trivial doc typos
21b9026 * etc/tutorials/TUTORIAL: Fix typo (bug#34049)
d223727 Fix UI of Buffer-menu
0f71655 Reinitialize ispell-really-enchant when changing the speller
9845044 Speed up loading css-mode
2019-01-18 07:50:47 -08:00
Eli Zaretskii
5e3b0f5239 Clean up memory allocation and unexec support on MS-Windows
* src/w32heap.c (report_temacs_memory_usage): Condition on
!CANNOT_DUMP, in addition to ENABLE_CHECKING.
(init_heap): Accept an argument, which tells us what heap
allocation method to use.
(DUMPED_HEAP_SIZE) [CANNOT_DUMP]: Define to a small value, as
we don't use dumped_data[] in this case.
* src/w32heap.h (init_heap): Adjust prototype.
<using_dynamic_heap>: Remove declaration.
* src/emacs.c (main) [WINDOWSNT]: Determine heap allocation
method based on whether we are in temacs and whether unexec
will be used to dump Emacs.  Pass the heap allocation method
to init_heap, which is now called after parsing the
--temacs=METHOD option.
* src/unexw32.c (unexec): Don't fiddle with using_dynamic_heap.
<using_dynamic_heap>: Remove definition.
* src/w32proc.c (malloc_before_init, realloc_before_init)
(free_before_init): New functions, to catch memory allocation
before heap allocation method is set up.
2019-01-18 17:04:00 +02:00
Eli Zaretskii
f943409183 ; * etc/NEWS: Fix description of pdumper. 2019-01-18 11:56:47 +02:00
Eli Zaretskii
b6d78a0d80 Fix a typo in ELisp manual
* doc/lispref/nonascii.texi (Converting Representations): Fix
inconsistency between @defun and the argument description of
'byte-to-string'.  (Bug#34119)
2019-01-18 10:51:57 +02:00
Dmitry Gutov
fbe87d0f8f Rebase project-find-regexp on top of project-files
* lisp/progmodes/project.el (project--files-in-directory):
New function.
(project-files, project-find-regexp): Use it.
(project--dir-ignores): New function.
(project--find-regexp-in): Remove.
(project--process-file-region): New function.
(project--find-regexp-in-files): New function.
(project-find-regexp, project-or-external-find-regexp): Use it, and
project-files as well.
2019-01-18 06:46:36 +03:00
Dmitry Gutov
afc8a41f48 ; Update the number 2019-01-18 06:46:35 +03:00
Dmitry Gutov
d8da0916ff Make 'project-files' the "canonical" generic of the two
* lisp/progmodes/project.el (project-files): Move the actual
command building and invocation here.
(project-file-completion-table): Delegate to 'project-files'.
2019-01-18 06:46:35 +03:00
Stefan Monnier
e99a124110 * lisp/textmodes/sgml-mode.el: Try and fix bug#33887.
Remove redundant :group args.
(sgml-syntax-propertize-rules): Speed up processing of most double quotes.
2019-01-17 18:25:00 -05:00