+2014-08-28 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * progmodes/cc-defs.el: Expose c-lanf-defconst's expressions to the
+ byte-compiler.
+ (lookup-syntax-properties): Silence byte-compiler.
+ (c-lang-defconst): Quote the code with `lambda' rather than with
+ `quote'.
+ (c-lang-const): Avoid unneeded setq.
+ (c-lang-constants-under-evaluation): Add docstring.
+ (c-lang--novalue): New constant.
+ (c-find-assignment-for-mode): Use it instead of c-lang-constants.
+ (c-get-lang-constant): Same here.
+ Get the mode's value using `funcall' now that the code is quoted
+ with `lambda'.
+
2014-08-28 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-handle-shell-command): Use `display-buffer'.
* progmodes/cc-fonts.el (c-font-lock-declarations): Handle the
"decltype" keyword.
(c-font-lock-c++-new): Handle "decltype" constructions.
- * progmodes/cc-langs.el (c-auto-ops, c-auto-ops-re): New
- c-lang-defconsts/defvars.
+ * progmodes/cc-langs.el (c-auto-ops, c-auto-ops-re):
+ New c-lang-defconsts/defvars.
(c-haskell-op, c-haskell-op-re): New c-lang-defconsts/defvars.
(c-typeof-kwds, c-typeof-key): New c-lang-defconsts/defvars.
(c-typeless-decl-kwds): Append "auto" onto the C++ value.
off from c->-op-cont-re.
(c->-op-cont-tokens): Change to use the above.
(c->-op-without->-cont-regexp): New lang-const.
- * progmodes/cc-engine.el (c-forward-<>-arglist-recur): Use
- c->-op-without->-cont-regexp in place of c->-op-cont-tokens.
+ * progmodes/cc-engine.el (c-forward-<>-arglist-recur):
+ Use c->-op-without->-cont-regexp in place of c->-op-cont-tokens.
2014-08-23 Alan Mackenzie <acm@muc.de>
2014-08-21 Eli Zaretskii <eliz@gnu.org>
- * textmodes/texnfo-upd.el (texinfo-specific-section-type): Don't
- recognize a Top node if there are other sectioning commands
+ * textmodes/texnfo-upd.el (texinfo-specific-section-type):
+ Don't recognize a Top node if there are other sectioning commands
earlier in the Texinfo file. This fixes a bug in
texinfo-make-menu and avoids inflooping in
texinfo-all-menus-update when they are invoked on texinfo.texi.
2014-08-12 Stefan Monnier <monnier@iro.umontreal.ca>
- * mpc.el (mpc-reorder): Don't bother splitting the "active"s elements
+ * mpc.el (mpc-reorder): Don't bother splitting the "active" elements
to the first part if they're the same as the selection.
2014-08-12 Lars Magne Ingebrigtsen <larsi@gnus.org>
2014-08-07 Leo Liu <sdl.web@gmail.com>
- * help.el (temp-buffer-setup-hook,temp-buffer-show-hook): Revert
- change on 2014-03-22.
+ * help.el (temp-buffer-setup-hook,temp-buffer-show-hook):
+ Revert change on 2014-03-22.
2014-08-06 Ulf Jasper <ulf.jasper@web.de>
* progmodes/python.el: Fix completions inside (i)pdb.
(python-shell-completion-pdb-string-code): Make obsolete.
- (python-shell-completion-get-completions): Use
- python-shell-completion-string-code resending setup code
+ (python-shell-completion-get-completions):
+ Use python-shell-completion-string-code resending setup code
continuously for (i)pdb.
2014-08-04 Paul Eggert <eggert@cs.ucla.edu>
2014-08-02 Alan Mackenzie <acm@muc.de>
- Fix confusion in C++ file caused by comma in "= {1,2},". Bug
- #17756.
+ Fix confusion in C++ file caused by comma in "= {1,2},".
+ Bug #17756.
* progmodes/cc-engine.el (c-beginning-of-statement-1): In checking
for a statement boundary marked by "}", check there's no "="
before the "{".
2014-07-30 Christophe Deleuze <christophe.deleuze@free.fr> (tiny change)
- * calendar/icalendar.el (icalendar--decode-isodatetime): Use
- actual current-time-zone when converting to local time. (Bug#15408)
+ * calendar/icalendar.el (icalendar--decode-isodatetime):
+ Use actual current-time-zone when converting to local time. (Bug#15408)
2014-07-29 Martin Rudalics <rudalics@gmx.at>
2014-07-28 Fabián Ezequiel Gallina <fgallina@gnu.org>
Grab all Python process output before inferior-python-mode hooks.
- * progmodes/python.el (inferior-python-mode): Call
- accept-process-output and sit-for to ensure all output for process
+ * progmodes/python.el (inferior-python-mode):
+ Call accept-process-output and sit-for to ensure all output for process
has been received before running hooks.
- (python-shell-internal-get-or-create-process): Cleanup
- accept-process-output and sit-for calls.
+ (python-shell-internal-get-or-create-process):
+ Cleanup accept-process-output and sit-for calls.
2014-07-28 Fabián Ezequiel Gallina <fgallina@gnu.org>
More robust shell startup and code setup.
- * progmodes/python.el (python-shell-make-comint): Remove
- accept-process-output call.
+ * progmodes/python.el (python-shell-make-comint):
+ Remove accept-process-output call.
(python-shell-get-buffer): Return current buffer if major-mode is
inferior-python-mode.
(python-shell-get-or-create-process): Use it.
2014-07-27 Eli Zaretskii <eliz@gnu.org>
- * scroll-bar.el (scroll-bar-toolkit-horizontal-scroll): Add
- rudimentary support for bidirectional text.
+ * scroll-bar.el (scroll-bar-toolkit-horizontal-scroll):
+ Add rudimentary support for bidirectional text.
2014-07-27 Martin Rudalics <rudalics@gmx.at>
(linum-update-window): Use it to adjust margin to linum's width.
* leim/quail/sisheng.el (sisheng-list): Don't bother with-case-table.
- * eshell/em-smart.el (eshell-smart-scroll-window): Use
- with-selected-window.
+ * eshell/em-smart.el (eshell-smart-scroll-window):
+ Use with-selected-window.
* xt-mouse.el (xterm-mouse-translate-1): Intern drag event (bug#17894).
Remove also pointless window&mark manipulation.
2014-03-23 Lars Ingebrigtsen <larsi@gnus.org>
* calendar/parse-time.el (parse-time-iso8601-regexp)
- (parse-iso8601-time-string): Copied from `url-dav' so that we can use
+ (parse-iso8601-time-string): Copy from `url-dav' so that we can use
it more generally.
2014-03-23 Lars Ingebrigtsen <larsi@gnus.org>
* help-at-pt.el (help-at-pt-string, help-at-pt-maybe-display):
Also try to display local help from just before point.
-2014-02-02 Alan Mackenzie <bug-cc-mode@gnu.org>
+2014-02-02 Alan Mackenzie <acm@muc.de>
c-parse-state. Don't "append-lower-brace-pair" in certain
circumstances. Also fix an obscure bug where "\\s!" shouldn't be
(cc-bytecomp-defvar open-paren-in-column-0-is-defun-start)
+(defvar lookup-syntax-properties) ;XEmacs.
+
(defconst c-emacs-features
(let (list)
(error "Unknown base mode `%s'" base-mode))
(put mode 'c-fallback-mode base-mode))
-(defvar c-lang-constants (make-vector 151 0))
-;; This obarray is a cache to keep track of the language constants
-;; defined by `c-lang-defconst' and the evaluated values returned by
-;; `c-lang-const'. It's mostly used at compile time but it's not
-;; stored in compiled files.
-;;
-;; The obarray contains all the language constants as symbols. The
-;; value cells hold the evaluated values as alists where each car is
-;; the mode name symbol and the corresponding cdr is the evaluated
-;; value in that mode. The property lists hold the source definitions
-;; and other miscellaneous data. The obarray might also contain
-;; various other symbols, but those don't have any variable bindings.
+(defvar c-lang-constants (make-vector 151 0)
+ "Obarray used as a cache to keep track of the language constants.
+The constants stored are those defined by `c-lang-defconst' and the values
+computed by `c-lang-const'. It's mostly used at compile time but it's not
+stored in compiled files.
+
+The obarray contains all the language constants as symbols. The
+value cells hold the evaluated values as alists where each car is
+the mode name symbol and the corresponding cdr is the evaluated
+value in that mode. The property lists hold the source definitions
+and other miscellaneous data. The obarray might also contain
+various other symbols, but those don't have any variable bindings.")
(defvar c-lang-const-expansion nil)
pre-files)
(or (symbolp name)
- (error "Not a symbol: %s" name))
+ (error "Not a symbol: %S" name))
(when (stringp (car-safe args))
;; The docstring is hardly used anywhere since there's no normal
(setq args (cdr args)))
(or args
- (error "No assignments in `c-lang-defconst' for %s" name))
+ (error "No assignments in `c-lang-defconst' for %S" name))
;; Rework ARGS to an association list to make it easier to handle.
;; It's reversed at the same time to make it easier to implement
((listp (car args))
(mapcar (lambda (lang)
(or (symbolp lang)
- (error "Not a list of symbols: %s"
+ (error "Not a list of symbols: %S"
(car args)))
(intern (concat (symbol-name lang)
"-mode")))
(car args)))
- (t (error "Not a symbol or a list of symbols: %s"
+ (t (error "Not a symbol or a list of symbols: %S"
(car args)))))
val)
(or (cdr args)
- (error "No value for %s" (car args)))
+ (error "No value for %S" (car args)))
(setq args (cdr args)
val (car args))
;; dependencies on the `c-lang-const's in VAL.)
(setq val (macroexpand-all val))
- (setq bindings (cons (cons assigned-mode val) bindings)
+ (setq bindings `(cons (cons ',assigned-mode (lambda () ,val)) ,bindings)
args (cdr args))))
;; Compile in the other files that have provided source
(mapcar 'car (get sym 'source))))
`(eval-and-compile
- (c-define-lang-constant ',name ',bindings
+ (c-define-lang-constant ',name ,bindings
,@(and pre-files `(',pre-files))))))
(put 'c-lang-defconst 'lisp-indent-function 1)
quoted."
(or (symbolp name)
- (error "Not a symbol: %s" name))
+ (error "Not a symbol: %S" name))
(or (symbolp lang)
- (error "Not a symbol: %s" lang))
+ (error "Not a symbol: %S" lang))
(let ((sym (intern (symbol-name name) c-lang-constants))
- mode source-files args)
+ (mode (when lang (intern (concat (symbol-name lang) "-mode")))))
- (when lang
- (setq mode (intern (concat (symbol-name lang) "-mode")))
- (unless (get mode 'c-mode-prefix)
- (error
- "Unknown language %S since it got no `c-mode-prefix' property"
- (symbol-name lang))))
+ (or (get mode 'c-mode-prefix) (null mode)
+ (error "Unknown language %S: no `c-mode-prefix' property"
+ lang))
(if (eq c-lang-const-expansion 'immediate)
;; No need to find out the source file(s) when we evaluate
;; `source' property.
`',(c-get-lang-constant name nil mode)
- (let ((file (c-get-current-file)))
- (if file (setq file (intern file)))
- ;; Get the source file(s) that must be loaded to get the value
- ;; of the constant. If the symbol isn't defined yet we assume
- ;; that its definition will come later in this file, and thus
- ;; are no file dependencies needed.
- (setq source-files (nreverse
- ;; Reverse to get the right load order.
- (apply 'nconc
- (mapcar (lambda (elem)
- (if (eq file (car elem))
- nil ; Exclude our own file.
- (list (car elem))))
- (get sym 'source))))))
-
- ;; Make some effort to do a compact call to
- ;; `c-get-lang-constant' since it will be compiled in.
- (setq args (and mode `(',mode)))
- (if (or source-files args)
- (setq args (cons (and source-files `',source-files)
- args)))
-
- (if (or (eq c-lang-const-expansion 'call)
- (and (not c-lang-const-expansion)
- (not mode))
- load-in-progress
- (not (boundp 'byte-compile-dest-file))
- (not (stringp byte-compile-dest-file)))
- ;; Either a straight call is requested in the context, or
- ;; we're in an "uncontrolled" context and got no language,
- ;; or we're not being byte compiled so the compile time
- ;; stuff below is unnecessary.
- `(c-get-lang-constant ',name ,@args)
-
- ;; Being compiled. If the loading and compiling version is
- ;; the same we use a value that is evaluated at compile time,
- ;; otherwise it's evaluated at runtime.
- `(if (eq c-version-sym ',c-version-sym)
- (cc-eval-when-compile
- (c-get-lang-constant ',name ,@args))
- (c-get-lang-constant ',name ,@args))))))
-
-(defvar c-lang-constants-under-evaluation nil)
+ (let ((source-files
+ (let ((file (c-get-current-file)))
+ (if file (setq file (intern file)))
+ ;; Get the source file(s) that must be loaded to get the value
+ ;; of the constant. If the symbol isn't defined yet we assume
+ ;; that its definition will come later in this file, and thus
+ ;; are no file dependencies needed.
+ (nreverse
+ ;; Reverse to get the right load order.
+ (apply 'nconc
+ (mapcar (lambda (elem)
+ (if (eq file (car elem))
+ nil ; Exclude our own file.
+ (list (car elem))))
+ (get sym 'source))))))
+ ;; Make some effort to do a compact call to
+ ;; `c-get-lang-constant' since it will be compiled in.
+ (args (and mode `(',mode))))
+
+ (if (or source-files args)
+ (push (and source-files `',source-files) args))
+
+ (if (or (eq c-lang-const-expansion 'call)
+ (and (not c-lang-const-expansion)
+ (not mode))
+ load-in-progress
+ (not (boundp 'byte-compile-dest-file))
+ (not (stringp byte-compile-dest-file)))
+ ;; Either a straight call is requested in the context, or
+ ;; we're in an "uncontrolled" context and got no language,
+ ;; or we're not being byte compiled so the compile time
+ ;; stuff below is unnecessary.
+ `(c-get-lang-constant ',name ,@args)
+
+ ;; Being compiled. If the loading and compiling version is
+ ;; the same we use a value that is evaluated at compile time,
+ ;; otherwise it's evaluated at runtime.
+ `(if (eq c-version-sym ',c-version-sym)
+ (cc-eval-when-compile
+ (c-get-lang-constant ',name ,@args))
+ (c-get-lang-constant ',name ,@args)))))))
+
+(defvar c-lang-constants-under-evaluation nil
+ "Alist of constants in the process of being evaluated.
+The `cdr' of each entry indicates how far we've looked in the list
+of definitions, so that the def for var FOO in c-mode can be defined in
+terms of the def for that same var FOO (which will then rely on the
+fallback definition for all modes, to break the cycle).")
+
+(defconst c-lang--novalue "novalue")
(defun c-get-lang-constant (name &optional source-files mode)
;; Used by `c-lang-const'.
;; mode might have an explicit entry before that.
(eq (setq value (c-find-assignment-for-mode
(cdr source-pos) mode nil name))
- c-lang-constants)
+ c-lang--novalue)
;; Try again with the fallback mode from the
;; original position. Note that
;; `c-buffer-is-cc-mode' still is the real mode if
(eq (setq value (c-find-assignment-for-mode
(setcdr source-pos backup-source-pos)
fallback t name))
- c-lang-constants)))
+ c-lang--novalue)))
;; A simple lookup with no fallback mode.
(eq (setq value (c-find-assignment-for-mode
(cdr source-pos) mode t name))
- c-lang-constants))
+ c-lang--novalue))
(error
- "`%s' got no (prior) value in %s (might be a cyclic reference)"
+ "`%s' got no (prior) value in %S (might be a cyclic reference)"
name mode))
(condition-case err
- (setq value (eval value))
+ (setq value (funcall value))
(error
;; Print a message to aid in locating the error. We don't
;; print the error itself since that will be done later by
;; some caller higher up.
- (message "Eval error in the `c-lang-defconst' for `%s' in %s:"
+ (message "Eval error in the `c-lang-defconst' for `%S' in %s:"
sym mode)
(makunbound sym)
(signal (car err) (cdr err))))
(set sym (cons (cons mode value) (symbol-value sym)))
value))))
-(defun c-find-assignment-for-mode (source-pos mode match-any-lang name)
+(defun c-find-assignment-for-mode (source-pos mode match-any-lang _name)
;; Find the first assignment entry that applies to MODE at or after
;; SOURCE-POS. If MATCH-ANY-LANG is non-nil, entries with `t' as
;; the language list are considered to match, otherwise they don't.
;; On return SOURCE-POS is updated to point to the next assignment
;; after the returned one. If no assignment is found,
- ;; `c-lang-constants' is returned as a magic value.
+ ;; `c-lang--novalue' is returned as a magic value.
;;
;; SOURCE-POS is a vector that points out a specific assignment in
;; the double alist that's used in the `source' property. The first
match-any-lang)
(throw 'found (cdr assignment))))
- c-lang-constants)))
+ c-lang--novalue)))
(defun c-lang-major-mode-is (mode)
;; `c-major-mode-is' expands to a call to this function inside