Move single-character casing logic into a separate function so that
it is collected in a single place. This will make future changes to
the logic easier. This commit introduces no functionality changes.
* src/casefiddle.c (struct casing_context, prepare_casing_context): New
sturcture for saving casing context and function to initialise it.
(case_character): New function which cases character base on provided
context.
(do_casify_integer, do_casify_multibyte_string,
do_casify_unibyte_string, casify_object, casify_region): Convert to
use casing_context and case_character.
casify_object had three major cases to cover and those were mostly
independent of each other. Move those branches to separate function
so it’s easier to comprehend each individual case.
While at it, use somewhat more descriptive ch and cased variable names
rather than c and c1.
Lars Brinkhoff [Wed, 5 Apr 2017 06:42:25 +0000 (08:42 +0200)]
Update documentation for type semantics of records.
* objects.texi (Record Type): improve description of what
`type-of' returns for records.
(Type Descriptors): new section.
* elisp.texi: reference it.
* records.texi (Records): reference it. Document behaviour when type
slot is a record.
* alloc.c (Fmake_record, Frecord): mention type desciptors.
Ken Raeburn [Thu, 6 Apr 2017 03:16:10 +0000 (23:16 -0400)]
In CANNOT_DUMP builds, allow editing of files named "dump".
* lisp/loadup.el: Perform the "dump" or "bootstrap" actions like
calling dump-emacs only if dump-emacs is defined; otherwise, don't
treat those command-line argument specially.
Ken Raeburn [Wed, 5 Apr 2017 06:48:49 +0000 (02:48 -0400)]
In CANNOT_DUMP builds, don't prepare for unexec.
Having a command-line argument of "dump" or "bootstrap" would trigger
behavior like not installing signal handlers. In CANNOT_DUMP modes,
we should get signal handlers installed regardless of whatever funny
file names we decide to edit.
src/emacs.c (main) [CANNOT_DUMP]: Don't enable the "dumping"
alterations to initialization that prepares the process for unexec.
Tom Tromey [Thu, 23 Mar 2017 17:33:47 +0000 (11:33 -0600)]
change sgml-mode to help multi-html mode
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-rules): New
defconst.
(sgml-syntax-propertize): Use it.
(sgml--find-<>-backward): New function.
(sgml-parse-tag-backward): Use it.
Tom Tromey [Sun, 19 Mar 2017 16:52:28 +0000 (10:52 -0600)]
change viper to use derived-mode-p
* lisp/subr.el (provided-mode-derived-p): New function.
(derived-mode-p): Use it.
* lisp/emulation/viper.el (viper-mode): Use derived-mode-p.
(this-major-mode-requires-vi-state): Use provided-mode-derived-p.
(set-viper-state-in-major-mode): Use derived-mode-p.
Paul Eggert [Wed, 5 Apr 2017 01:39:43 +0000 (18:39 -0700)]
Minor cleanups related to type-of
* src/data.c (Frecordp): Rename from Frecordp_p, for consistency.
* src/data.c (syms_of_data):
* src/frame.c (syms_of_frame): Put all the primitive type names
together, under the "Types that type-of returns" comment.
Default to https for elpa.gnu.org if gnutls available
* lisp/emacs-lisp/package.el (package-archives):
Default to https for elpa.gnu.org if gnutls is available. Ref:
http://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00130.html
Paul Eggert [Tue, 4 Apr 2017 21:06:25 +0000 (14:06 -0700)]
Minor simplifications and doc for records
* doc/lispref/records.texi (Records): Mention size limit.
* etc/NEWS: Mention records.
* src/alloc.c (allocate_pseudovector, allocate_record):
Prefer 'PSEUDOVECTOR_SIZE_MASK' to its definiens.
(allocate_record): Check arg range here, not in callers, as this
simplifies the code. Use allocate_vectorlike instead of
allocate_vector, to avoid duplicate runtime tests.
(Fmake_record, record): Don't mention PSEUDOVECTOR_SIZE_BITS in
the doc string, as it is not visible to the user.
(Fmake_record, record, Fcopy_record):
Prefer make_lisp_ptr to XSETVECTOR.
(record): Broaden memcpy to copy the type, too.
Make subprocess functions resolve the default directory
`call-process' doesn't respect file name handlers in
`default-directory', so `file-name-non-special' has to resolve them
for `process-file', `start-file-process', and
`shell-command' (Bug#25949).
* lisp/files.el (file-name-non-special): Also resolve default
directory for 'process-file', 'start-file-process', and
'shell-command'.
* test/lisp/files-tests.el
(files-tests--file-name-non-special--subprocess): Add unit test.
Stefan Monnier [Thu, 16 Mar 2017 02:48:28 +0000 (22:48 -0400)]
Make EIEIO use records.
* lisp/emacs-lisp/eieio-compat.el
(eieio--generic-static-object-generalizer): Adjust to new tags.
* lisp/emacs-lisp/eieio-core.el: Use records, and place the class object
directly as tag.
(eieio--object-class): Adjust to new tag representation.
(eieio-object-p): Rewrite, and adapt to new `type-of' behavior.
(eieio-defclass-internal): Use `make-record'.
(eieio--generic-generalizer): Adjust generalizer code accordingly.
* lisp/emacs-lisp/eieio.el (make-instance, clone): Use copy-record.
Lars Brinkhoff [Tue, 14 Mar 2017 12:52:40 +0000 (13:52 +0100)]
Make cl-defstruct use records.
* lisp/emacs-lisp/cl-extra.el (cl--describe-class)
(cl--describe-class-slots): Use the new `type-of'.
* lisp/emacs-lisp/cl-generic.el (cl--generic-struct-tag): Use type-of.
(cl--generic-struct-specializers): Adjust to new tag.
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): When type is nil, use records.
Use the type symbol as the tag. Use copy-record to copy structs.
(cl--defstruct-predicate): New function.
(cl--pcase-mutually-exclusive-p): Use it.
(cl-struct-sequence-type): Can now return `record'.
* lisp/emacs-lisp/cl-preloaded.el (cl--make-slot-desc): Adjust ad-hoc
code to new format.
(cl--struct-register-child): Work with records.
(cl-struct-define): Don't touch the tag's symbol-value and
symbol-function slots when we use the type as tag.
* lisp/emacs-lisp/cl-print.el (cl-print-object): Adjust to new tag.
* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-defstruct-record):
New test.
* doc/lispref/records.texi, doc/misc/cl.texi: Update for records.
Lars Brinkhoff [Sun, 6 Jan 2013 13:27:44 +0000 (14:27 +0100)]
Add record objects with user-defined types.
* src/alloc.c (allocate_record): New function.
(Fmake_record, Frecord, Fcopy_record): New functions.
(syms_of_alloc): defsubr them.
(purecopy): Work with records.
* src/data.c (Ftype_of): Return slot 0 for record objects, or type
name if record's type holds class.
(Frecordp): New function.
(syms_of_data): defsubr it. Define `Qrecordp'.
(Faref, Faset): Work with records.
* src/fns.c (Flength): Work with records.
* src/lisp.h (prec_type): Add PVEC_RECORD.
(RECORDP, CHECK_RECORD, CHECK_RECORD_TYPE): New functions.
* src/lread.c (read1): Add syntax for records.
* src/print.c (PRINT_CIRCLE_CANDIDATE_P): Add RECORDP.
(print_object): Add syntax for records.
* test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-2):
New test.
* test/src/alloc-tests.el (record-1, record-2, record-3):
New tests.
* doc/lispref/elisp.texi, doc/lispref/objects.texi,
doc/lispref/records.texi: Add documentation for records.
Fix a test that breaks the test suite when it is run within a
virtual environment.
See following link for details:
https://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00857.html
* test/lisp/progmodes/python-tests.el
(python-shell-calculate-process-environment-7): Bind
python-shell-virtualenv-root to VIRTUAL_ENV when this var is set; otherwise
bind it to '/env'.
Throw a `search-failed' derived error in Info search
The original fix for Bug#6106 switched from signalling `search-failed'
to `user-error'. However, this breaks incremental searching over
multiple nodes because the isearch code doesn't expect a `user-error'.
* src/search.c (syms_of_search): New error, `user-search-failed',
with `user-error' and `search-failed' as parents.
* doc/lispref/errors.texi (Standard Errors): Document it.
* etc/NEWS: Announce it.
* lisp/info.el (Info-search): Use it instead of `user-error' so that
isearch will handle failed searches correctly.
Paul Eggert [Sun, 2 Apr 2017 20:09:56 +0000 (13:09 -0700)]
Fix bugs in simplified test dependencies
Problem reported by Glenn Morris in:
http://lists.gnu.org/archive/html/emacs-devel/2017-04/msg00017.html
* test/Makefile.in (LOGFILES, TESTS): Omit leading "./".
(TESTS): Omit unnecessary patsubst.
(test_template): Redo dependency heuristic, hopefully
correctly this time. It's the .log file that depends,
not the phony test target. Declare the phonies to be PHONY.
Resurrect the exception for the *-tests subdirectory.
Adjust to the fact that leading "./" is omitted now.
Michael Albinus [Sun, 2 Apr 2017 09:02:54 +0000 (11:02 +0200)]
Apply connecion-local variables for shells
* doc/misc/tramp.texi (Remote processes): Show use of connection-local
variables. Don't mention Emacs 23 anymore.
(Frequently Asked Questions): Precise Emacs and MS Windows version.
Evgeni Kolev [Mon, 27 Mar 2017 06:30:10 +0000 (09:30 +0300)]
Propertize only perl prototype chars `][$%&*;+@\' as punctuation
This prevents variables in signatures such as `sub add ($a, $b)' from
being treated as punctuation.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function):
Strictly match only prototype characters as punctuation. (Bug#26037)
Tom Tromey [Mon, 13 Mar 2017 20:53:59 +0000 (21:53 +0100)]
fix two js-mode syntax propertization bugs
Bug#26070:
* lisp/progmodes/js.el (js--syntax-propertize-regexp-regexp): Add
zero-or-one to regular expression.
(js-syntax-propertize-regexp): Update. Propertize body of regexp
literal up to END.
* test/lisp/progmodes/js-tests.el (js-mode-propertize-bug-1)
(js-mode-propertize-bug-2): New tests.
Paul Eggert [Sat, 1 Apr 2017 19:15:03 +0000 (12:15 -0700)]
Simplify test dependency generation
Generate default dependencies by using GNU extensions to ‘make’
rather than via a hacky auxiliary program and script.
* .gitignore: Remove test/make-test-deps.mk.
* test/Makefile.in (ELFILES, LOGFILES, TESTS):
Use :=, not =, to avoid multiple redundant invocations of ‘find’.
(test_template): Infer dependency directly instead of via
make-test-deps.mk.
(check-doit): Prepend ‘@’ to avoid excessively long ‘make’ output.
(clean): No need to clean make-test-deps.mk.
(make-test-deps.mk): Remove rule.
* test/make-test-deps.emacs-lisp: Remove.
This also refactors digest authentication functions in url-auth.el.
* lisp/url/url-auth.el (url-digest-auth, url-digest-auth-create-key):
(url-digest-auth-build-response, url-digest-auth-directory-id-assoc):
(url-digest-auth-name-value-string, url-digest-auth-source-creds):
(url-digest-cached-key, url-digest-cache-key, url-digest-find-creds):
(url-digest-find-new-key, url-digest-prompt-creds): Add new functions
to simplify code and aid in unit testing.
(url-digest-auth-build-response): Hook up new functionality, or fall
back to previous.
(url-digest-auth-make-request-digest-qop):
(url-digest-auth-make-cnonce, url-digest-auth-nonce-count):
(url-digest-auth-name-value-string): Add new helper functions.
* test/lisp/url/url-auth-tests.el (url-auth-test-colonjoin):
(url-auth-test-digest-ha1, url-auth-test-digest-ha2):
(url-auth-test-digest-request-digest): Add a few tests as now more
features are testable via intermediate functions.
(url-auth-test-challenges, url-auth-test-digest-request-digest): Test
the new implementation. Parts of these were accidentally already
merged in the past.
Tino Calancha [Fri, 31 Mar 2017 08:27:08 +0000 (17:27 +0900)]
dired-mark-suffix: New command
Now dired-mark-extension prepends '.' to extension when not present.
Add command dired-mark-suffix to preserve the previous
behaviour (Bug#25942).
* lisp/dired-x.el (dired-mark-suffix): New command;
mark files ending in a given suffix.
(dired--mark-suffix-interactive-spec): New defun.
(dired-mark-extension, dired-mark-suffix): Use it.
* doc/misc/dired-x.texi (Advanced Mark Commands): Update manual.
* test/lisp/dired-x-tests.el: New test suite; add test for these features.
; * etc/NEWS (Incompatible Lisp Changes in Emacs 26.1):
; Mention these changes.
Paul Eggert [Fri, 31 Mar 2017 02:26:58 +0000 (19:26 -0700)]
Use find -delete if available
This shortens the ‘make’ output and should avoid some
repetitive scanning of directories during a build.
* configure.ac (FIND_DELETE): New var.
* lisp/Makefile.in (compile-always, bootstrap-clean):
* test/Makefile.in (clean, bootstrap-clean): Use it.
* test/Makefile.in (ELCFILES, LOGSAVEFILES): Remove; no longer needed.
John Mastro [Thu, 30 Mar 2017 23:01:41 +0000 (16:01 -0700)]
Fix a small incompatibility in ibuffer
Translate nil values from column functions to the empty string, so that
subsequent calls to string-width don't signal an error (Bug#26317).
* lisp/ibuffer.el (ibuffer-compile-format): If a column function returns
nil, treat it like the empty string.
Alan Mackenzie [Thu, 30 Mar 2017 20:24:39 +0000 (20:24 +0000)]
Fix C++ fontification problems 500 bytes after typing a space, and other bugs
Also implement the "asymmetric space" rule for fontifying otherwise
ambiguous
declarations/expressions.
* lisp/progmodes/cc-engine.el (c-before-change-check-<>-operators): Don't set
c-new-BEG or c-new-END when there is no need.
(c-forward-decl-or-cast-1): Add "CASE 17.5" to implement the "asymmetric
space" rule.
* lisp/progmodes/cc-fonts.el (c-get-fontification-context): New function,
extracted from c-font-lock-declarations. Add to this function processing to
make `context' 'decl for lines contained within parens when these are also
declarations.
(c-font-lock-declarations): Call the newly extracted function above in place
of inline code.
* lisp/progmodes/cc-mode.el (c-fl-decl-start): Set point before calling
c-literal-start.
* lisp/progmodes/cc-vars.el (c-asymmetry-fontification-flag): New user option.
* doc/misc/cc-mode.texi (Misc Font Locking): New node documenting the new
"asymmetric fontification" rule, including the variable
c-asymmetric-fontification-flag.
Paul Eggert [Thu, 30 Mar 2017 18:08:23 +0000 (11:08 -0700)]
Some inotify cleanup
This catches some problems with integer overflow and races
that I noticed in inotify.c after reviewing the changes
installed to fix Bug#26126.
* src/fns.c, src/lisp.h (equal_no_quit): Now extern.
* src/inotify.c (aspect_to_inotifymask):
Check for cycles and for improper lists.
(make_lispy_mask, lispy_mask_match_p): Remove.
All callers changed to use INTEGER_TO_CONS and CONS_TO_INTEGER.
(inotifyevent_to_event, add_watch):
Don’t assume watch descriptors and cookies fit in fixnums.
(add_watch): Use assoc_no_quit, not Fassoc.
Avoid integer overflow in (very!) long-running processes where
the Emacs watch ID could overflow. Avoid some duplicate code.
(find_descriptor): New function.
(remove_descriptor): First arg is now the returned value from
find_descriptor, rather than the descriptor. This way, the
value can be removed without calling Fdelete, which might quit.
Wait until the end (when watch_list is consistent) before signaling
any errors.
(remove_watch, inotify_callback):
Use find_descriptor to avoid the need for Fdelete.
(inotify_callback): Use simpler tests for ioctl failure.
Free temporary buffer if signaled, and put it on the stack if small.
Use ssize_t to index through read results, to avoid a cast.
(valid_watch_descriptor): New function, with a tighter check.
(Finotify_rm_watch, Finotify_valid_p): Use it.
(Finotify_valid_p): Use assoc_no_quit and ass_no_quit instead
of Fassoc. Do not assume the first assoc succeeds.
* test/src/inotify-tests.el (inotify-valid-p-simple):
Add inotify-valid-p tests, some of which dump core without
the fixes noted above.
Paul Eggert [Thu, 30 Mar 2017 05:34:02 +0000 (22:34 -0700)]
Fix assoc_no_quit so that it does not quit
The problem was that it called Fequal, which can quit.
* src/fns.c (enum equal_kind):
New enum, to be used in place of a boolean.
(equal_no_quit): New function.
(Fmemql, Feql): Use it to compare floats, as a minor tuneup.
(assoc_no_quit): Use it to avoid quitting, the main point here.
(internal_equal): Generalize bool to enum equal_kind arg, so that
there are now 3 possibilities instead of 2. Do not signal an
error if EQUAL_NO_QUIT. Put the arg before the depth, since depth
should be irrelevant if the arg is EQUAL_NO_QUIT. All callers
changed.
Noam Postavsky [Tue, 28 Mar 2017 14:10:34 +0000 (10:10 -0400)]
Adjust some search failure errors in info.el
* lisp/info.el (Info-select-node): The search for beginning of node is
an internal detail, and is not normally expected to fail, so it should
not be a user error.
(Info-complete-menu-item): Failing to find a menu indicates the user
searched for a menu when there isn't one, so change to `use-error'.
Paul Eggert [Mon, 27 Mar 2017 18:22:54 +0000 (11:22 -0700)]
Fix obsolete ‘test/automated’ references
* Makefile.in (mostlyclean, clean, maybeclean_dirs, distclean)
(bootstrap-clean, maintainer-clean):
Clean ‘test’, not ‘test/automated’. Test for existence of
subdirectory only for ‘test’, not for directories that should
always exist.
* admin/MAINTAINERS, etc/TODO, lisp/emacs-lisp/bytecomp.el:
* lisp/emacs-lisp/seq.el, lisp/emacs-lisp/thunk.el:
* lisp/man.el (Man-parse-man-k):
* lisp/url/url-domsuf.el, make-dist:
* test/file-organization.org:
Fix obsolete references to test/automated.
Eli Zaretskii [Sun, 26 Mar 2017 18:36:52 +0000 (21:36 +0300)]
Fix redisplay glitches due to recent change in redisplay_internal
* src/xdisp.c (redisplay_internal): A better fix for bug#26097.
See http://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00695.html
for the problems caused by the original fix.
* lisp/net/tramp.el (tramp-autoload-file-name-handler): Remove.
(tramp-register-autoload-file-name-handlers)
(tramp-register-file-name-handlers): Do not handle
`tramp-autoload-file-name-handler' anymore. Mark `operations'
the handlers are responsible for.
(tramp-register-foreign-file-name-handler): New defun.
Andreas Politz [Sun, 26 Mar 2017 07:21:56 +0000 (09:21 +0200)]
Fix issues regarding inotify file-notification
Remove special code handling the inotify back-end.
* lisp/filenotify.el (file-notify--watch): New struct
representing a file-watch.
(file-notify-descriptors): Use the new struct as hash-value.
(file-notify-handle-event): Check that event is a cons.
(file-notify--rm-descriptor, file-notify--event-watched-file)
(file-notify--event-file-name, file-notify--event-file1-name)
(file-notify-callback, file-notify-add-watch)
(file-notify-rm-watch, file-notify-valid-p): Use new struct.
Remove special code handling inotify descriptors. Remove code
handling multiple clients per descriptor.
(file-notify--descriptor): Remove unused function.
Let inotify-add-watch return a unique descriptor on every
call, like every other back-end does (Bug#26126). Prevent
multiple clients from interfering with each other, when
watching a shared descriptor.
* src/inotify.c (watch_list): Extend the format by including a
id and the provided mask.
(INOTIFY_DEFAULT_MASK): Default mask used for all clients.
(make_watch_descriptor): Removed.
(make_lispy_mask, lispy_mask_match_p): New functions.
(inotifyevent_to_event): Match event against the mask provided
by the client.
(add_watch, remove_descriptor, remove_watch): New functions
for managing the watch_list.
(inotify_callback): Use the new functions.
(Finotify_add_watch, Finotify_rm_watch): Remove deprecated
flags from documentation. Add check for validity of provided
descriptor. Use the new functions. Use the default mask.
(INOTIFY_DEBUG): Add new debug conditional.
(inotify-watch-list, inotify-allocated-p): New debug functions.
(symbol_to_inotifymask, syms_of_inotify): Remove deprecated symbols.
* test/lisp/filenotify-tests.el:
(file-notify-test02-rm-watch): Remove expected failure for inotify.
Eric Abrahamsen [Fri, 24 Mar 2017 19:10:06 +0000 (12:10 -0700)]
Expand manual section on quitting windows
* doc/lispref/windows.texi (Quitting Windows): Provide more
information about the elements of the quit-restore window parameter,
and how they affect the behavior of quit-restore-window.
Eli Zaretskii [Sat, 25 Mar 2017 16:12:07 +0000 (19:12 +0300)]
Support in ispell.el multiple dictionaries loaded by Hunspell
* lisp/textmodes/ispell.el (ispell-find-hunspell-dictionaries):
Support Hunspell configurations that load more than one dictionary
by default. Doc fix. (Bug#25830)
Michael Albinus [Sat, 25 Mar 2017 14:42:39 +0000 (15:42 +0100)]
Simplify Tramp autoloading.
* lisp/net/tramp.el (tramp-completion-file-name-handler):
Simplify autoloading. Give it the `operations' property.
(tramp-completion-handle-expand-file-name): Remove.
Eli Zaretskii [Sat, 25 Mar 2017 13:59:17 +0000 (16:59 +0300)]
Fix a segfault due to failure to realize some faces
* src/xdisp.c (redisplay_internal): If the frame becomes garbaged
while redisplaying its windows, redisplay all of its windows
again. (Bug#26097)
(init_iterator): When freeing all realized faces on all frames,
reset the 'face_change' flag of the frame whose window we are
about to iterate.
Helmut Eller [Sun, 2 Mar 2014 15:35:33 +0000 (16:35 +0100)]
Make it easier to abort a series of tests with C-g
* emacs-lisp/ert.el (ert-run-tests): Add "interactively" arg. If
interactively is true and a test was aborted then ask if the remaining
tests should be aborted too.
(ert-run-tests-batch, ert-run-tests-interactively): Pass in
interactively arg.
Paul Eggert [Fri, 24 Mar 2017 15:09:25 +0000 (10:09 -0500)]
Don’t require chown/chgrp for game installation
Problem reported by Joseph Mingrone in:
http://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00622.html
* lib-src/Makefile.in (exp_archlibdir): Don’t fail if chown or
chgrp fails with update-game-score and the game directory.
Instead, expect the installer to fix this up afterwards.
Philipp Stephani [Tue, 28 Feb 2017 21:21:37 +0000 (22:21 +0100)]
Protect against an infloop in python-mode
There appears to be an edge case caused by using `syntax-ppss' in a
narrowed buffer during JIT lock inside of Python triple-quote strings.
Unfortunately it is impossible to reproduce without manually
destroying the syntactic information in the Python buffer, but it has
been observed in practice. In that case it can happen that the syntax
caches get sufficiently out of whack so that there appear to be
overlapping strings in the buffer. As Python has no nested strings,
this situation is impossible and leads to an infloop in
`python-nav-end-of-statement'. Protect against this by checking
whether the search for the end of the current string makes progress.
* python.el (python-nav-end-of-statement): Protect against infloop.
* progmodes/python-tests.el
(python-tests--python-nav-end-of-statement--infloop): Add unit test.