1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00
Commit Graph

204 Commits

Author SHA1 Message Date
Stefan Kangas
ba485eb949 ; Fix typos 2022-11-18 16:02:19 +01:00
Stefan Kangas
107f832577 Delete additional items obsolete since 20, 21 and 22
* 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.
2022-07-31 11:33:42 +02:00
Alan Mackenzie
ba1508ed17 CC Mode: Fix infinite loop in noise macro near end of buffer
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.
2022-06-18 11:23:06 +00:00
Alan Mackenzie
881aa943e5 CC Mode: Fix interplay between string fences and electric-pair-mode.
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.
2022-05-24 16:37:50 +00:00
Alan Mackenzie
2f68673a71 CC Mode: Restore string fence properties at each relevant external entry point
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.
2022-05-22 17:00:34 +00:00
Stefan Monnier
74100997b3 * lisp/progmodes/cc-cmds.el (indent-new-comment-line): Delete advice
This piece of advice was effective only for Emacs<20.1 and old XEmacs
(at least older than Aug 2007).
2022-04-04 15:11:46 -04:00
Eli Zaretskii
dcd76bd48d Merge from origin/emacs-28
836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year.
86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year
ebe8772f65 ; Minor fixes related to copyright years
23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye...
8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t.
19dcb237b5 ; Add 2022 to copyright years.

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	lib/cdefs.h
#	lisp/erc/erc-dcc.el
#	lisp/erc/erc-imenu.el
#	lisp/erc/erc-replace.el
#	lisp/image-dired.el
#	lisp/progmodes/xref.el
#	m4/alloca.m4
#	m4/byteswap.m4
#	m4/errno_h.m4
#	m4/getopt.m4
#	m4/gnulib-common.m4
#	m4/inttypes.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/sys_socket_h.m4
2022-01-01 07:03:03 -05:00
Eli Zaretskii
19dcb237b5 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
Alan Mackenzie
09f3ac60cc Put missing c-keep-region-active's into the source code
* lisp/progmodes/cc-cmds.el (c-beginning-of-defun): Insert
c-keep-region-active when (< arg 0).
(c-forward-conditional): Insert c-keep-region-active.
2021-10-28 17:04:06 +00:00
Stefan Kangas
0a7bab689c ; Minor stylistic fixes found by checkdoc 2021-10-05 02:06:57 +02:00
Stefan Kangas
c78e16962e ; Adjust overly long docstrings to fit 80 characters 2021-09-26 13:23:57 +02:00
Stefan Kangas
aebba085cb ; More minor stylistic fixes found by checkdoc 2021-09-22 20:26:40 +02:00
Stefan Kangas
63f419f133 ; Minor stylistic fixes found by checkdoc 2021-09-16 19:37:07 +02:00
Alan Mackenzie
31f8ae53be CC Mode: Put debug specs inside declare forms. Add missing debug specs.
* 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.
2021-04-15 10:11:20 +00:00
Alan Mackenzie
3f5fe0cdfc Convert CC Mode to lexical binding in Emacs
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 _.
2021-04-10 19:20:14 +00:00
Alan Mackenzie
f493a9bef4 CC Mode: fix c-where-wrt-brace-construct to cope with class declarations
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.
2021-04-09 20:52:49 +00:00
Alan Mackenzie
4d35faa1db CC Mode: Amend C-M-a/e to handle lambda function in C++ arglist
* 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.
2021-03-01 19:23:01 +00:00
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
Stefan Kangas
dd662fc972 Fix some over-wide docstrings
* lisp/cedet/semantic/analyze/refs.el
(semantic-analyze-refs-proto)
(semantic-analyze-refs-impl):
* lisp/cedet/semantic/symref.el
(semantic-symref-hit-to-tag-via-buffer):
* lisp/emacs-lisp/chart.el (chart-axis-draw):
* lisp/emacs-lisp/cl-macs.el (cl-defstruct, cl-loop):
* lisp/emacs-lisp/eieio-core.el (eieio--add-new-slot):
* lisp/eshell/em-unix.el (eshell/info):
* lisp/gnus/deuglify.el (gnus-outlook-rearrange-article):
* lisp/gnus/gnus-agent.el (gnus-agent-read-article-number):
* lisp/gnus/gnus-util.el (gnus-put-overlay-excluding-newlines)
(gnus-put-text-property-excluding-newlines):
* lisp/gnus/message.el (message-sort-headers):
* lisp/gnus/nntp.el (nntp-with-open-group)
(nntp-with-open-group-function):
* lisp/gnus/nnvirtual.el (nnvirtual-create-mapping):
* lisp/mail/feedmail.el (feedmail-fiddle-list-of-fiddle-plexes)
(feedmail-queue-reminder, feedmail-mail-send-hook-splitter):
* lisp/net/dictionary.el (dictionary-do-matching):
* lisp/obsolete/longlines.el (longlines-auto-wrap):
* lisp/org/ob-sql.el (org-babel-sql-dbstring-vertica):
* lisp/org/ol-bbdb.el (org-bbdb-date-list):
* lisp/progmodes/cc-cmds.el (c-mark-function):
* lisp/progmodes/cperl-mode.el (cperl-add-tags-recurse)
(cperl-add-tags-recurse-noxs-fullpath)
(cperl-add-tags-recurse-noxs):
* lisp/progmodes/etags.el (tags-search):
* lisp/progmodes/verilog-mode.el (verilog-delete-auto-buffer)
(verilog-auto-re-search-do, verilog-expand-vector-internal):
* lisp/textmodes/reftex-parse.el (reftex-init-section-numbers):
* lisp/textmodes/reftex-toc.el
(reftex-toc-load-all-files-for-promotion):
* lisp/textmodes/sgml-mode.el (html-mode):
* lisp/textmodes/table.el (table--transcoord-cache-to-table)
(table--transcoord-table-to-cache, table--remove-eol-spaces)
(table--region-in-cell-p, table-goto-bottom-right-corner)
(table-split-cell-horizontally):
* lisp/url/url-handlers.el (url-insert):
* lisp/vc/ediff-util.el (ediff-inferior-compare-regions): Fix doc
strings to not exceed 80-column limits.  (Bug#44858)
2020-12-30 12:44:19 +01:00
Alan Mackenzie
ae3904bb5d CC Mode: fix many compiler warnings which would appear with lexical binding
* lisp/progmodes/cc-align.el (three places) prefix langelem with a _.

* lisp/progmodes/cc-{cmds,engine}.el: Remove superfluous local variables.

* lisp/progmodes/cc-defs.el (c-will-be-unescaped): Remove unused parameter
end.
* lisp/progmodes/cc-engine.el (c-looking-at-decl-block): Remove unused
parameter containing-sexp.
(c-looking-at-special-brace-list); Remove unused parameter lim.
(c-add-class-syntax): Remove unused parameter paren-state.
2020-11-09 21:19:19 +00:00
Stefan Kangas
326fdb9ec0 Remove many items obsolete since Emacs 23.2 and 23.3
* lisp/allout.el (allout-init):
* lisp/emacs-lisp/shadow.el (shadows-compare-text-p):
* lisp/ffap.el (ffap-version):
* lisp/filecache.el (file-cache-choose-completion):
* lisp/help.el (print-help-return-message):
* lisp/image-mode.el (image-mode-maybe):
* lisp/imenu.el (imenu-example--name-and-position):
* lisp/international/mule-cmds.el (princ-list):
* lisp/mail/rmail.el (rmail-highlight-face):
* lisp/minibuffer.el (read-file-name-predicate):
* lisp/mouse.el (mouse-choose-completion):
* lisp/progmodes/cc-cmds.el (c-forward-into-nomenclature):
* lisp/progmodes/xscheme.el
(advertised-xscheme-send-previous-expression):
* lisp/simple.el (completion-base-size)
(choose-completion-delete-max-match, exchange-dot-and-mark):
* lisp/subr.el (eval-next-after-load):
* lisp/term.el (term-dynamic-simple-complete):
Remove items, obsolete since Emacs 23.2 and 23.3.
* doc/misc/cc-mode.texi (Movement Commands): Doc fix.
* doc/lispref/help.texi (Accessing Documentation):
* lisp/emacs-lisp/edebug.el (edebug-wrap-def-body):
* lisp/comint.el (comint-dynamic-list-completions):
* lisp/progmodes/idlwave.el (idlwave-make-modified-completion-map-xemacs)
(idlwave-make-modified-completion-map-emacs)
(idlwave-choose-completion):
* lisp/progmodes/vhdl-mode.el:
* lisp/term.el (term-dynamic-list-completions):
Remove references to 'mouse-choose-completion'.
* lisp/image-mode.el (image-mode-to-text):
Remove reference to 'image-mode-maybe'.
* lisp/mail/rmail.el (rmail-highlight-headers):
Use 'rmail-highlight' face instead of 'rmail-highlight-face'.
* lisp/progmodes/antlr-mode.el (antlr-mode-map, antlr-mode-menu):
Remove reference to 'c-forward-into-nomenclature'.
* lisp/simple.el (choose-completion, choose-completion-string)
(completion-list-mode, completion-setup-function): Don't use
'completion-base-size'.
; * etc/NEWS: List removed items.

This was discussed in
https://lists.gnu.org/archive/html/emacs-devel/2020-08/msg00400.html
2020-08-24 04:09:47 +02:00
Alan Mackenzie
35a13fca32 CC Mode: allow specified directives (e.g. pragma) to be indented as statements
* 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.
2020-03-08 16:21:15 +00:00
Stefan Monnier
cdede988b4 * lisp/progmodes/cc-cmds.el: Don't use local vars as symbols
(c--call-post-self-insert-hook-more-safely-1): Avoid `add-hook` and
`run-hooks` on local vars.  Avoid O(n^2) while we're at it.
2020-01-20 09:50:32 -05:00
Alan Third
1787b86b89 Add ability to find ObjC method names
* lisp/progmodes/cc-cmds.el (c-defun-name-1): Add Objective-C method
name ability.
2020-01-18 15:35:17 +00:00
Paul Eggert
365e01cc9f Update copyright year to 2020
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2020-01-01 00:59:52 +00:00
Alan Mackenzie
68d4a14fd4 CC Mode: Allow most functions on post-self-insert-hook to be called
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.
2019-12-07 18:55:19 +00:00
Alan Mackenzie
b293aa91bc CC Mode. Allow fontification of "wrong" style comments with warning face.
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.
2019-11-09 12:09:30 +00:00
Alan Mackenzie
25ed447b7b CC Mode: Fix positioning of point whilst inserting comments without non-ws
* 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.
2019-10-25 20:11:48 +00:00
Alan Mackenzie
55fdbec443 CC-Mode: Remove unneeded backslashes from doc strings and regular expressions
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.
2019-10-12 09:30:23 +00:00
Paul Eggert
89c63b3522 New function time-convert
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).
2019-08-05 18:37:29 -07:00
Alan Mackenzie
dcba39b445 CC Mode. Fix (c-beginning-of-defun -1) getting stuck with structs.
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.
2019-07-28 13:30:38 +00:00
Paul Eggert
ae4bfd52de Don’t assume CURRENT_TIME_LIST
* lisp/progmodes/cc-cmds.el (c-progress-init)
(c-progress-update):
* lisp/progmodes/cperl-mode.el (cperl-time-fontification):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Don’t assume (current-time) returns a list.
Fix unlikely bug if we’re called 65536 seconds apart.
2019-02-13 00:51:15 -08: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
João Távora
be505726b6 Fix electric-pair-tests by disabling bug#33794's fix with a variable
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.
2019-01-17 18:49:10 +00:00
Alan Mackenzie
223e7b8787 Make CC Mode and electric-pair-mode work together. This fixes bug #33794
* 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.
2019-01-15 15:54:02 +00:00
Paul Eggert
ba809612c0 Merge from origin/emacs-26
2fcf2df Fix copyright years by hand
26bed8b Update copyright year to 2019
2814292 Fix value of default frame height.  (Bug#33921)
2018-12-31 17:57:29 -08:00
Paul Eggert
26bed8ba10 Update copyright year to 2019
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
2019-01-01 01:01:13 +00:00
Alan Mackenzie
aba7910e36 Add ~44 edebug specs to CC Mode.
* 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.
2018-10-15 00:45:24 +00:00
Alan Mackenzie
3266e69dab c-where-wrt-brace-construct: deal with point following a struct's semicolon.
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.
2018-08-27 19:49:25 +00:00
Alan Mackenzie
5c642b2dc1 CC Mode: make c-display-defun-name work with a pointer return type.
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.
2018-08-26 11:05:22 +00:00
Alan Mackenzie
a718e1593a Fix some errors in c-display-defun-name when the type is "struct {..}", etc.
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.
2018-01-28 17:53:07 +00:00
Glenn Morris
bea8dc81eb ; lisp/progmodes/cc-cmds.el: Comment. 2018-01-10 13:48:20 -05:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Alan Mackenzie
735c8b516e Make c-defun-name analyze more thoroughly a function type which is a struct
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.
2017-11-21 18:06:11 +00:00
Alan Mackenzie
a0d30d6369 Introduce a function to CC Mode which displays the current function name
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.
2017-11-03 19:45:17 +00:00
Alan Mackenzie
b7c4aa951c Refactor c-forward-token-2 with new function c-forward-over-token-and-ws.
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.
2017-10-22 14:18:20 +00:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
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.
2017-09-13 15:54:37 -07:00
Alan Mackenzie
dde7f2d48b Fix some bugs in c-defun-name. This fixes bug #25623.
* lisp/progmodes/cc-cmds.el (c-defun-name): Fix some bugs to do with structs,
etc.
2017-07-12 20:15:56 +00:00
Stefan Monnier
2fb15dcbbb * lisp/progmodes/cc-cmds.el: Remove unused vars
(c-syntactic-context): Declare as dynbound.
(c-beginning-of-defun, c-end-of-defun): Remove unused var `start'.
2017-07-04 22:00:35 -04:00