* lisp/font-lock.el (font-lock-reference-face): Delete variable
alias obsolete since 20.3.
* lisp/progmodes/cc-cmds.el (c-toggle-auto-state): Delete alias
obsolete since 22.1.
* lisp/replace.el (query-replace-regexp-eval): Delete function
obsolete since 22.1.
(replace-count, replace-re-search-function): Doc fixes; adjust for
above deleted function.
This fixes bug #55771. Also fix an inaccuracy in c-defun-name-1 with the same
cause.
* lisp/progmodes/cc-cmds.el (c-defun-name-1)
* lisp/progmodes/cc-engine.el (c-forward-noise-clause): Check the return
value of c-forward-token-2 and act upon it when not zero.
This is an amendment to the fix for bug #55230.
* lisp/progmodes/cc-defs.el: (c-with-string-fences): Add an edebug spec.
* lisp/progmodes/cc-cmds.el: (c-electric-pound, c-electric-brace)
(c-electric-slash, c-electric-star, c-electric-semi&comma, c-electric-colon)
(c-electric-lt-gt, c-electric-paren): Put the final
c--call-post-self-insert-hook-more-safely outside of the functions'
c-with-string-fences.
(c-electric-brace, c-electric-lt-gt, c-electric-paren): Put the calls to
electric-pair-post-self-insert-function outside of c-with-string-fences.
This fixes bug #55230.
* lisp/progmodes/cc-defs.el (c-string-fences-set-flag, c-with-string-fences):
New variable and macro.
* lisp/progmodes/cc-mode.el (c-called-from-text-property-change-p): Add
remove-text-properties to the list of accepted functions.
(c-clear-string-fences, c-restore-string-fences): Surround the functions'
innards with c-save-buffer-state to prevent text property changes causing
change functions to be called.
(c-before-change, c-after-change, c-font-lock-fontify-region): Replace the
explicit calls to c-restore-string-fences and c-clear-string-fences with
invocations of the new macro c-with-string-fences.
* lisp/progmodes/cc-awk.el (c-awk-extend-and-syntax-tablify-region)
(c-awk-end-of-defun)
* lisp/progmodes/cc-cmds.el (c-show-syntactic-information)
(c-electric-backspace, c-hungry-delete-backwards, c-electric-delete-forward)
(c-hungry-delete-forward, c-electric-pound, c-electric-brace)
(c-electric-slash, c-electric-star, c-electric-semi&comma, c-electric-colon)
(c-electric-lt-gt, c-electric-paren, c-beginning-of-defun, c-end-of-defun)
(c-display-defun-name, c-mark-function, c-beginning-of-statement)
(c-end-of-statement, c-indent-command, c-indent-exp, c-indent-defun)
(c-indent-line-or-region, c-fill-paragraph, c-indent-new-comment-line)
(c-context-line-break)
* lisp/progmodes/cc-guess.el (c-guess-region-no-install): These are all
"boundary" functions to CC Mode. Surround each by c-with-string-fences.
* lisp/progmodes/cc-bytecomp.el, lisp/progmodes/cc-cmds.el,
lisp/progmodes/cc-defs.el, lisp/progmodes/cc-engine.el,
lisp/progmodes/cc-fonts.el, lisp/progmodes/cc-langs.el,
lisp/progmodes/cc-mode.el: Change the explicit def-edebug-spec for many macros
into a (declare (debug ...) ..) form. Add such forms to macros which were
previously lacking def-edebug-spec forms.
lisp/progmodes/cc-align.el, lisp/progmodes/cc-awk.el,
lisp/progmodes/cc-bytecomp.el, lisp/progmodes/cc-cmds.el,
lisp/progmodes/cc-defs.el, lisp/progmodes/cc-engine.el,
lisp/progmodes/cc-fonts.el, lisp/progmodes/cc-guess.el,
lisp/progmodes/cc-langs.el, lisp/progmodes/cc-menus.el,
lisp/progmodes/cc-mode.el, lisp/progmodes/cc-styles.el,
lisp/progmodes/cc-subword.el, lisp/progmodes/cc-vars.el: Mark these files with
a `lexical-binding' setting in line 1.
lisp/progmodes/cc-align.el, lisp/progmodes/cc-engine.el,
lisp/progmodes/cc-vars.el (c-syntactic-context, c-syntactic-element): Declare
these as special variables.
lisp/progmodes/cc-bytecomp.el (cc-bytecomp-debug-msg): prefix the parameter
ARGS with a _, and remove an `ignore' call.
lisp/progmodes/cc-cmds.el (c-where-wrt-brace-construct): Remove `kluge-start',
an unused variable.
(c-while-widening-to-decl-block): Add an extra parameter, which suppresses
the generation of a setting of variable `where'.
(c-defun-name-and-limits): Remove variable `where' from the function and use
the new argument to the previous macro.
lisp/progmodes/cc-engine.el (c-cache-to-parse-ps-state): Remove two unneeded
variables, `last' and `intermediate'.
lisp/progmodes/cc-fonts.el (c-font-lock-c++-using): Remove unused variable.
lisp/progmodes/cc-langs.el (c-vsemi-status-unknown-p-fn): Replace the doc
string with the more precise one from stand-alone CC Mode.
lisp/progmodes/cc-styles.el (c-set-offset): Give the `ignored' parameter a
leading _.
Make the function correctly recognize a brace block preceded by an
introductory line without a parameter list.
* lisp/progmodes/cc-cmds.el (c-where-wrt-brace-contruct): Reintroduce the use
of c-beginning-of-decl-1, which was removed some weeks ago, in place of a
c-syntactic-skip-backward. Reformulate the code generally.
* lisp/progmodes/cc-cmds.el (c-where-wrt-brace-construct): Reformulate latter
part such that the least enclosing braces and parentheses are used when
determining containment in such. c-beginning-of-decl-1 has been superseded
by list movement and syntactic whitespace movement.
(c-backward-to-nth-BOF-{): Work on least enclosing parens rather than parens
at any level when moving back to an opening brace.
(c-forward-to-nth-EOF-\;-or-}): Work on least enclosing parens, as above.
Move the correction of point when in a "function trailer" to after the main
loop, correcting a minor bug.
* lisp/progmodes/cc-cmds.el (c-align-cpp-indent-to-body)
(c-cpp-indent-to-body-flag, c-electric-pragma)
(c-add-indent-to-body-to-abbrev-table, c-clear-stale-indent-to-body-abbrevs)
(c-toggle-cpp-indent-to-body): New functions and variables.
* lisp/progmodes/cc-langs.el (c-std-abbrev-keywords): New lang const/var.
* lisp/progmodes/cc-mode.el (c-populate-abbrev-table): New function.
(c-basic-common-init): call the c-populate-abbrev-table.
(c-mode, c++-mode, objc-mode, java-mode, idl-mode, pike-mode, awk-mode):
Remove the setting of MODE-abbrev-table.
* lisp/progmodes/cc-vars.el (c-cpp-indent-to-body-directives): New defcustom.
* doc/misc/cc-mode.texi (Custom Macros): Introduce and refer to ....
(Indenting Directives): New page documenting the new mechanism.
This contrasts with the previous state where no such functions got called.
This fixes bug #38406.
* lisp/progmodes/cc-cmds.el (c--unsafe-post-self-insert-hook-functions): New
variable.
(c--call-post-self-insert-hook-more-safely-1): New function.
(c--call-post-self-insert-hook-more-safely): New macro.
(c-electric-pound, c-electric-brace, c-electric-slash, c-electric-star)
(c-electric-semi&comma, c-electric-colon, c-electric-lt-gt, c-electric-paren):
Invoke c--call-post-self-insert-hook-more-safely (which calls most of the hook
post-self-insert-hook) at the end of each of the commands.
This fixes bug #4192.
* etc/NEWS: Add a new entry.
* lisp/progmodes/cc-defs.el (c-font-lock-flush): New macro.
* lisp/progmodes/cc-cmds.el (c-toggle-comment-style): On toggling the comment
style, invoke c-font-lock-flush when c-mark-wrong-style-of-comment is non-nil,
to cause that marking to be done instead on the other style of comment.
* lisp/progmodes/cc-fonts.el (c-maybe-font-lock-wrong-style-comments): New
function.
(c-cpp-matchers): Call c-maybe-font-lock-wrong-style-comments when
appropriate.
* lisp/progmodes/cc-vars.el (c-mark-wrong-style-of-comment): New customizable
option.
* doc/misc/cc-mode.texi (top level, Indentation Commands, Guessing the Style,
Custom Macros): For some opening quote marks, correct '' to ``.
(Minor Modes): Add an xref to the new page "Wrong Comment Style" in a
footnote.
(Wrong Comment Style): New page.
* lisp/progmodes/cc-cmds.el (c-guess-fill-prefix): When determining a new
block comment prefix (i.e. there isn't one already there to copy), and that
prefix is hard up against a comment closer, ensure there are at least two
spaces before the closer.
(c-indent-new-comment-line): Amend the strategy for ensuring that point isn't
left hard up against the comment closer after M-j.
Also make miscellaneous amendments.
* lisp/progmodes/cc-align.el, lisp/progmodes/cc-cmds.el
* lisp/progmodes/cc-defs.el, lisp/progmodes/cc-engine.el
* lisp/progmodes/cc-langs.el, lisp/progmodes/cc-vars.el: Remove lots of
unneeded backslashes.
* lisp/progmodes/cc-langs.el (c-string-innards-re-alist): Remove redundant
"\\|\r" from regular expression.
* lisp/progmodes/cc-mode.el (c-make-mode-syntax-table): Correct the name of
the hook normal-erase-is-backspace-MODE-hook from a non-existant hook name.
This replaces the awkward reuse of encode-time to both convert
calendrical timestamps to Lisp timestamps, and to convert Lisp
timestamps to other forms. Now, encode-time does just the
former and the new function does just the latter.
The new function builds on a suggestion by Lars Ingebrigtsen in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00801.html
and refined by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00803.html
* doc/lispref/os.texi (Time of Day, Time Conversion):
* doc/misc/emacs-mime.texi (time-date):
* etc/NEWS: Update documentation.
* lisp/calendar/cal-dst.el (calendar-next-time-zone-transition):
* lisp/calendar/time-date.el (seconds-to-time, days-to-time):
* lisp/calendar/timeclock.el (timeclock-seconds-to-time):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-add-item):
* lisp/emacs-lisp/cl-extra.el (cl--random-time):
* lisp/emacs-lisp/timer.el (timer--time-setter)
(timer-next-integral-multiple-of-time):
* lisp/find-lisp.el (find-lisp-format-time):
* lisp/gnus/gnus-diary.el (gnus-user-format-function-d):
* lisp/gnus/gnus-group.el (gnus-group-set-timestamp):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-show-org-agenda):
* lisp/gnus/nnrss.el (nnrss-normalize-date):
* lisp/gnus/nnspool.el (nnspool-request-newgroups):
* lisp/net/ntlm.el (ntlm-compute-timestamp):
* lisp/net/pop3.el (pop3-uidl-dele):
* lisp/obsolete/vc-arch.el (vc-arch-add-tagline):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-clock-in)
(org-clock-out, org-clock-sum):
* lisp/org/org-id.el (org-id-uuid, org-id-time-to-b36):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cc-cmds.el (c-progress-init)
(c-progress-update):
* lisp/progmodes/cperl-mode.el (cperl-time-fontification):
* lisp/progmodes/flymake.el (flymake--schedule-timer-maybe):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
* lisp/tar-mode.el (tar-octal-time):
* lisp/time.el (emacs-uptime):
* lisp/url/url-auth.el (url-digest-auth-make-cnonce):
* lisp/url/url-util.el (url-lazy-message):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg-state-fast):
* lisp/xt-mouse.el (xterm-mouse-event):
* test/lisp/emacs-lisp/timer-tests.el:
(timer-next-integral-multiple-of-time-2):
Use time-convert, not encode-time.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
Don’t use now-removed FORM argument for encode-time.
It wasn’t crucial anyway.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add time-convert.
* lisp/emacs-lisp/elint.el (elint-unknown-builtin-args):
Update encode-time signature to match current arg set.
* lisp/emacs-lisp/timer.el (timer-next-integral-multiple-of-time):
Use timer-convert with t rather than doing it by hand.
* src/timefns.c (time_hz_ticks, time_form_stamp, lisp_time_form_stamp):
Remove; no longer needed.
(decode_lisp_time): Rturn the form instead of having a *PFORM arg.
All uses changed.
(time_arith): Just return TICKS if HZ is 1.
(Fencode_time): Remove argument FORM. All callers changed.
Do not attempt to encode time values; just encode
decoded (calendrical) times.
Unless CURRENT_TIME_LIST, just return VALUE since HZ is 1.
(Ftime_convert): New function, which does the time value
conversion that bleeding-edge encode-time formerly did.
Return TIME if it is easy to see that it is already
of the correct form.
(Fcurrent_time): Mention in doc that the form is planned to change.
* test/src/timefns-tests.el (decode-then-encode-time):
Don’t use (encode-time nil).
In particular, with an initialization such as struct foo {..} bar = {...};
* lisp/progmodes/cc-cmds.el (c-forward-to-nth-EOF-{): Rename to
c-forward-to-nth-EOF-\;-or-}, and when the starting (or ending) position is in
the "variable" part of a struct/class/union/enum/etc., move to after the
terminating semicolon. Adjust the counting such that N only gets decremented
on a successful movement over {..}.
(c-beginning-of-defun, c-end-of-defun): Rename the calls to
c-forward-to-nth-EOF-}, as above.
* 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.
The variable c--disable-fix-of-bug-33794, which should be removed in
the short term in favor of a permanent solution, is introduced.
It is bound to nil by default. This means that breakage is still
happening in actual c-mode and c++-mode usage, though the tests no
longer show it.
To get around this breakage, put
(setq c--disable-fix-of-bug-33794 t)
In your init file. Evidently, you will lose the fix for bug#33794,
but that only affects a small corner case of c-toggle-auto-newline,
which is not turned on by default.
See https://lists.gnu.org/archive/html/emacs-devel/2019-01/msg00360.html
for more information.
* lisp/progmodes/cc-cmds.el (c--disable-fix-of-bug-33794): New
variable.
(c--with-post-self-insert-hook-maybe): New macro.
(c-electric-pound, c-electric-brace, c-electric-slash)
(c-electric-star, c-electric-semi&comma, c-electric-colon)
(c-electric-lt-gt, c-electric-paren): Use it.
(c-electric-paren, c-electric-brace): Check
c--disable-fix-of-bug-33794.
* test/lisp/electric-tests.el (c--disable-fix-of-bug-33794):
Forward declare.
(electric-pair-test-for)
(electric-layout-int-main-kernel-style)
(electric-modes-in-c-mode-with-self-insert-command): Use it.
* lisp/progmodes/cc-cmds.el (c-electric-pound, c-electric-slash)
(c-electric-star, c-electric-semi&comma, c-electric-colon, c-electric-lt-gt):
Bind post-self-insert-hook to nil around calls to self-insert-command to
protect against arbitrary functionality confusing CC Mode.
(c-do-brace-electrics): New function, extracted from c-electric-brace and
enhanced.
(c-electric-brace): Bind post-self-insert-hook to nil around the call to
self-insert-command. When electric-pair-mode is configured, call
electric-pair-post-self-insert-function. Handle any deletion done by this
function. Call c-do-brace-electrics for the inserted brace, and perhaps for a
brace inserted by electric-pair-self-insert-function.
(c-electric-paren): Bind post-self-insert-hook to nil around the call to
self-insert-command. When electric-pair-mode is configured, call
electric-pair-post-self-insert-function.
* lisp/progmodes/cc-cmds.el, lisp/progmodes/cc-defs.el
lisp/progmodes/cc-engine.el, lisp/progmodes/cc-fonts.el
lisp/progmodes/cc-langs.el: Add lots of edebug specs.
* lisp/progmodes/cc-engine.el (c-state-maybe-marker): Tidy up so as to
evaluate an argument only once at runtime.
More precisely, when point is right after the terminating semicolon of a
construct like "struct foo { .... } bar;", the function must return
'at-function-end.
* lisp/progmodes/cc-cmds.el (c-where-wrt-brace-construct): Surround an
existing test for 'at-function-end with an `or' form, the other arm testing
for being after the semicolon above.
Fixes bug #32403.
* lisp/progmodes/cc-cmds.el (c-in-function-trailer-p): No longer insist on
c-beginning-of-decl-1 returning 'same.
(c-where-wrt-brace-construct): Tighten up the test for looking at a symbol by
excluding keywords. When point is after a }, do not return 'at-function-end
for a struct/union/class/...
(c-defun-name-1): Considerably simplify, by amalgamating the two cond arms
which find structs etc., and by using functions like c-forward-declarator
rather than the faulty analysis of the source by hand.
Also fix some errors with c-display-defun-name when there are nested classes.
* lisp/progmodes/cc-cmds.el (c-in-function-trailer-p): Deal with a struct {..}
being merely the type of a function.
(c-where-wrt-brace-construct): Deal with a struct {..} being merely the type
of a function. Rearrange the order of some Lisp forms. Insert a check for
c-protection-key ("private", etc.) alongside the checking for a label.
(c-defun-name-1): New function extracted form c-defun-name, which works within
the existing restriction. Don't regard 'at-function-end as being within the
defun any more. Recognize "struct", etc., with the new
c-defun-type-name-decl-key rather than c-type-prefix-key. Make the
recognition of a normal function more accurate.
(c-defun-name): Part left after extracting the above function. It now just
widens and calls c-defun-name-1.
(c-declaration-limits-1): New function extracted from c-declaration-limits,
which works within the existing restriction. Move LIM back one block to
account for the possibility of struct {..} as a function type. Check we're
not inside a declaration without braces.
(c-declaration-limits): Part left after extracting the above function. It now
just narrows to an enclosing decl block and calls c-declaration-limits-1.
(c-defun-name-and-limits): New function which identifies the name and limits
of the most nested enclosing declaration or macro.
(c-display-defun-name): Use c-defun-name-and-limits rather than two separate
functions (which didn't always agree on which function).
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1): If we have struct
{..} as the type of a function, go back over this, too.
* lisp/progmodes/cc-langs.el (c-defun-type-name-decl-kwds)
(c-defun-type-name-decl-key): New lang const/var.
This fixes bug #29293.
* lisp/progmodes/cc-cmds.el (c-defun-name): When a struct (etc.) type is
encountered, check whether it is the return type of a function rather than a
declaration of the struct itself. Similarly adapt the cond arm which deals
with functions properly to recognize struct return types.
Remove an erroneous interactive specification from two functions.
* lisp/progmodes/cc-cmds.el (c-display-defun-name): New command.
(c-defun-name, c-cpp-define-name): Remove interactive specification.
* lisp/progmodes/cc-mode.el (c-mode-base-map): Add binding C-c C-z for the new
command.
* doc/misc/cc-mode.texi (Other Commands): Add documentation for the new
command.
Use the new function directly in several places where c-forward-token-2
wouldn't move over the last token in the buffer. This caused an infinite loop
in c-restore-<>-properties.
* lisp/progmodes/cc-engine.el (c-forward-over-token-and-ws): New function,
extracted from c-forward-token-2.
(c-forward-token-2): Refactor, calling the new function.
(c-restore-<>-properties): Fix infinite loop.
(c-forward-<>-arglist-recur, c-in-knr-argdecl)
(c-looking-at-or-maybe-in-bracelist): Call the new function directly in place
of c-forward-token-2.
* lisp/progmodes/cc-cmds.el (c-defun-name) Call the new function directly in
place of c-forward-token-2.
* lisp/progmodes/cc-fonts.el (c-font-lock-enclosing-decls): Call the new
function directly in place of c-forward-token-2.
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November. Change these FTP URLs to https://ftp.gnu.org
instead. Make similar changes for URLs to other organizations moving
away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.