2015-09-29 01:39:14 +03:00
|
|
|
|
;;; cl-macs.el --- Common Lisp macros -*- lexical-binding: t -*-
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2019-01-01 00:59:58 +00:00
|
|
|
|
;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Dave Gillespie <daveg@synaptics.com>
|
* lisp/emacs-lisp/package.el: Include obsolete packages from archives.
Use lexical-binding.
(package-archive-contents): Change format; include obsolete packages.
(package-desc): Use `dir' to mark builtin packages.
(package--from-builtin): Set the `dir' field to `builtin'.
(generated-autoload-file, version-control): Declare.
(package-compute-transaction): Change first arg and return value to be
lists of package-descs. Adjust to new package-archive-contents format.
(package--add-to-archive-contents): Adjust to new
package-archive-contents format.
(package-download-transaction): Arg is now a list of package-descs.
(package-install): If `pkg' is a package name, pass it as
a requirement, so it is subject to the usual (e.g. disabled) checks.
(describe-package): Accept package-desc as well.
(describe-package-1): Describe a specific package-desc. Add links to
other package-descs for the same package name.
(package-menu-describe-package): Pass the actual package-desc.
(package-menu-mode): Add to tabulated-list-revert-hook so revert-buffer
works correctly.
(package-desc-status): New function.
(package-menu--refresh): New function, extracted
from package-menu--generate.
(package-menu--generate): Use it.
(package-delete): Update package-alist.
(package-menu-execute): Don't call package-initialize.
* lisp/progmodes/idlw-toolbar.el, lisp/progmodes/idlw-shell.el,
lisp/progmodes/idlw-help.el, lisp/progmodes/idlw-complete-structtag.el,
lisp/progmodes/ebnf-yac.el, lisp/progmodes/ebnf-otz.el,
lisp/progmodes/ebnf-iso.el, lisp/progmodes/ebnf-ebx.el,
lisp/progmodes/ebnf-dtd.el, lisp/progmodes/ebnf-bnf.el,
lisp/progmodes/ebnf-abn.el, lisp/emacs-lisp/package-x.el,
lisp/emacs-lisp/cl-seq.el, lisp/emacs-lisp/cl-macs.el
lisp/cedet/data-debug.el, lisp/cedet/cedet-idutils.el:
Neuter the "Version:" header.
2013-06-25 12:13:49 -04:00
|
|
|
|
;; Old-Version: 2.02
|
1993-07-30 20:15:09 +00:00
|
|
|
|
;; Keywords: extensions
|
2010-08-29 12:17:13 -04:00
|
|
|
|
;; Package: emacs
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 03:21:21 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1993-07-30 20:15:09 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:21:21 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
1994-06-17 20:04:22 +00:00
|
|
|
|
;;; Commentary:
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;; These are extensions to Emacs Lisp that provide a degree of
|
|
|
|
|
;; Common Lisp compatibility, beyond what is already built-in
|
|
|
|
|
;; in Emacs Lisp.
|
|
|
|
|
;;
|
|
|
|
|
;; This package was written by Dave Gillespie; it is a complete
|
|
|
|
|
;; rewrite of Cesar Quiroz's original cl.el package of December 1986.
|
|
|
|
|
;;
|
|
|
|
|
;; Bug reports, comments, and suggestions are welcome!
|
|
|
|
|
|
|
|
|
|
;; This file contains the portions of the Common Lisp extensions
|
|
|
|
|
;; package which should be autoloaded, but need only be present
|
|
|
|
|
;; if the compiler or interpreter is used---this file is not
|
|
|
|
|
;; necessary for executing compiled code.
|
|
|
|
|
|
|
|
|
|
;; See cl.el for Change Log.
|
|
|
|
|
|
|
|
|
|
|
1994-06-17 20:04:22 +00:00
|
|
|
|
;;; Code:
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(require 'cl-lib)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(require 'macroexp)
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
;; `gv' is required here because cl-macs can be loaded before loaddefs.el.
|
|
|
|
|
(require 'gv)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(defmacro cl--pop2 (place)
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(declare (debug edebug-sexps))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(prog1 (car (cdr ,place))
|
|
|
|
|
(setq ,place (cdr (cdr ,place)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(defvar cl--optimize-safety)
|
|
|
|
|
(defvar cl--optimize-speed)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;;; Initialization.
|
|
|
|
|
|
2012-09-04 13:40:25 -04:00
|
|
|
|
;; Place compiler macros at the beginning, otherwise uses of the corresponding
|
|
|
|
|
;; functions can lead to recursive-loads that prevent the calls from
|
|
|
|
|
;; being optimized.
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun cl--compiler-macro-list* (_form arg &rest others)
|
|
|
|
|
(let* ((args (reverse (cons arg others)))
|
|
|
|
|
(form (car args)))
|
|
|
|
|
(while (setq args (cdr args))
|
|
|
|
|
(setq form `(cons ,(car args) ,form)))
|
|
|
|
|
form))
|
|
|
|
|
|
Rationalize use of c[ad]+r, expunging cl-c[ad]\{3,4\}r.
Also expunge eudc-c[ad]+r.
* subr.el (internal--compiler-macro-cXXr): "New" function, copied
from cl--compiler-macro-cXXr.
(caar, cadr, cdar, cddr): Change from defsubsts to defuns with
the above compiler-macro.
* net/eudc.el (eudc-cadr, eudc-cdar, eudc-caar, eudc-cdaar): Remove.
* emacs-lisp/cl.el (Top level dolist doing defaliases): Remove
caaar, etc., from list of new alias functions.
* emacs-lisp/cl-lib.el (cl-caaar, etc): Rename to caaar, etc.
(gen-cXXr--rawname, gen-cXXr-all-cl-aliases): New function/macro
which generate obsolete cl- aliases for caaar, etc. Invoke them.
* desktop.el:
* edmacro.el:
* emacs-lisp/cl-macs.el:
* frameset.el:
* ibuffer.el:
* mail/footnote.el:
* net/dbus.el:
* net/eudc-export.el:
* net/eudc.el:
* net/eudcb-ph.el:
* net/rcirc.el:
* net/secrets.el:
* play/5x5.el:
* play/decipher.el:
* play/hanoi.el:
* progmodes/hideif.el:
* ses.el: Replace cl-caaar, eudc-cadr, etc. with caaar and cadr, etc.
2015-04-05 12:41:45 +00:00
|
|
|
|
;; Note: `cl--compiler-macro-cXXr' has been copied to
|
|
|
|
|
;; `internal--compiler-macro-cXXr' in subr.el. If you amend either
|
|
|
|
|
;; one, you may want to amend the other, too.
|
2012-09-04 13:40:25 -04:00
|
|
|
|
;;;###autoload
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(define-obsolete-function-alias 'cl--compiler-macro-cXXr
|
|
|
|
|
'internal--compiler-macro-cXXr "25.1")
|
2012-09-04 13:40:25 -04:00
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
;;; Some predicates for analyzing Lisp forms.
|
|
|
|
|
;; These are used by various
|
|
|
|
|
;; macro expanders to optimize the results in certain common cases.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defconst cl--simple-funcs '(car cdr nth aref elt if and or + - 1+ 1- min max
|
2002-11-27 12:25:11 +00:00
|
|
|
|
car-safe cdr-safe progn prog1 prog2))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defconst cl--safe-funcs '(* / % length memq list vector vectorp
|
2002-11-27 12:25:11 +00:00
|
|
|
|
< > <= >= = error))
|
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--simple-expr-p (x &optional size)
|
|
|
|
|
"Check if no side effects, and executes quickly."
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(or size (setq size 10))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(if (and (consp x) (not (memq (car x) '(quote function cl-function))))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(and (symbolp (car x))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(or (memq (car x) cl--simple-funcs)
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(get (car x) 'side-effect-free))
|
|
|
|
|
(progn
|
|
|
|
|
(setq size (1- size))
|
|
|
|
|
(while (and (setq x (cdr x))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(setq size (cl--simple-expr-p (car x) size))))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(and (null x) (>= size 0) size)))
|
|
|
|
|
(and (> size 0) (1- size))))
|
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--simple-exprs-p (xs)
|
|
|
|
|
(while (and xs (cl--simple-expr-p (car xs)))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(setq xs (cdr xs)))
|
|
|
|
|
(not xs))
|
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--safe-expr-p (x)
|
|
|
|
|
"Check if no side effects."
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(or (not (and (consp x) (not (memq (car x) '(quote function cl-function)))))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(and (symbolp (car x))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(or (memq (car x) cl--simple-funcs)
|
|
|
|
|
(memq (car x) cl--safe-funcs)
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(get (car x) 'side-effect-free))
|
|
|
|
|
(progn
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(while (and (setq x (cdr x)) (cl--safe-expr-p (car x))))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(null x)))))
|
|
|
|
|
|
|
|
|
|
;;; Check if constant (i.e., no side effects or dependencies).
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--const-expr-p (x)
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(cond ((consp x)
|
|
|
|
|
(or (eq (car x) 'quote)
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(and (memq (car x) '(function cl-function))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(or (symbolp (nth 1 x))
|
|
|
|
|
(and (eq (car-safe (nth 1 x)) 'lambda) 'func)))))
|
|
|
|
|
((symbolp x) (and (memq x '(nil t)) t))
|
|
|
|
|
(t t)))
|
|
|
|
|
|
2014-04-21 11:00:19 -07:00
|
|
|
|
(defun cl--const-expr-val (x)
|
2014-04-19 19:34:22 -07:00
|
|
|
|
"Return the value of X known at compile-time.
|
2014-04-21 11:00:19 -07:00
|
|
|
|
If X is not known at compile time, return nil. Before testing
|
|
|
|
|
whether X is known at compile time, macroexpand it completely in
|
|
|
|
|
`macroexpand-all-environment'."
|
|
|
|
|
(let ((x (macroexpand-all x macroexpand-all-environment)))
|
2014-04-19 19:34:22 -07:00
|
|
|
|
(if (macroexp-const-p x)
|
2014-04-21 11:00:19 -07:00
|
|
|
|
(if (consp x) (nth 1 x) x))))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--expr-contains (x y)
|
|
|
|
|
"Count number of times X refers to Y. Return nil for 0 times."
|
2012-06-03 21:05:17 -04:00
|
|
|
|
;; FIXME: This is naive, and it will cl-count Y as referred twice in
|
2012-05-06 11:38:30 -04:00
|
|
|
|
;; (let ((Y 1)) Y) even though it should be 0. Also it is often called on
|
|
|
|
|
;; non-macroexpanded code, so it may also miss some occurrences that would
|
|
|
|
|
;; only appear in the expanded code.
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(cond ((equal y x) 1)
|
2012-06-03 21:05:17 -04:00
|
|
|
|
((and (consp x) (not (memq (car x) '(quote function cl-function))))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(let ((sum 0))
|
2012-05-06 11:38:30 -04:00
|
|
|
|
(while (consp x)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(setq sum (+ sum (or (cl--expr-contains (pop x) y) 0))))
|
|
|
|
|
(setq sum (+ sum (or (cl--expr-contains x y) 0)))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
(and (> sum 0) sum)))
|
|
|
|
|
(t nil)))
|
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--expr-contains-any (x y)
|
|
|
|
|
(while (and y (not (cl--expr-contains x (car y)))) (pop y))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
y)
|
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--expr-depends-p (x y)
|
|
|
|
|
"Check whether X may depend on any of the symbols in Y."
|
|
|
|
|
(and (not (macroexp-const-p x))
|
|
|
|
|
(or (not (cl--safe-expr-p x)) (cl--expr-contains-any x y))))
|
2002-11-27 12:25:11 +00:00
|
|
|
|
|
1993-07-30 20:15:09 +00:00
|
|
|
|
;;; Symbols.
|
|
|
|
|
|
2017-09-13 10:38:05 -04:00
|
|
|
|
(defvar cl--gensym-counter 0)
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2017-09-13 10:38:05 -04:00
|
|
|
|
(defun cl-gensym (&optional prefix)
|
|
|
|
|
"Generate a new uninterned symbol.
|
|
|
|
|
The name is made by appending a number to PREFIX, default \"G\"."
|
|
|
|
|
(let ((pfix (if (stringp prefix) prefix "G"))
|
|
|
|
|
(num (if (integerp prefix) prefix
|
|
|
|
|
(prog1 cl--gensym-counter
|
|
|
|
|
(setq cl--gensym-counter (1+ cl--gensym-counter))))))
|
|
|
|
|
(make-symbol (format "%s%d" pfix num))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2017-09-12 11:00:58 -04:00
|
|
|
|
(defvar cl--gentemp-counter 0)
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defun cl-gentemp (&optional prefix)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
"Generate a new interned symbol with a unique name.
|
2017-09-12 11:00:58 -04:00
|
|
|
|
The name is made by appending a number to PREFIX, default \"T\"."
|
|
|
|
|
(let ((pfix (if (stringp prefix) prefix "T"))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
name)
|
2017-09-12 11:00:58 -04:00
|
|
|
|
(while (intern-soft (setq name (format "%s%d" pfix cl--gentemp-counter)))
|
|
|
|
|
(setq cl--gentemp-counter (1+ cl--gentemp-counter)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(intern name)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Program structure.
|
|
|
|
|
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(def-edebug-spec cl-declarations
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(&rest ("cl-declare" &rest sexp)))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
|
|
|
|
(def-edebug-spec cl-declarations-or-string
|
2017-10-06 11:30:22 -07:00
|
|
|
|
(&or lambda-doc cl-declarations))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
|
|
|
|
(def-edebug-spec cl-lambda-list
|
2017-10-16 11:09:29 -07:00
|
|
|
|
(([&rest cl-lambda-arg]
|
2012-05-17 17:39:36 -04:00
|
|
|
|
[&optional ["&optional" cl-&optional-arg &rest cl-&optional-arg]]
|
2017-10-16 11:09:29 -07:00
|
|
|
|
[&optional ["&rest" cl-lambda-arg]]
|
2012-05-17 17:39:36 -04:00
|
|
|
|
[&optional ["&key" [cl-&key-arg &rest cl-&key-arg]
|
|
|
|
|
&optional "&allow-other-keys"]]
|
|
|
|
|
[&optional ["&aux" &rest
|
|
|
|
|
&or (symbolp &optional def-form) symbolp]]
|
2017-10-16 11:09:29 -07:00
|
|
|
|
. [&or arg nil])))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
|
|
|
|
(def-edebug-spec cl-&optional-arg
|
2017-10-16 11:09:29 -07:00
|
|
|
|
(&or (cl-lambda-arg &optional def-form arg) arg))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
|
|
|
|
(def-edebug-spec cl-&key-arg
|
2017-10-16 11:09:29 -07:00
|
|
|
|
(&or ([&or (symbolp cl-lambda-arg) arg] &optional def-form arg) arg))
|
|
|
|
|
|
|
|
|
|
(def-edebug-spec cl-lambda-arg
|
|
|
|
|
(&or arg cl-lambda-list1))
|
|
|
|
|
|
|
|
|
|
(def-edebug-spec cl-lambda-list1
|
|
|
|
|
(([&optional ["&whole" arg]] ;; only allowed at lower levels
|
|
|
|
|
[&rest cl-lambda-arg]
|
|
|
|
|
[&optional ["&optional" cl-&optional-arg &rest cl-&optional-arg]]
|
|
|
|
|
[&optional ["&rest" cl-lambda-arg]]
|
|
|
|
|
[&optional ["&key" cl-&key-arg &rest cl-&key-arg
|
|
|
|
|
&optional "&allow-other-keys"]]
|
|
|
|
|
[&optional ["&aux" &rest
|
|
|
|
|
&or (symbolp &optional def-form) symbolp]]
|
|
|
|
|
. [&or arg nil])))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2013-09-25 14:39:53 -08:00
|
|
|
|
(def-edebug-spec cl-type-spec sexp)
|
|
|
|
|
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(defconst cl--lambda-list-keywords
|
|
|
|
|
'(&optional &rest &key &allow-other-keys &aux &whole &body &environment))
|
|
|
|
|
|
2015-03-16 16:11:38 -04:00
|
|
|
|
;; Internal hacks used in formal arg lists:
|
|
|
|
|
;; - &cl-quote: Added to formal-arglists to mean that any default value
|
|
|
|
|
;; mentioned in the formal arglist should be considered as implicitly
|
|
|
|
|
;; quoted rather than evaluated. This is used in `cl-defsubst' when
|
|
|
|
|
;; performing compiler-macro-expansion, since at that time the
|
|
|
|
|
;; arguments hold expressions rather than values.
|
|
|
|
|
;; - &cl-defs (DEF . DEFS): Gives the default value to use for missing
|
|
|
|
|
;; optional arguments which don't have an explicit default value.
|
|
|
|
|
;; DEFS is an alist mapping vars to their default default value.
|
|
|
|
|
;; and DEF is the default default to use for all other vars.
|
|
|
|
|
|
|
|
|
|
(defvar cl--bind-block) ;Name of surrounding block, only use for `signal' data.
|
|
|
|
|
(defvar cl--bind-defs) ;(DEF . DEFS) giving the "default default" for optargs.
|
|
|
|
|
(defvar cl--bind-enquote) ;Non-nil if &cl-quote was in the formal arglist!
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(defvar cl--bind-lets) (defvar cl--bind-forms)
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
|
|
|
|
|
(defun cl--transform-lambda (form bind-block)
|
2012-11-24 16:34:28 -05:00
|
|
|
|
"Transform a function form FORM of name BIND-BLOCK.
|
|
|
|
|
BIND-BLOCK is the name of the symbol to which the function will be bound,
|
|
|
|
|
and which will be used for the name of the `cl-block' surrounding the
|
|
|
|
|
function's body.
|
|
|
|
|
FORM is of the form (ARGS . BODY)."
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(let* ((args (car form)) (body (cdr form)) (orig-args args)
|
|
|
|
|
(cl--bind-block bind-block) (cl--bind-defs nil) (cl--bind-enquote nil)
|
2015-02-22 23:50:03 -05:00
|
|
|
|
(parsed-body (macroexp-parse-body body))
|
|
|
|
|
(header (car parsed-body)) (simple-args nil))
|
|
|
|
|
(setq body (cdr parsed-body))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
;; "(. X) to (&rest X)" conversion already done in cl--do-arglist, but we
|
|
|
|
|
;; do it here as well, so as to be able to see if we can avoid
|
|
|
|
|
;; cl--do-arglist.
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(setq args (if (listp args) (cl-copy-list args) (list '&rest args)))
|
|
|
|
|
(let ((p (last args))) (if (cdr p) (setcdr p (list '&rest (cdr p)))))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
(let ((cl-defs (memq '&cl-defs args)))
|
|
|
|
|
(when cl-defs
|
|
|
|
|
(setq cl--bind-defs (cadr cl-defs))
|
|
|
|
|
;; Remove "&cl-defs DEFS" from args.
|
|
|
|
|
(setcdr cl-defs (cddr cl-defs))
|
2015-03-17 14:30:42 -04:00
|
|
|
|
(setq args (delq '&cl-defs args))))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(if (setq cl--bind-enquote (memq '&cl-quote args))
|
|
|
|
|
(setq args (delq '&cl-quote args)))
|
|
|
|
|
(if (memq '&whole args) (error "&whole not currently implemented"))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(let* ((p (memq '&environment args))
|
|
|
|
|
(v (cadr p)))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(if p (setq args (nconc (delq (car p) (delq v args))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
`(&aux (,v macroexpand-all-environment))))))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
;; Take away all the simple args whose parsing can be handled more
|
|
|
|
|
;; efficiently by a plain old `lambda' than the manual parsing generated
|
|
|
|
|
;; by `cl--do-arglist'.
|
2015-03-17 14:30:42 -04:00
|
|
|
|
(let ((optional nil))
|
|
|
|
|
(while (and args (symbolp (car args))
|
|
|
|
|
(not (memq (car args) '(nil &rest &body &key &aux)))
|
|
|
|
|
(or (not optional)
|
|
|
|
|
;; Optional args whose default is nil are simple.
|
|
|
|
|
(null (nth 1 (assq (car args) (cdr cl--bind-defs)))))
|
|
|
|
|
(not (and (eq (car args) '&optional) (setq optional t)
|
|
|
|
|
(car cl--bind-defs))))
|
|
|
|
|
(push (pop args) simple-args))
|
|
|
|
|
(when optional
|
|
|
|
|
(if args (push '&optional args))
|
|
|
|
|
;; Don't keep a dummy trailing &optional without actual optional args.
|
|
|
|
|
(if (eq '&optional (car simple-args)) (pop simple-args))))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(or (eq cl--bind-block 'cl-none)
|
|
|
|
|
(setq body (list `(cl-block ,cl--bind-block ,@body))))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
(let* ((cl--bind-lets nil) (cl--bind-forms nil)
|
|
|
|
|
(rest-args
|
|
|
|
|
(cond
|
|
|
|
|
((null args) nil)
|
|
|
|
|
((eq (car args) '&aux)
|
|
|
|
|
(cl--do-&aux args)
|
|
|
|
|
(setq cl--bind-lets (nreverse cl--bind-lets))
|
|
|
|
|
nil)
|
|
|
|
|
(t ;; `simple-args' doesn't handle all the parsing that we need,
|
|
|
|
|
;; so we pass the rest to cl--do-arglist which will do
|
|
|
|
|
;; "manual" parsing.
|
|
|
|
|
(let ((slen (length simple-args)))
|
|
|
|
|
(when (memq '&optional simple-args)
|
2015-03-17 14:30:42 -04:00
|
|
|
|
(cl-decf slen))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
(setq header
|
|
|
|
|
;; Macro expansion can take place in the middle of
|
|
|
|
|
;; apparently harmless computation, so it should not
|
|
|
|
|
;; touch the match-data.
|
|
|
|
|
(save-match-data
|
|
|
|
|
(cons (help-add-fundoc-usage
|
|
|
|
|
(if (stringp (car header)) (pop header))
|
|
|
|
|
;; Be careful with make-symbol and (back)quote,
|
|
|
|
|
;; see bug#12884.
|
2015-11-17 15:28:50 -08:00
|
|
|
|
(help--docstring-quote
|
2016-05-12 00:48:37 +03:00
|
|
|
|
(let ((print-gensym nil) (print-quoted t)
|
|
|
|
|
(print-escape-newlines t))
|
2015-11-17 15:28:50 -08:00
|
|
|
|
(format "%S" (cons 'fn (cl--make-usage-args
|
|
|
|
|
orig-args))))))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
header)))
|
|
|
|
|
;; FIXME: we'd want to choose an arg name for the &rest param
|
|
|
|
|
;; and pass that as `expr' to cl--do-arglist, but that ends up
|
|
|
|
|
;; generating code with a redundant let-binding, so we instead
|
|
|
|
|
;; pass a dummy and then look in cl--bind-lets to find what var
|
|
|
|
|
;; this was bound to.
|
|
|
|
|
(cl--do-arglist args :dummy slen)
|
|
|
|
|
(setq cl--bind-lets (nreverse cl--bind-lets))
|
|
|
|
|
;; (cl-assert (eq :dummy (nth 1 (car cl--bind-lets))))
|
|
|
|
|
(list '&rest (car (pop cl--bind-lets))))))))
|
|
|
|
|
`(nil
|
|
|
|
|
(,@(nreverse simple-args) ,@rest-args)
|
|
|
|
|
,@header
|
|
|
|
|
,(macroexp-let* cl--bind-lets
|
|
|
|
|
(macroexp-progn
|
|
|
|
|
`(,@(nreverse cl--bind-forms)
|
|
|
|
|
,@body)))))))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-defun (name args &rest body)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Define NAME as a function.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
Like normal `defun', except ARGLIST allows full Common Lisp conventions,
|
2012-06-03 21:05:17 -04:00
|
|
|
|
and BODY is implicitly surrounded by (cl-block NAME ...).
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
2016-07-01 23:53:26 -04:00
|
|
|
|
The full form of a Common Lisp function argument list is
|
|
|
|
|
|
|
|
|
|
(VAR...
|
|
|
|
|
[&optional (VAR [INITFORM [SVAR]])...]
|
|
|
|
|
[&rest|&body VAR]
|
|
|
|
|
[&key (([KEYWORD] VAR) [INITFORM [SVAR]])... [&allow-other-keys]]
|
|
|
|
|
[&aux (VAR [INITFORM])...])
|
|
|
|
|
|
2017-10-16 11:09:29 -07:00
|
|
|
|
VAR may be replaced recursively with an argument list for
|
|
|
|
|
destructuring, `&whole' is supported within these sublists. If
|
2016-07-01 23:53:26 -04:00
|
|
|
|
SVAR, INITFORM, and KEYWORD are all omitted, then `(VAR)' may be
|
|
|
|
|
written simply `VAR'. See the Info node `(cl)Argument Lists' for
|
|
|
|
|
more details.
|
|
|
|
|
|
2002-09-27 23:16:27 +00:00
|
|
|
|
\(fn NAME ARGLIST [DOCSTRING] BODY...)"
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug
|
|
|
|
|
;; Same as defun but use cl-lambda-list.
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
(&define [&or name ("setf" :name setf name)]
|
2012-05-17 17:39:36 -04:00
|
|
|
|
cl-lambda-list
|
|
|
|
|
cl-declarations-or-string
|
|
|
|
|
[&optional ("interactive" interactive)]
|
2012-05-17 17:51:15 -04:00
|
|
|
|
def-body))
|
2012-05-17 21:46:20 -04:00
|
|
|
|
(doc-string 3)
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(indent 2))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let* ((res (cl--transform-lambda (cons args body) name))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(form `(defun ,name ,@(cdr res))))
|
|
|
|
|
(if (car res) `(progn ,(car res) ,form) form)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2015-03-02 16:41:59 -08:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-iter-defun (name args &rest body)
|
|
|
|
|
"Define NAME as a generator function.
|
|
|
|
|
Like normal `iter-defun', except ARGLIST allows full Common Lisp conventions,
|
|
|
|
|
and BODY is implicitly surrounded by (cl-block NAME ...).
|
|
|
|
|
|
|
|
|
|
\(fn NAME ARGLIST [DOCSTRING] BODY...)"
|
|
|
|
|
(declare (debug
|
|
|
|
|
;; Same as iter-defun but use cl-lambda-list.
|
|
|
|
|
(&define [&or name ("setf" :name setf name)]
|
|
|
|
|
cl-lambda-list
|
|
|
|
|
cl-declarations-or-string
|
|
|
|
|
[&optional ("interactive" interactive)]
|
|
|
|
|
def-body))
|
|
|
|
|
(doc-string 3)
|
|
|
|
|
(indent 2))
|
|
|
|
|
(require 'generator)
|
|
|
|
|
(let* ((res (cl--transform-lambda (cons args body) name))
|
|
|
|
|
(form `(iter-defun ,name ,@(cdr res))))
|
|
|
|
|
(if (car res) `(progn ,(car res) ,form) form)))
|
|
|
|
|
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; The lambda list for macros is different from that of normal lambdas.
|
|
|
|
|
;; Note that &environment is only allowed as first or last items in the
|
|
|
|
|
;; top level list.
|
|
|
|
|
|
|
|
|
|
(def-edebug-spec cl-macro-list
|
|
|
|
|
(([&optional "&environment" arg]
|
|
|
|
|
[&rest cl-macro-arg]
|
|
|
|
|
[&optional ["&optional" &rest
|
|
|
|
|
&or (cl-macro-arg &optional def-form cl-macro-arg) arg]]
|
|
|
|
|
[&optional [[&or "&rest" "&body"] cl-macro-arg]]
|
|
|
|
|
[&optional ["&key" [&rest
|
|
|
|
|
[&or ([&or (symbolp cl-macro-arg) arg]
|
|
|
|
|
&optional def-form cl-macro-arg)
|
|
|
|
|
arg]]
|
|
|
|
|
&optional "&allow-other-keys"]]
|
|
|
|
|
[&optional ["&aux" &rest
|
|
|
|
|
&or (symbolp &optional def-form) symbolp]]
|
|
|
|
|
[&optional "&environment" arg]
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
(def-edebug-spec cl-macro-arg
|
|
|
|
|
(&or arg cl-macro-list1))
|
|
|
|
|
|
|
|
|
|
(def-edebug-spec cl-macro-list1
|
|
|
|
|
(([&optional "&whole" arg] ;; only allowed at lower levels
|
|
|
|
|
[&rest cl-macro-arg]
|
|
|
|
|
[&optional ["&optional" &rest
|
|
|
|
|
&or (cl-macro-arg &optional def-form cl-macro-arg) arg]]
|
|
|
|
|
[&optional [[&or "&rest" "&body"] cl-macro-arg]]
|
|
|
|
|
[&optional ["&key" [&rest
|
|
|
|
|
[&or ([&or (symbolp cl-macro-arg) arg]
|
|
|
|
|
&optional def-form cl-macro-arg)
|
|
|
|
|
arg]]
|
|
|
|
|
&optional "&allow-other-keys"]]
|
|
|
|
|
[&optional ["&aux" &rest
|
|
|
|
|
&or (symbolp &optional def-form) symbolp]]
|
|
|
|
|
. [&or arg nil])))
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-defmacro (name args &rest body)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Define NAME as a macro.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
Like normal `defmacro', except ARGLIST allows full Common Lisp conventions,
|
2012-06-03 21:05:17 -04:00
|
|
|
|
and BODY is implicitly surrounded by (cl-block NAME ...).
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
2016-07-01 23:53:26 -04:00
|
|
|
|
The full form of a Common Lisp macro argument list is
|
|
|
|
|
|
|
|
|
|
(VAR...
|
|
|
|
|
[&optional (VAR [INITFORM [SVAR]])...]
|
|
|
|
|
[&rest|&body VAR]
|
|
|
|
|
[&key (([KEYWORD] VAR) [INITFORM [SVAR]])... [&allow-other-keys]]
|
|
|
|
|
[&aux (VAR [INITFORM])...]
|
|
|
|
|
[&environment VAR])
|
|
|
|
|
|
2017-10-16 11:09:29 -07:00
|
|
|
|
VAR may be replaced recursively with an argument list for
|
|
|
|
|
destructuring, `&whole' is supported within these sublists. If
|
2016-07-01 23:53:26 -04:00
|
|
|
|
SVAR, INITFORM, and KEYWORD are all omitted, then `(VAR)' may be
|
|
|
|
|
written simply `VAR'. See the Info node `(cl)Argument Lists' for
|
|
|
|
|
more details.
|
|
|
|
|
|
2002-09-27 23:16:27 +00:00
|
|
|
|
\(fn NAME ARGLIST [DOCSTRING] BODY...)"
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(&define name cl-macro-list cl-declarations-or-string def-body))
|
2012-05-17 21:46:20 -04:00
|
|
|
|
(doc-string 3)
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(indent 2))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let* ((res (cl--transform-lambda (cons args body) name))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(form `(defmacro ,name ,@(cdr res))))
|
|
|
|
|
(if (car res) `(progn ,(car res) ,form) form)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(def-edebug-spec cl-lambda-expr
|
|
|
|
|
(&define ("lambda" cl-lambda-list
|
2017-10-06 11:30:22 -07:00
|
|
|
|
cl-declarations-or-string
|
|
|
|
|
[&optional ("interactive" interactive)]
|
2012-05-17 17:39:36 -04:00
|
|
|
|
def-body)))
|
|
|
|
|
|
2012-06-03 21:05:17 -04:00
|
|
|
|
;; Redefine function-form to also match cl-function
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(def-edebug-spec function-form
|
|
|
|
|
;; form at the end could also handle "function",
|
|
|
|
|
;; but recognize it specially to avoid wrapping function forms.
|
|
|
|
|
(&or ([&or "quote" "function"] &or symbolp lambda-expr)
|
2012-06-03 21:05:17 -04:00
|
|
|
|
("cl-function" cl-function)
|
2012-05-17 17:39:36 -04:00
|
|
|
|
form))
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-function (func)
|
2000-05-05 20:01:01 +00:00
|
|
|
|
"Introduce a function.
|
(function*, case, ecase, typecase, etypecase, progv, lexical-let, lexical-let*,
multiple-value-bind, multiple-value-setq, shiftf): Improve argument/docstring
consistency.
2005-05-22 17:51:22 +00:00
|
|
|
|
Like normal `function', except that if argument is a lambda form,
|
|
|
|
|
its argument list allows full Common Lisp conventions."
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug (&or symbolp cl-lambda-expr)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (eq (car-safe func) 'lambda)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let* ((res (cl--transform-lambda (cdr func) 'cl-none))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(form `(function (lambda . ,(cdr res)))))
|
|
|
|
|
(if (car res) `(progn ,(car res) ,form) form))
|
|
|
|
|
`(function ,func)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2011-08-05 12:31:21 -04:00
|
|
|
|
(defun cl--make-usage-var (x)
|
|
|
|
|
"X can be a var or a (destructuring) lambda-list."
|
|
|
|
|
(cond
|
|
|
|
|
((symbolp x) (make-symbol (upcase (symbol-name x))))
|
|
|
|
|
((consp x) (cl--make-usage-args x))
|
|
|
|
|
(t x)))
|
|
|
|
|
|
|
|
|
|
(defun cl--make-usage-args (arglist)
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(let ((aux (ignore-errors (cl-position '&aux arglist))))
|
|
|
|
|
(when aux
|
|
|
|
|
;; `&aux' args aren't arguments, so let's just drop them from the
|
|
|
|
|
;; usage info.
|
|
|
|
|
(setq arglist (cl-subseq arglist 0 aux))))
|
2018-07-09 18:46:33 -07:00
|
|
|
|
(if (not (proper-list-p arglist))
|
2012-06-23 00:24:06 -04:00
|
|
|
|
(let* ((last (last arglist))
|
|
|
|
|
(tail (cdr last)))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
|
|
|
|
(setcdr last nil)
|
|
|
|
|
(nconc (cl--make-usage-args arglist) (cl--make-usage-var tail)))
|
|
|
|
|
(setcdr last tail)))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
;; `orig-args' can contain &cl-defs.
|
2012-06-23 00:24:06 -04:00
|
|
|
|
(let ((x (memq '&cl-defs arglist)))
|
|
|
|
|
(when x (setq arglist (delq (car x) (remq (cadr x) arglist)))))
|
|
|
|
|
(let ((state nil))
|
|
|
|
|
(mapcar (lambda (x)
|
|
|
|
|
(cond
|
|
|
|
|
((symbolp x)
|
2012-09-06 11:35:08 -04:00
|
|
|
|
(let ((first (aref (symbol-name x) 0)))
|
|
|
|
|
(if (eq ?\& first)
|
|
|
|
|
(setq state x)
|
|
|
|
|
;; Strip a leading underscore, since it only
|
|
|
|
|
;; means that this argument is unused.
|
|
|
|
|
(make-symbol (upcase (if (eq ?_ first)
|
|
|
|
|
(substring (symbol-name x) 1)
|
|
|
|
|
(symbol-name x)))))))
|
2012-06-23 00:24:06 -04:00
|
|
|
|
((not (consp x)) x)
|
|
|
|
|
((memq state '(nil &rest)) (cl--make-usage-args x))
|
|
|
|
|
(t ;(VAR INITFORM SVAR) or ((KEYWORD VAR) INITFORM SVAR).
|
|
|
|
|
(cl-list*
|
|
|
|
|
(if (and (consp (car x)) (eq state '&key))
|
|
|
|
|
(list (caar x) (cl--make-usage-var (nth 1 (car x))))
|
|
|
|
|
(cl--make-usage-var (car x)))
|
|
|
|
|
(nth 1 x) ;INITFORM.
|
|
|
|
|
(cl--make-usage-args (nthcdr 2 x)) ;SVAR.
|
|
|
|
|
))))
|
|
|
|
|
arglist))))
|
2011-08-05 12:31:21 -04:00
|
|
|
|
|
2015-03-16 16:11:38 -04:00
|
|
|
|
(defun cl--do-&aux (args)
|
|
|
|
|
(while (and (eq (car args) '&aux) (pop args))
|
|
|
|
|
(while (and args (not (memq (car args) cl--lambda-list-keywords)))
|
|
|
|
|
(if (consp (car args))
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(if (and cl--bind-enquote (cl-cadar args))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
(cl--do-arglist (caar args)
|
|
|
|
|
`',(cadr (pop args)))
|
|
|
|
|
(cl--do-arglist (caar args) (cadr (pop args))))
|
|
|
|
|
(cl--do-arglist (pop args) nil))))
|
|
|
|
|
(if args (error "Malformed argument list ends with: %S" args)))
|
|
|
|
|
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(defun cl--do-arglist (args expr &optional num) ; uses cl--bind-*
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (nlistp args)
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(if (or (memq args cl--lambda-list-keywords) (not (symbolp args)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(error "Invalid argument name: %s" args)
|
2012-06-08 09:18:26 -04:00
|
|
|
|
(push (list args expr) cl--bind-lets))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(setq args (cl-copy-list args))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((p (last args))) (if (cdr p) (setcdr p (list '&rest (cdr p)))))
|
|
|
|
|
(let ((p (memq '&body args))) (if p (setcar p '&rest)))
|
|
|
|
|
(if (memq '&environment args) (error "&environment used incorrectly"))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
(let ((restarg (memq '&rest args))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(safety (if (cl--compiling-file) cl--optimize-safety 3))
|
2017-11-27 12:45:16 -05:00
|
|
|
|
(keys t)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(laterarg nil) (exactarg nil) minarg)
|
|
|
|
|
(or num (setq num 0))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(setq restarg (if (listp (cadr restarg))
|
|
|
|
|
(make-symbol "--cl-rest--")
|
|
|
|
|
(cadr restarg)))
|
2012-06-08 09:18:26 -04:00
|
|
|
|
(push (list restarg expr) cl--bind-lets)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (eq (car args) '&whole)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(push (list (cl--pop2 args) restarg) cl--bind-lets))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((p args))
|
|
|
|
|
(setq minarg restarg)
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(while (and p (not (memq (car p) cl--lambda-list-keywords)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(or (eq p args) (setq minarg (list 'cdr minarg)))
|
|
|
|
|
(setq p (cdr p)))
|
|
|
|
|
(if (memq (car p) '(nil &aux))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(setq minarg `(= (length ,restarg)
|
2012-06-03 21:05:17 -04:00
|
|
|
|
,(length (cl-ldiff args p)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
exactarg (not (eq args p)))))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(while (and args (not (memq (car args) cl--lambda-list-keywords)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((poparg (list (if (or (cdr args) (not exactarg)) 'pop 'car)
|
|
|
|
|
restarg)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(cl--do-arglist
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(pop args)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (or laterarg (= safety 0)) poparg
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(if ,minarg ,poparg
|
|
|
|
|
(signal 'wrong-number-of-arguments
|
2012-06-08 09:18:26 -04:00
|
|
|
|
(list ,(and (not (eq cl--bind-block 'cl-none))
|
|
|
|
|
`',cl--bind-block)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(length ,restarg)))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq num (1+ num) laterarg t))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(while (and (eq (car args) '&optional) (pop args))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(while (and args (not (memq (car args) cl--lambda-list-keywords)))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(let ((arg (pop args)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(or (consp arg) (setq arg (list arg)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (cddr arg) (cl--do-arglist (nth 2 arg) `(and ,restarg t)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((def (if (cdr arg) (nth 1 arg)
|
2012-06-08 09:18:26 -04:00
|
|
|
|
(or (car cl--bind-defs)
|
|
|
|
|
(nth 1 (assq (car arg) cl--bind-defs)))))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(poparg `(pop ,restarg)))
|
2012-06-08 09:18:26 -04:00
|
|
|
|
(and def cl--bind-enquote (setq def `',def))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(cl--do-arglist (car arg)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(if def `(if ,restarg ,poparg ,def) poparg))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq num (1+ num))))))
|
|
|
|
|
(if (eq (car args) '&rest)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(let ((arg (cl--pop2 args)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (consp arg) (cl--do-arglist arg restarg)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(or (eq (car args) '&key) (= safety 0) exactarg
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push `(if ,restarg
|
|
|
|
|
(signal 'wrong-number-of-arguments
|
|
|
|
|
(list
|
2012-06-08 09:18:26 -04:00
|
|
|
|
,(and (not (eq cl--bind-block 'cl-none))
|
|
|
|
|
`',cl--bind-block)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(+ ,num (length ,restarg)))))
|
2012-06-08 09:18:26 -04:00
|
|
|
|
cl--bind-forms)))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(while (and (eq (car args) '&key) (pop args))
|
2017-11-27 12:45:16 -05:00
|
|
|
|
(unless (listp keys) (setq keys nil))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(while (and args (not (memq (car args) cl--lambda-list-keywords)))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(let ((arg (pop args)))
|
2001-07-02 15:19:07 +00:00
|
|
|
|
(or (consp arg) (setq arg (list arg)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let* ((karg (if (consp (car arg)) (caar arg)
|
2012-09-06 11:35:08 -04:00
|
|
|
|
(let ((name (symbol-name (car arg))))
|
|
|
|
|
;; Strip a leading underscore, since it only
|
|
|
|
|
;; means that this argument is unused, but
|
|
|
|
|
;; shouldn't affect the key's name (bug#12367).
|
|
|
|
|
(if (eq ?_ (aref name 0))
|
|
|
|
|
(setq name (substring name 1)))
|
|
|
|
|
(intern (format ":%s" name)))))
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(varg (if (consp (car arg)) (cl-cadar arg) (car arg)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(def (if (cdr arg) (cadr arg)
|
2015-03-16 16:11:38 -04:00
|
|
|
|
;; The ordering between those two or clauses is
|
|
|
|
|
;; irrelevant, since in practice only one of the two
|
|
|
|
|
;; is ever non-nil (the car is only used for
|
|
|
|
|
;; cl-deftype which doesn't use the cdr).
|
|
|
|
|
(or (car cl--bind-defs)
|
|
|
|
|
(cadr (assq varg cl--bind-defs)))))
|
2014-03-23 20:06:35 -07:00
|
|
|
|
(look `(plist-member ,restarg ',karg)))
|
2012-06-08 09:18:26 -04:00
|
|
|
|
(and def cl--bind-enquote (setq def `',def))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (cddr arg)
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(let* ((temp (or (nth 2 arg) (make-symbol "--cl-var--")))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(val `(car (cdr ,temp))))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(cl--do-arglist temp look)
|
|
|
|
|
(cl--do-arglist varg
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(if ,temp
|
|
|
|
|
(prog1 ,val (setq ,temp t))
|
|
|
|
|
,def)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(cl--do-arglist
|
1993-07-30 20:15:09 +00:00
|
|
|
|
varg
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(car (cdr ,(if (null def)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
look
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(or ,look
|
2012-06-07 15:25:48 -04:00
|
|
|
|
,(if (eq (cl--const-expr-p def) t)
|
2014-04-21 11:00:19 -07:00
|
|
|
|
`'(nil ,(cl--const-expr-val def))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(list nil ,def))))))))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push karg keys)))))
|
2017-11-27 12:45:16 -05:00
|
|
|
|
(when (consp keys) (setq keys (nreverse keys)))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(or (and (eq (car args) '&allow-other-keys) (pop args))
|
2017-11-27 12:45:16 -05:00
|
|
|
|
(= safety 0)
|
|
|
|
|
(cond
|
|
|
|
|
((eq keys t) nil) ;No &keys at all
|
|
|
|
|
((null keys) ;A &key but no actual keys specified.
|
|
|
|
|
(push `(when ,restarg
|
|
|
|
|
(error ,(format "Keyword argument %%s not one of %s"
|
|
|
|
|
keys)
|
|
|
|
|
(car ,restarg)))
|
|
|
|
|
cl--bind-forms))
|
|
|
|
|
(t
|
|
|
|
|
(let* ((var (make-symbol "--cl-keys--"))
|
|
|
|
|
(allow '(:allow-other-keys))
|
|
|
|
|
(check `(while ,var
|
|
|
|
|
(cond
|
|
|
|
|
((memq (car ,var) ',(append keys allow))
|
|
|
|
|
(setq ,var (cdr (cdr ,var))))
|
|
|
|
|
((car (cdr (memq (quote ,@allow) ,restarg)))
|
|
|
|
|
(setq ,var nil))
|
|
|
|
|
(t
|
|
|
|
|
(error
|
|
|
|
|
,(format "Keyword argument %%s not one of %s"
|
|
|
|
|
keys)
|
|
|
|
|
(car ,var)))))))
|
|
|
|
|
(push `(let ((,var ,restarg)) ,check) cl--bind-forms)))))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
(cl--do-&aux args)
|
|
|
|
|
nil)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--arglist-args (args)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (nlistp args) (list args)
|
|
|
|
|
(let ((res nil) (kind nil) arg)
|
|
|
|
|
(while (consp args)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(setq arg (pop args))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(if (memq arg cl--lambda-list-keywords) (setq kind arg)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(if (eq arg '&cl-defs) (pop args)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(and (consp arg) kind (setq arg (car arg)))
|
|
|
|
|
(and (consp arg) (cdr arg) (eq kind '&key) (setq arg (cadr arg)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(setq res (nconc res (cl--arglist-args arg))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(nconc res (and args (list args))))))
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-destructuring-bind (args expr &rest body)
|
2012-11-05 00:29:12 -08:00
|
|
|
|
"Bind the variables in ARGS to the result of EXPR and execute BODY."
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 2)
|
2017-11-01 21:13:02 -07:00
|
|
|
|
(debug (&define cl-macro-list1 def-form cl-declarations def-body)))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(let* ((cl--bind-lets nil) (cl--bind-forms nil)
|
2012-06-08 09:18:26 -04:00
|
|
|
|
(cl--bind-defs nil) (cl--bind-block 'cl-none) (cl--bind-enquote nil))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(cl--do-arglist (or args '(&aux)) expr)
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(macroexp-let* (nreverse cl--bind-lets)
|
|
|
|
|
(macroexp-progn (append (nreverse cl--bind-forms) body)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
|
2012-06-03 21:05:17 -04:00
|
|
|
|
;;; The `cl-eval-when' form.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(defvar cl--not-toplevel nil)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-eval-when (when &rest body)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Control when BODY is evaluated.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
If `compile' is in WHEN, BODY is evaluated when compiled at top-level.
|
|
|
|
|
If `load' is in WHEN, BODY is evaluated when loaded after top-level compile.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
If `eval' is in WHEN, BODY is evaluated when interpreted or at non-top-level.
|
|
|
|
|
|
|
|
|
|
\(fn (WHEN...) BODY...)"
|
2013-06-11 22:16:02 -04:00
|
|
|
|
(declare (indent 1) (debug (sexp body)))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(if (and (fboundp 'cl--compiling-file) (cl--compiling-file)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(not cl--not-toplevel) (not (boundp 'for-effect))) ;Horrible kludge.
|
2000-05-05 20:01:01 +00:00
|
|
|
|
(let ((comp (or (memq 'compile when) (memq :compile-toplevel when)))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(cl--not-toplevel t))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
(if (or (memq 'load when) (memq :load-toplevel when))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if comp (cons 'progn (mapcar 'cl--compile-time-too body))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(if nil nil ,@body))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(progn (if comp (eval (cons 'progn body))) nil)))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
(and (or (memq 'eval when) (memq :execute when))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(cons 'progn body))))
|
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--compile-time-too (form)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(or (and (symbolp (car-safe form)) (get (car-safe form) 'byte-hunk-handler))
|
|
|
|
|
(setq form (macroexpand
|
2012-06-03 21:05:17 -04:00
|
|
|
|
form (cons '(cl-eval-when) byte-compile-macro-environment))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(cond ((eq (car-safe form) 'progn)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(cons 'progn (mapcar 'cl--compile-time-too (cdr form))))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
((eq (car-safe form) 'cl-eval-when)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((when (nth 1 form)))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
(if (or (memq 'eval when) (memq :execute when))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
`(cl-eval-when (compile ,@when) ,@(cddr form))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
form)))
|
|
|
|
|
(t (eval form) form)))
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-08 09:18:26 -04:00
|
|
|
|
(defmacro cl-load-time-value (form &optional _read-only)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
"Like `progn', but evaluates the body at load time.
|
|
|
|
|
The result of the body appears to the compiler as a quoted constant."
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug (form &optional sexp)))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(if (cl--compiling-file)
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(let* ((temp (cl-gentemp "--cl-load-time--"))
|
2013-08-12 22:30:52 -04:00
|
|
|
|
(set `(setq ,temp ,form)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (and (fboundp 'byte-compile-file-form-defmumble)
|
|
|
|
|
(boundp 'this-kind) (boundp 'that-one))
|
2015-01-14 14:37:10 -05:00
|
|
|
|
;; Else, we can't output right away, so we have to delay it to the
|
|
|
|
|
;; next time we're at the top-level.
|
|
|
|
|
;; FIXME: Use advice-add/remove.
|
|
|
|
|
(fset 'byte-compile-file-form
|
|
|
|
|
(let ((old (symbol-function 'byte-compile-file-form)))
|
|
|
|
|
(lambda (form)
|
|
|
|
|
(fset 'byte-compile-file-form old)
|
|
|
|
|
(byte-compile-file-form set)
|
|
|
|
|
(byte-compile-file-form form))))
|
|
|
|
|
;; If we're not in the middle of compiling something, we can
|
|
|
|
|
;; output directly to byte-compile-outbuffer, to make sure
|
|
|
|
|
;; temp is set before we use it.
|
|
|
|
|
(print set byte-compile--outbuffer))
|
|
|
|
|
temp)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`',(eval form)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Conditional control structures.
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-case (expr &rest clauses)
|
(function*, case, ecase, typecase, etypecase, progv, lexical-let, lexical-let*,
multiple-value-bind, multiple-value-setq, shiftf): Improve argument/docstring
consistency.
2005-05-22 17:51:22 +00:00
|
|
|
|
"Eval EXPR and choose among clauses on that value.
|
2018-03-08 18:48:39 -05:00
|
|
|
|
Each clause looks like (KEYLIST BODY...). EXPR is evaluated and
|
|
|
|
|
compared against each key in each KEYLIST; the corresponding BODY
|
|
|
|
|
is evaluated. If no clause succeeds, cl-case returns nil. A
|
|
|
|
|
single non-nil atom may be used in place of a KEYLIST of one
|
|
|
|
|
atom. A KEYLIST of t or `otherwise' is allowed only in the final
|
|
|
|
|
clause, and matches if no other keys match. Key values are
|
|
|
|
|
compared by `eql'.
|
|
|
|
|
|
|
|
|
|
\(fn EXPR (KEYLIST BODY...)...)"
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 1) (debug (form &rest (sexp body))))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(macroexp-let2 macroexp-copyable-p temp expr
|
|
|
|
|
(let* ((head-list nil))
|
|
|
|
|
`(cond
|
|
|
|
|
,@(mapcar
|
|
|
|
|
(lambda (c)
|
|
|
|
|
(cons (cond ((memq (car c) '(t otherwise)) t)
|
|
|
|
|
((eq (car c) 'cl--ecase-error-flag)
|
|
|
|
|
`(error "cl-ecase failed: %s, %s"
|
|
|
|
|
,temp ',(reverse head-list)))
|
|
|
|
|
((listp (car c))
|
|
|
|
|
(setq head-list (append (car c) head-list))
|
|
|
|
|
`(cl-member ,temp ',(car c)))
|
|
|
|
|
(t
|
|
|
|
|
(if (memq (car c) head-list)
|
|
|
|
|
(error "Duplicate key in case: %s"
|
|
|
|
|
(car c)))
|
|
|
|
|
(push (car c) head-list)
|
|
|
|
|
`(eql ,temp ',(car c))))
|
|
|
|
|
(or (cdr c) '(nil))))
|
|
|
|
|
clauses)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-ecase (expr &rest clauses)
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 19:13:41 -04:00
|
|
|
|
"Like `cl-case', but error if no case fits.
|
(function*, case, ecase, typecase, etypecase, progv, lexical-let, lexical-let*,
multiple-value-bind, multiple-value-setq, shiftf): Improve argument/docstring
consistency.
2005-05-22 17:51:22 +00:00
|
|
|
|
`otherwise'-clauses are not allowed.
|
|
|
|
|
\n(fn EXPR (KEYLIST BODY...)...)"
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(declare (indent 1) (debug cl-case))
|
|
|
|
|
`(cl-case ,expr ,@clauses (cl--ecase-error-flag)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-typecase (expr &rest clauses)
|
(function*, case, ecase, typecase, etypecase, progv, lexical-let, lexical-let*,
multiple-value-bind, multiple-value-setq, shiftf): Improve argument/docstring
consistency.
2005-05-22 17:51:22 +00:00
|
|
|
|
"Evals EXPR, chooses among clauses on that value.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
Each clause looks like (TYPE BODY...). EXPR is evaluated and, if it
|
|
|
|
|
satisfies TYPE, the corresponding BODY is evaluated. If no clause succeeds,
|
2012-06-03 21:05:17 -04:00
|
|
|
|
cl-typecase returns nil. A TYPE of t or `otherwise' is allowed only in the
|
(function*, case, ecase, typecase, etypecase, progv, lexical-let, lexical-let*,
multiple-value-bind, multiple-value-setq, shiftf): Improve argument/docstring
consistency.
2005-05-22 17:51:22 +00:00
|
|
|
|
final clause, and matches if no other keys match.
|
|
|
|
|
\n(fn EXPR (TYPE BODY...)...)"
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 1)
|
|
|
|
|
(debug (form &rest ([&or cl-type-spec "otherwise"] body))))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(macroexp-let2 macroexp-copyable-p temp expr
|
|
|
|
|
(let* ((type-list nil))
|
|
|
|
|
(cons
|
|
|
|
|
'cond
|
|
|
|
|
(mapcar
|
|
|
|
|
(function
|
|
|
|
|
(lambda (c)
|
|
|
|
|
(cons (cond ((eq (car c) 'otherwise) t)
|
|
|
|
|
((eq (car c) 'cl--ecase-error-flag)
|
|
|
|
|
`(error "cl-etypecase failed: %s, %s"
|
|
|
|
|
,temp ',(reverse type-list)))
|
|
|
|
|
(t
|
|
|
|
|
(push (car c) type-list)
|
|
|
|
|
`(cl-typep ,temp ',(car c))))
|
|
|
|
|
(or (cdr c) '(nil)))))
|
|
|
|
|
clauses)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-etypecase (expr &rest clauses)
|
|
|
|
|
"Like `cl-typecase', but error if no case fits.
|
(function*, case, ecase, typecase, etypecase, progv, lexical-let, lexical-let*,
multiple-value-bind, multiple-value-setq, shiftf): Improve argument/docstring
consistency.
2005-05-22 17:51:22 +00:00
|
|
|
|
`otherwise'-clauses are not allowed.
|
|
|
|
|
\n(fn EXPR (TYPE BODY...)...)"
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(declare (indent 1) (debug cl-typecase))
|
|
|
|
|
`(cl-typecase ,expr ,@clauses (cl--ecase-error-flag)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Blocks and exits.
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-block (name &rest body)
|
2000-05-05 20:01:01 +00:00
|
|
|
|
"Define a lexically-scoped block named NAME.
|
2012-06-03 21:05:17 -04:00
|
|
|
|
NAME may be any symbol. Code inside the BODY forms can call `cl-return-from'
|
1993-07-30 20:15:09 +00:00
|
|
|
|
to jump prematurely out of the block. This differs from `catch' and `throw'
|
|
|
|
|
in two respects: First, the NAME is an unevaluated symbol rather than a
|
|
|
|
|
quoted symbol or other form; and second, NAME is lexically rather than
|
|
|
|
|
dynamically scoped: Only references to it within BODY will work. These
|
|
|
|
|
references may appear inside macro expansions, but not inside functions
|
|
|
|
|
called from BODY."
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 1) (debug (symbolp body)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (cl--safe-expr-p `(progn ,@body)) `(progn ,@body)
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
`(cl--block-wrapper
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(catch ',(intern (format "--cl-block-%s--" name))
|
|
|
|
|
,@body))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-return (&optional result)
|
2000-05-05 20:01:01 +00:00
|
|
|
|
"Return from the block named nil.
|
2012-06-03 21:05:17 -04:00
|
|
|
|
This is equivalent to `(cl-return-from nil RESULT)'."
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug (&optional form)))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
`(cl-return-from nil ,result))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-return-from (name &optional result)
|
2000-05-05 20:01:01 +00:00
|
|
|
|
"Return from the block named NAME.
|
2012-06-03 21:05:17 -04:00
|
|
|
|
This jumps out to the innermost enclosing `(cl-block NAME ...)' form,
|
1993-07-30 20:15:09 +00:00
|
|
|
|
returning RESULT from that form (or nil if RESULT is omitted).
|
|
|
|
|
This is compatible with Common Lisp, but note that `defun' and
|
|
|
|
|
`defmacro' do not create implicit blocks as they do in Common Lisp."
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 1) (debug (symbolp &optional form)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((name2 (intern (format "--cl-block-%s--" name))))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
`(cl--block-throw ',name2 ,result)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
|
2012-06-03 21:05:17 -04:00
|
|
|
|
;;; The "cl-loop" macro.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defvar cl--loop-args) (defvar cl--loop-accum-var) (defvar cl--loop-accum-vars)
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(defvar cl--loop-bindings) (defvar cl--loop-body)
|
|
|
|
|
(defvar cl--loop-finally)
|
|
|
|
|
(defvar cl--loop-finish-flag) ;Symbol set to nil to exit the loop?
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defvar cl--loop-first-flag)
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(defvar cl--loop-initially) (defvar cl--loop-iterator-function)
|
|
|
|
|
(defvar cl--loop-name)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defvar cl--loop-result) (defvar cl--loop-result-explicit)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(defvar cl--loop-result-var) (defvar cl--loop-steps)
|
2018-01-08 19:11:20 +09:00
|
|
|
|
(defvar cl--loop-symbol-macs) (defvar cl--loop-guard-cond)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(defun cl--loop-set-iterator-function (kind iterator)
|
|
|
|
|
(if cl--loop-iterator-function
|
|
|
|
|
;; FIXME: Of course, we could make it work, but why bother.
|
|
|
|
|
(error "Iteration on %S does not support this combination" kind)
|
|
|
|
|
(setq cl--loop-iterator-function iterator)))
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-08 09:18:26 -04:00
|
|
|
|
(defmacro cl-loop (&rest loop-args)
|
2012-11-15 22:01:25 +01:00
|
|
|
|
"The Common Lisp `loop' macro.
|
2013-05-09 22:01:12 -04:00
|
|
|
|
Valid clauses include:
|
|
|
|
|
For clauses:
|
2016-06-07 13:48:11 -04:00
|
|
|
|
for VAR from/upfrom/downfrom EXPR1 to/upto/downto/above/below EXPR2 [by EXPR3]
|
2013-05-09 22:01:12 -04:00
|
|
|
|
for VAR = EXPR1 then EXPR2
|
2016-06-07 13:48:11 -04:00
|
|
|
|
for VAR in/on/in-ref LIST [by FUNC]
|
2013-05-09 22:01:12 -04:00
|
|
|
|
for VAR across/across-ref ARRAY
|
|
|
|
|
for VAR being:
|
|
|
|
|
the elements of/of-ref SEQUENCE [using (index VAR2)]
|
|
|
|
|
the symbols [of OBARRAY]
|
|
|
|
|
the hash-keys/hash-values of HASH-TABLE [using (hash-values/hash-keys V2)]
|
|
|
|
|
the key-codes/key-bindings/key-seqs of KEYMAP [using (key-bindings VAR2)]
|
|
|
|
|
the overlays/intervals [of BUFFER] [from POS1] [to POS2]
|
|
|
|
|
the frames/buffers
|
|
|
|
|
the windows [of FRAME]
|
|
|
|
|
Iteration clauses:
|
|
|
|
|
repeat INTEGER
|
|
|
|
|
while/until/always/never/thereis CONDITION
|
|
|
|
|
Accumulation clauses:
|
|
|
|
|
collect/append/nconc/concat/vconcat/count/sum/maximize/minimize FORM
|
|
|
|
|
[into VAR]
|
|
|
|
|
Miscellaneous clauses:
|
|
|
|
|
with VAR = INIT
|
|
|
|
|
if/when/unless COND CLAUSE [and CLAUSE]... else CLAUSE [and CLAUSE...]
|
|
|
|
|
named NAME
|
|
|
|
|
initially/finally [do] EXPRS...
|
|
|
|
|
do EXPRS...
|
|
|
|
|
[finally] return EXPR
|
|
|
|
|
|
|
|
|
|
For more details, see Info node `(cl)Loop Facility'.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
|
|
|
|
\(fn CLAUSE...)"
|
2012-08-10 15:34:36 -04:00
|
|
|
|
(declare (debug (&rest &or
|
|
|
|
|
;; These are usually followed by a symbol, but it can
|
|
|
|
|
;; actually be any destructuring-bind pattern, which
|
|
|
|
|
;; would erroneously match `form'.
|
|
|
|
|
[[&or "for" "as" "with" "and"] sexp]
|
|
|
|
|
;; These are followed by expressions which could
|
|
|
|
|
;; erroneously match `symbolp'.
|
|
|
|
|
[[&or "from" "upfrom" "downfrom" "to" "upto" "downto"
|
|
|
|
|
"above" "below" "by" "in" "on" "=" "across"
|
|
|
|
|
"repeat" "while" "until" "always" "never"
|
|
|
|
|
"thereis" "collect" "append" "nconc" "sum"
|
|
|
|
|
"count" "maximize" "minimize" "if" "unless"
|
2014-10-17 01:09:24 -04:00
|
|
|
|
"return"]
|
|
|
|
|
form]
|
2016-11-25 14:14:41 -05:00
|
|
|
|
["using" (symbolp symbolp)]
|
2012-08-10 15:34:36 -04:00
|
|
|
|
;; Simple default, which covers 99% of the cases.
|
|
|
|
|
symbolp form)))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(if (not (memq t (mapcar #'symbolp
|
|
|
|
|
(delq nil (delq t (cl-copy-list loop-args))))))
|
2012-06-08 09:18:26 -04:00
|
|
|
|
`(cl-block nil (while t ,@loop-args))
|
|
|
|
|
(let ((cl--loop-args loop-args) (cl--loop-name nil) (cl--loop-bindings nil)
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(cl--loop-body nil) (cl--loop-steps nil)
|
|
|
|
|
(cl--loop-result nil) (cl--loop-result-explicit nil)
|
|
|
|
|
(cl--loop-result-var nil) (cl--loop-finish-flag nil)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(cl--loop-accum-var nil) (cl--loop-accum-vars nil)
|
|
|
|
|
(cl--loop-initially nil) (cl--loop-finally nil)
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(cl--loop-iterator-function nil) (cl--loop-first-flag nil)
|
2018-01-08 19:11:20 +09:00
|
|
|
|
(cl--loop-symbol-macs nil) (cl--loop-guard-cond nil))
|
2013-09-27 21:07:18 -04:00
|
|
|
|
;; Here is more or less how those dynbind vars are used after looping
|
|
|
|
|
;; over cl--parse-loop-clause:
|
|
|
|
|
;;
|
|
|
|
|
;; (cl-block ,cl--loop-name
|
|
|
|
|
;; (cl-symbol-macrolet ,cl--loop-symbol-macs
|
|
|
|
|
;; (foldl #'cl--loop-let
|
|
|
|
|
;; `((,cl--loop-result-var)
|
|
|
|
|
;; ((,cl--loop-first-flag t))
|
|
|
|
|
;; ((,cl--loop-finish-flag t))
|
|
|
|
|
;; ,@cl--loop-bindings)
|
|
|
|
|
;; ,@(nreverse cl--loop-initially)
|
|
|
|
|
;; (while ;(well: cl--loop-iterator-function)
|
|
|
|
|
;; ,(car (cl--loop-build-ands (nreverse cl--loop-body)))
|
|
|
|
|
;; ,@(cadr (cl--loop-build-ands (nreverse cl--loop-body)))
|
|
|
|
|
;; ,@(nreverse cl--loop-steps)
|
|
|
|
|
;; (setq ,cl--loop-first-flag nil))
|
|
|
|
|
;; (if (not ,cl--loop-finish-flag) ;FIXME: Why `if' vs `progn'?
|
|
|
|
|
;; ,cl--loop-result-var
|
|
|
|
|
;; ,@(nreverse cl--loop-finally)
|
|
|
|
|
;; ,(or cl--loop-result-explicit
|
|
|
|
|
;; cl--loop-result)))))
|
|
|
|
|
;;
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(setq cl--loop-args (append cl--loop-args '(cl-end-loop)))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(while (not (eq (car cl--loop-args) 'cl-end-loop))
|
|
|
|
|
(cl--parse-loop-clause))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if cl--loop-finish-flag
|
|
|
|
|
(push `((,cl--loop-finish-flag t)) cl--loop-bindings))
|
|
|
|
|
(if cl--loop-first-flag
|
|
|
|
|
(progn (push `((,cl--loop-first-flag t)) cl--loop-bindings)
|
|
|
|
|
(push `(setq ,cl--loop-first-flag nil) cl--loop-steps)))
|
|
|
|
|
(let* ((epilogue (nconc (nreverse cl--loop-finally)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(list (or cl--loop-result-explicit
|
|
|
|
|
cl--loop-result))))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(ands (cl--loop-build-ands (nreverse cl--loop-body)))
|
2018-01-08 19:11:20 +09:00
|
|
|
|
(while-body
|
|
|
|
|
(nconc
|
|
|
|
|
(cadr ands)
|
|
|
|
|
(if (or (not cl--loop-guard-cond) (not cl--loop-first-flag))
|
|
|
|
|
(nreverse cl--loop-steps)
|
|
|
|
|
;; Right after update the loop variable ensure that the loop
|
|
|
|
|
;; condition, i.e. (car ands), is still satisfied; otherwise,
|
|
|
|
|
;; set `cl--loop-first-flag' nil and skip the remaining
|
|
|
|
|
;; body forms (#Bug#29799).
|
|
|
|
|
;;
|
|
|
|
|
;; (last cl--loop-steps) updates the loop var
|
|
|
|
|
;; (car (butlast cl--loop-steps)) sets `cl--loop-first-flag' nil
|
|
|
|
|
;; (nreverse (cdr (butlast cl--loop-steps))) are the
|
|
|
|
|
;; remaining body forms.
|
|
|
|
|
(append (last cl--loop-steps)
|
|
|
|
|
`((and ,(car ands)
|
|
|
|
|
,@(nreverse (cdr (butlast cl--loop-steps)))))
|
|
|
|
|
`(,(car (butlast cl--loop-steps)))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(body (append
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(nreverse cl--loop-initially)
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(list (if cl--loop-iterator-function
|
2012-06-03 21:05:17 -04:00
|
|
|
|
`(cl-block --cl-finish--
|
2013-09-27 21:07:18 -04:00
|
|
|
|
,(funcall cl--loop-iterator-function
|
|
|
|
|
(if (eq (car ands) t) while-body
|
|
|
|
|
(cons `(or ,(car ands)
|
|
|
|
|
(cl-return-from
|
|
|
|
|
--cl-finish--
|
|
|
|
|
nil))
|
|
|
|
|
while-body))))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(while ,(car ands) ,@while-body)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if cl--loop-finish-flag
|
|
|
|
|
(if (equal epilogue '(nil)) (list cl--loop-result-var)
|
|
|
|
|
`((if ,cl--loop-finish-flag
|
|
|
|
|
(progn ,@epilogue) ,cl--loop-result-var)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
epilogue))))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(if cl--loop-result-var
|
|
|
|
|
(push (list cl--loop-result-var) cl--loop-bindings))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(while cl--loop-bindings
|
|
|
|
|
(if (cdar cl--loop-bindings)
|
|
|
|
|
(setq body (list (cl--loop-let (pop cl--loop-bindings) body t)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((lets nil))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(while (and cl--loop-bindings
|
|
|
|
|
(not (cdar cl--loop-bindings)))
|
|
|
|
|
(push (car (pop cl--loop-bindings)) lets))
|
|
|
|
|
(setq body (list (cl--loop-let lets body nil))))))
|
|
|
|
|
(if cl--loop-symbol-macs
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(setq body
|
|
|
|
|
(list `(cl-symbol-macrolet ,cl--loop-symbol-macs ,@body))))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
`(cl-block ,cl--loop-name ,@body)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-06-03 21:05:17 -04:00
|
|
|
|
;; Below is a complete spec for cl-loop, in several parts that correspond
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; to the syntax given in CLtL2. The specs do more than specify where
|
|
|
|
|
;; the forms are; it also specifies, as much as Edebug allows, all the
|
2012-06-03 21:05:17 -04:00
|
|
|
|
;; syntactically valid cl-loop clauses. The disadvantage of this
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; completeness is rigidity, but the "for ... being" clause allows
|
|
|
|
|
;; arbitrary extensions of the form: [symbolp &rest &or symbolp form].
|
|
|
|
|
|
2012-06-03 21:05:17 -04:00
|
|
|
|
;; (def-edebug-spec cl-loop
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; ([&optional ["named" symbolp]]
|
|
|
|
|
;; [&rest
|
|
|
|
|
;; &or
|
|
|
|
|
;; ["repeat" form]
|
|
|
|
|
;; loop-for-as
|
|
|
|
|
;; loop-with
|
|
|
|
|
;; loop-initial-final]
|
|
|
|
|
;; [&rest loop-clause]
|
|
|
|
|
;; ))
|
|
|
|
|
|
|
|
|
|
;; (def-edebug-spec loop-with
|
|
|
|
|
;; ("with" loop-var
|
|
|
|
|
;; loop-type-spec
|
|
|
|
|
;; [&optional ["=" form]]
|
|
|
|
|
;; &rest ["and" loop-var
|
|
|
|
|
;; loop-type-spec
|
|
|
|
|
;; [&optional ["=" form]]]))
|
|
|
|
|
|
|
|
|
|
;; (def-edebug-spec loop-for-as
|
|
|
|
|
;; ([&or "for" "as"] loop-for-as-subclause
|
|
|
|
|
;; &rest ["and" loop-for-as-subclause]))
|
|
|
|
|
|
|
|
|
|
;; (def-edebug-spec loop-for-as-subclause
|
|
|
|
|
;; (loop-var
|
|
|
|
|
;; loop-type-spec
|
|
|
|
|
;; &or
|
|
|
|
|
;; [[&or "in" "on" "in-ref" "across-ref"]
|
|
|
|
|
;; form &optional ["by" function-form]]
|
|
|
|
|
|
|
|
|
|
;; ["=" form &optional ["then" form]]
|
|
|
|
|
;; ["across" form]
|
|
|
|
|
;; ["being"
|
|
|
|
|
;; [&or "the" "each"]
|
|
|
|
|
;; &or
|
|
|
|
|
;; [[&or "element" "elements"]
|
|
|
|
|
;; [&or "of" "in" "of-ref"] form
|
|
|
|
|
;; &optional "using" ["index" symbolp]];; is this right?
|
|
|
|
|
;; [[&or "hash-key" "hash-keys"
|
|
|
|
|
;; "hash-value" "hash-values"]
|
|
|
|
|
;; [&or "of" "in"]
|
|
|
|
|
;; hash-table-p &optional ["using" ([&or "hash-value" "hash-values"
|
|
|
|
|
;; "hash-key" "hash-keys"] sexp)]]
|
|
|
|
|
|
|
|
|
|
;; [[&or "symbol" "present-symbol" "external-symbol"
|
|
|
|
|
;; "symbols" "present-symbols" "external-symbols"]
|
|
|
|
|
;; [&or "in" "of"] package-p]
|
|
|
|
|
|
|
|
|
|
;; ;; Extensions for Emacs Lisp, including Lucid Emacs.
|
|
|
|
|
;; [[&or "frame" "frames"
|
|
|
|
|
;; "screen" "screens"
|
|
|
|
|
;; "buffer" "buffers"]]
|
|
|
|
|
|
|
|
|
|
;; [[&or "window" "windows"]
|
|
|
|
|
;; [&or "of" "in"] form]
|
|
|
|
|
|
|
|
|
|
;; [[&or "overlay" "overlays"
|
|
|
|
|
;; "extent" "extents"]
|
|
|
|
|
;; [&or "of" "in"] form
|
|
|
|
|
;; &optional [[&or "from" "to"] form]]
|
|
|
|
|
|
|
|
|
|
;; [[&or "interval" "intervals"]
|
|
|
|
|
;; [&or "in" "of"] form
|
|
|
|
|
;; &optional [[&or "from" "to"] form]
|
|
|
|
|
;; ["property" form]]
|
|
|
|
|
|
|
|
|
|
;; [[&or "key-code" "key-codes"
|
|
|
|
|
;; "key-seq" "key-seqs"
|
|
|
|
|
;; "key-binding" "key-bindings"]
|
|
|
|
|
;; [&or "in" "of"] form
|
|
|
|
|
;; &optional ["using" ([&or "key-code" "key-codes"
|
|
|
|
|
;; "key-seq" "key-seqs"
|
|
|
|
|
;; "key-binding" "key-bindings"]
|
|
|
|
|
;; sexp)]]
|
|
|
|
|
;; ;; For arbitrary extensions, recognize anything else.
|
|
|
|
|
;; [symbolp &rest &or symbolp form]
|
|
|
|
|
;; ]
|
|
|
|
|
|
|
|
|
|
;; ;; arithmetic - must be last since all parts are optional.
|
|
|
|
|
;; [[&optional [[&or "from" "downfrom" "upfrom"] form]]
|
|
|
|
|
;; [&optional [[&or "to" "downto" "upto" "below" "above"] form]]
|
|
|
|
|
;; [&optional ["by" form]]
|
|
|
|
|
;; ]))
|
|
|
|
|
|
|
|
|
|
;; (def-edebug-spec loop-initial-final
|
|
|
|
|
;; (&or ["initially"
|
|
|
|
|
;; ;; [&optional &or "do" "doing"] ;; CLtL2 doesn't allow this.
|
|
|
|
|
;; &rest loop-non-atomic-expr]
|
|
|
|
|
;; ["finally" &or
|
|
|
|
|
;; [[&optional &or "do" "doing"] &rest loop-non-atomic-expr]
|
|
|
|
|
;; ["return" form]]))
|
|
|
|
|
|
|
|
|
|
;; (def-edebug-spec loop-and-clause
|
|
|
|
|
;; (loop-clause &rest ["and" loop-clause]))
|
|
|
|
|
|
|
|
|
|
;; (def-edebug-spec loop-clause
|
|
|
|
|
;; (&or
|
|
|
|
|
;; [[&or "while" "until" "always" "never" "thereis"] form]
|
|
|
|
|
|
|
|
|
|
;; [[&or "collect" "collecting"
|
|
|
|
|
;; "append" "appending"
|
|
|
|
|
;; "nconc" "nconcing"
|
|
|
|
|
;; "concat" "vconcat"] form
|
|
|
|
|
;; [&optional ["into" loop-var]]]
|
|
|
|
|
|
|
|
|
|
;; [[&or "count" "counting"
|
|
|
|
|
;; "sum" "summing"
|
|
|
|
|
;; "maximize" "maximizing"
|
|
|
|
|
;; "minimize" "minimizing"] form
|
|
|
|
|
;; [&optional ["into" loop-var]]
|
|
|
|
|
;; loop-type-spec]
|
|
|
|
|
|
|
|
|
|
;; [[&or "if" "when" "unless"]
|
|
|
|
|
;; form loop-and-clause
|
|
|
|
|
;; [&optional ["else" loop-and-clause]]
|
|
|
|
|
;; [&optional "end"]]
|
|
|
|
|
|
|
|
|
|
;; [[&or "do" "doing"] &rest loop-non-atomic-expr]
|
|
|
|
|
|
|
|
|
|
;; ["return" form]
|
|
|
|
|
;; loop-initial-final
|
|
|
|
|
;; ))
|
|
|
|
|
|
|
|
|
|
;; (def-edebug-spec loop-non-atomic-expr
|
|
|
|
|
;; ([¬ atom] form))
|
|
|
|
|
|
|
|
|
|
;; (def-edebug-spec loop-var
|
|
|
|
|
;; ;; The symbolp must be last alternative to recognize e.g. (a b . c)
|
|
|
|
|
;; ;; loop-var =>
|
|
|
|
|
;; ;; (loop-var . [&or nil loop-var])
|
|
|
|
|
;; ;; (symbolp . [&or nil loop-var])
|
|
|
|
|
;; ;; (symbolp . loop-var)
|
|
|
|
|
;; ;; (symbolp . (symbolp . [&or nil loop-var]))
|
|
|
|
|
;; ;; (symbolp . (symbolp . loop-var))
|
|
|
|
|
;; ;; (symbolp . (symbolp . symbolp)) == (symbolp symbolp . symbolp)
|
|
|
|
|
;; (&or (loop-var . [&or nil loop-var]) [gate symbolp]))
|
|
|
|
|
|
|
|
|
|
;; (def-edebug-spec loop-type-spec
|
|
|
|
|
;; (&optional ["of-type" loop-d-type-spec]))
|
|
|
|
|
|
|
|
|
|
;; (def-edebug-spec loop-d-type-spec
|
|
|
|
|
;; (&or (loop-d-type-spec . [&or nil loop-d-type-spec]) cl-type-spec))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(defun cl--parse-loop-clause () ; uses loop-*
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let ((word (pop cl--loop-args))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(hash-types '(hash-key hash-keys hash-value hash-values))
|
|
|
|
|
(key-types '(key-code key-codes key-seq key-seqs
|
|
|
|
|
key-binding key-bindings)))
|
|
|
|
|
(cond
|
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
((null cl--loop-args)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Malformed `cl-loop' macro"))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'named)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(setq cl--loop-name (pop cl--loop-args)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'initially)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (memq (car cl--loop-args) '(do doing)) (pop cl--loop-args))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(or (consp (car cl--loop-args))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Syntax error on `initially' clause"))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(while (consp (car cl--loop-args))
|
|
|
|
|
(push (pop cl--loop-args) cl--loop-initially)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'finally)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (eq (car cl--loop-args) 'return)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(setq cl--loop-result-explicit
|
|
|
|
|
(or (cl--pop2 cl--loop-args) '(quote nil)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (memq (car cl--loop-args) '(do doing)) (pop cl--loop-args))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(or (consp (car cl--loop-args))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Syntax error on `finally' clause"))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (and (eq (caar cl--loop-args) 'return) (null cl--loop-name))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(setq cl--loop-result-explicit
|
|
|
|
|
(or (nth 1 (pop cl--loop-args)) '(quote nil)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(while (consp (car cl--loop-args))
|
|
|
|
|
(push (pop cl--loop-args) cl--loop-finally)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(for as))
|
|
|
|
|
(let ((loop-for-bindings nil) (loop-for-sets nil) (loop-for-steps nil)
|
|
|
|
|
(ands nil))
|
|
|
|
|
(while
|
2012-06-03 21:05:17 -04:00
|
|
|
|
;; Use `cl-gensym' rather than `make-symbol'. It's important that
|
2004-11-27 00:20:38 +00:00
|
|
|
|
;; (not (eq (symbol-name var1) (symbol-name var2))) because
|
2012-06-07 15:25:48 -04:00
|
|
|
|
;; these vars get added to the macro-environment.
|
|
|
|
|
(let ((var (or (pop cl--loop-args) (cl-gensym "--cl-var--"))))
|
|
|
|
|
(setq word (pop cl--loop-args))
|
|
|
|
|
(if (eq word 'being) (setq word (pop cl--loop-args)))
|
|
|
|
|
(if (memq word '(the each)) (setq word (pop cl--loop-args)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (memq word '(buffer buffers))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(setq word 'in
|
|
|
|
|
cl--loop-args (cons '(buffer-list) cl--loop-args)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(cond
|
|
|
|
|
|
|
|
|
|
((memq word '(from downfrom upfrom to downto upto
|
|
|
|
|
above below by))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push word cl--loop-args)
|
|
|
|
|
(if (memq (car cl--loop-args) '(downto above))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Must specify `from' value for downward cl-loop"))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let* ((down (or (eq (car cl--loop-args) 'downfrom)
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(memq (nth 2 cl--loop-args)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
'(downto above))))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(excl (or (memq (car cl--loop-args) '(above below))
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(memq (nth 2 cl--loop-args)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
'(above below))))
|
|
|
|
|
(start (and (memq (car cl--loop-args)
|
|
|
|
|
'(from upfrom downfrom))
|
|
|
|
|
(cl--pop2 cl--loop-args)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(end (and (memq (car cl--loop-args)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
'(to upto downto above below))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(cl--pop2 cl--loop-args)))
|
|
|
|
|
(step (and (eq (car cl--loop-args) 'by)
|
|
|
|
|
(cl--pop2 cl--loop-args)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(end-var (and (not (macroexp-const-p end))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(make-symbol "--cl-var--")))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(step-var (and (not (macroexp-const-p step))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(make-symbol "--cl-var--"))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(and step (numberp step) (<= step 0)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Loop `by' value is not positive: %s" step))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list var (or start 0)) loop-for-bindings)
|
|
|
|
|
(if end-var (push (list end-var end) loop-for-bindings))
|
|
|
|
|
(if step-var (push (list step-var step)
|
2004-11-16 04:05:29 +00:00
|
|
|
|
loop-for-bindings))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if end
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(if down (if excl '> '>=) (if excl '< '<=))
|
2014-10-17 01:09:24 -04:00
|
|
|
|
var (or end-var end))
|
|
|
|
|
cl--loop-body))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list var (list (if down '- '+) var
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(or step-var step 1)))
|
|
|
|
|
loop-for-steps)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(in in-ref on))
|
|
|
|
|
(let* ((on (eq word 'on))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(temp (if (and on (symbolp var))
|
|
|
|
|
var (make-symbol "--cl-var--"))))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push (list temp (pop cl--loop-args)) loop-for-bindings)
|
|
|
|
|
(push `(consp ,temp) cl--loop-body)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (eq word 'in-ref)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push (list var `(car ,temp)) cl--loop-symbol-macs)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(or (eq temp var)
|
|
|
|
|
(progn
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list var nil) loop-for-bindings)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push (list var (if on temp `(car ,temp)))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
loop-for-sets))))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list temp
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (eq (car cl--loop-args) 'by)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(let ((step (cl--pop2 cl--loop-args)))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(if (and (memq (car-safe step)
|
|
|
|
|
'(quote function
|
2012-06-03 21:05:17 -04:00
|
|
|
|
cl-function))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(symbolp (nth 1 step)))
|
|
|
|
|
(list (nth 1 step) temp)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(funcall ,step ,temp)))
|
|
|
|
|
`(cdr ,temp)))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
loop-for-steps)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word '=)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let* ((start (pop cl--loop-args))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(then (if (eq (car cl--loop-args) 'then)
|
|
|
|
|
(cl--pop2 cl--loop-args) start)))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list var nil) loop-for-bindings)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (or ands (eq (car cl--loop-args) 'and))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(progn
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(push `(,var
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if ,(or cl--loop-first-flag
|
|
|
|
|
(setq cl--loop-first-flag
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(make-symbol "--cl-var--")))
|
|
|
|
|
,start ,var))
|
|
|
|
|
loop-for-sets)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list var then) loop-for-steps))
|
|
|
|
|
(push (list var
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(if (eq start then) start
|
2012-06-07 15:25:48 -04:00
|
|
|
|
`(if ,(or cl--loop-first-flag
|
|
|
|
|
(setq cl--loop-first-flag
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(make-symbol "--cl-var--")))
|
|
|
|
|
,start ,then)))
|
|
|
|
|
loop-for-sets))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(across across-ref))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(let ((temp-vec (make-symbol "--cl-vec--"))
|
2018-01-08 00:33:13 +09:00
|
|
|
|
(temp-len (make-symbol "--cl-len--"))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(temp-idx (make-symbol "--cl-idx--")))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push (list temp-vec (pop cl--loop-args)) loop-for-bindings)
|
2018-01-08 00:33:13 +09:00
|
|
|
|
(push (list temp-len `(length ,temp-vec)) loop-for-bindings)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list temp-idx -1) loop-for-bindings)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push `(< (setq ,temp-idx (1+ ,temp-idx))
|
2018-01-08 00:33:13 +09:00
|
|
|
|
,temp-len)
|
2014-10-17 01:09:24 -04:00
|
|
|
|
cl--loop-body)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (eq word 'across-ref)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push (list var `(aref ,temp-vec ,temp-idx))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
cl--loop-symbol-macs)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list var nil) loop-for-bindings)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push (list var `(aref ,temp-vec ,temp-idx))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
loop-for-sets))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(element elements))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let ((ref (or (memq (car cl--loop-args) '(in-ref of-ref))
|
|
|
|
|
(and (not (memq (car cl--loop-args) '(in of)))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Expected `of'"))))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(seq (cl--pop2 cl--loop-args))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(temp-seq (make-symbol "--cl-seq--"))
|
2018-01-08 00:33:13 +09:00
|
|
|
|
(temp-len (make-symbol "--cl-len--"))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(temp-idx
|
|
|
|
|
(if (eq (car cl--loop-args) 'using)
|
|
|
|
|
(if (and (= (length (cadr cl--loop-args)) 2)
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(eq (cl-caadr cl--loop-args) 'index))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(cadr (cl--pop2 cl--loop-args))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Bad `using' clause"))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(make-symbol "--cl-idx--"))))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list temp-seq seq) loop-for-bindings)
|
|
|
|
|
(push (list temp-idx 0) loop-for-bindings)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if ref
|
2018-01-08 00:33:13 +09:00
|
|
|
|
(progn
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push (list temp-len `(length ,temp-seq))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
loop-for-bindings)
|
2012-06-11 16:47:33 -04:00
|
|
|
|
(push (list var `(elt ,temp-seq ,temp-idx))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
cl--loop-symbol-macs)
|
|
|
|
|
(push `(< ,temp-idx ,temp-len) cl--loop-body))
|
2018-01-08 00:33:13 +09:00
|
|
|
|
;; Evaluate seq length just if needed, that is, when seq is not a cons.
|
|
|
|
|
(push (list temp-len (or (consp seq) `(length ,temp-seq)))
|
|
|
|
|
loop-for-bindings)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list var nil) loop-for-bindings)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push `(and ,temp-seq
|
|
|
|
|
(or (consp ,temp-seq)
|
2018-01-08 00:33:13 +09:00
|
|
|
|
(< ,temp-idx ,temp-len)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
cl--loop-body)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push (list var `(if (consp ,temp-seq)
|
|
|
|
|
(pop ,temp-seq)
|
|
|
|
|
(aref ,temp-seq ,temp-idx)))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
loop-for-sets))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push (list temp-idx `(1+ ,temp-idx))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
loop-for-steps)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word hash-types)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(or (memq (car cl--loop-args) '(in of))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Expected `of'"))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(let* ((table (cl--pop2 cl--loop-args))
|
|
|
|
|
(other
|
|
|
|
|
(if (eq (car cl--loop-args) 'using)
|
|
|
|
|
(if (and (= (length (cadr cl--loop-args)) 2)
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(memq (cl-caadr cl--loop-args) hash-types)
|
|
|
|
|
(not (eq (cl-caadr cl--loop-args) word)))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(cadr (cl--pop2 cl--loop-args))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Bad `using' clause"))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(make-symbol "--cl-var--"))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (memq word '(hash-value hash-values))
|
|
|
|
|
(setq var (prog1 other (setq other var))))
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(cl--loop-set-iterator-function
|
|
|
|
|
'hash-tables (lambda (body)
|
|
|
|
|
`(maphash (lambda (,var ,other) . ,body)
|
|
|
|
|
,table)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(symbol present-symbol external-symbol
|
|
|
|
|
symbols present-symbols external-symbols))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(let ((ob (and (memq (car cl--loop-args) '(in of))
|
|
|
|
|
(cl--pop2 cl--loop-args))))
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(cl--loop-set-iterator-function
|
|
|
|
|
'symbols (lambda (body)
|
|
|
|
|
`(mapatoms (lambda (,var) . ,body) ,ob)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(overlay overlays extent extents))
|
|
|
|
|
(let ((buf nil) (from nil) (to nil))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(while (memq (car cl--loop-args) '(in of from to))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(cond ((eq (car cl--loop-args) 'from)
|
|
|
|
|
(setq from (cl--pop2 cl--loop-args)))
|
|
|
|
|
((eq (car cl--loop-args) 'to)
|
|
|
|
|
(setq to (cl--pop2 cl--loop-args)))
|
|
|
|
|
(t (setq buf (cl--pop2 cl--loop-args)))))
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(cl--loop-set-iterator-function
|
|
|
|
|
'overlays (lambda (body)
|
|
|
|
|
`(cl--map-overlays
|
|
|
|
|
(lambda (,var ,(make-symbol "--cl-var--"))
|
|
|
|
|
(progn . ,body) nil)
|
|
|
|
|
,buf ,from ,to)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(interval intervals))
|
|
|
|
|
(let ((buf nil) (prop nil) (from nil) (to nil)
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(var1 (make-symbol "--cl-var1--"))
|
|
|
|
|
(var2 (make-symbol "--cl-var2--")))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(while (memq (car cl--loop-args) '(in of property from to))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(cond ((eq (car cl--loop-args) 'from)
|
|
|
|
|
(setq from (cl--pop2 cl--loop-args)))
|
|
|
|
|
((eq (car cl--loop-args) 'to)
|
|
|
|
|
(setq to (cl--pop2 cl--loop-args)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
((eq (car cl--loop-args) 'property)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(setq prop (cl--pop2 cl--loop-args)))
|
|
|
|
|
(t (setq buf (cl--pop2 cl--loop-args)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (and (consp var) (symbolp (car var)) (symbolp (cdr var)))
|
|
|
|
|
(setq var1 (car var) var2 (cdr var))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push (list var `(cons ,var1 ,var2)) loop-for-sets))
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(cl--loop-set-iterator-function
|
|
|
|
|
'intervals (lambda (body)
|
|
|
|
|
`(cl--map-intervals
|
|
|
|
|
(lambda (,var1 ,var2) . ,body)
|
|
|
|
|
,buf ,prop ,from ,to)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word key-types)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(or (memq (car cl--loop-args) '(in of))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Expected `of'"))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(let ((cl-map (cl--pop2 cl--loop-args))
|
|
|
|
|
(other
|
|
|
|
|
(if (eq (car cl--loop-args) 'using)
|
|
|
|
|
(if (and (= (length (cadr cl--loop-args)) 2)
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(memq (cl-caadr cl--loop-args) key-types)
|
|
|
|
|
(not (eq (cl-caadr cl--loop-args) word)))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(cadr (cl--pop2 cl--loop-args))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Bad `using' clause"))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(make-symbol "--cl-var--"))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (memq word '(key-binding key-bindings))
|
|
|
|
|
(setq var (prog1 other (setq other var))))
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(cl--loop-set-iterator-function
|
|
|
|
|
'keys (lambda (body)
|
|
|
|
|
`(,(if (memq word '(key-seq key-seqs))
|
|
|
|
|
'cl--map-keymap-recursively 'map-keymap)
|
|
|
|
|
(lambda (,var ,other) . ,body) ,cl-map)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(frame frames screen screens))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(let ((temp (make-symbol "--cl-var--")))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list var '(selected-frame))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
loop-for-bindings)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list temp nil) loop-for-bindings)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push `(prog1 (not (eq ,var ,temp))
|
|
|
|
|
(or ,temp (setq ,temp ,var)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
cl--loop-body)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push (list var `(next-frame ,var))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
loop-for-steps)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(window windows))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(let ((scr (and (memq (car cl--loop-args) '(in of))
|
|
|
|
|
(cl--pop2 cl--loop-args)))
|
2010-12-02 09:36:45 -08:00
|
|
|
|
(temp (make-symbol "--cl-var--"))
|
|
|
|
|
(minip (make-symbol "--cl-minip--")))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list var (if scr
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(frame-selected-window ,scr)
|
2004-11-16 04:05:29 +00:00
|
|
|
|
'(selected-window)))
|
|
|
|
|
loop-for-bindings)
|
2010-12-02 09:36:45 -08:00
|
|
|
|
;; If we started in the minibuffer, we need to
|
|
|
|
|
;; ensure that next-window will bring us back there
|
|
|
|
|
;; at some point. (Bug#7492).
|
2012-06-03 21:05:17 -04:00
|
|
|
|
;; (Consider using walk-windows instead of cl-loop if
|
2010-12-02 09:36:45 -08:00
|
|
|
|
;; you care about such things.)
|
|
|
|
|
(push (list minip `(minibufferp (window-buffer ,var)))
|
|
|
|
|
loop-for-bindings)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list temp nil) loop-for-bindings)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push `(prog1 (not (eq ,var ,temp))
|
|
|
|
|
(or ,temp (setq ,temp ,var)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
cl--loop-body)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push (list var `(next-window ,var ,minip))
|
2010-12-02 09:36:45 -08:00
|
|
|
|
loop-for-steps)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
(t
|
2012-11-03 11:32:09 -07:00
|
|
|
|
;; This is an advertised interface: (info "(cl)Other Clauses").
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((handler (and (symbolp word)
|
2012-11-03 11:32:09 -07:00
|
|
|
|
(get word 'cl-loop-for-handler))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if handler
|
|
|
|
|
(funcall handler var)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Expected a `for' preposition, found %s" word)))))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(eq (car cl--loop-args) 'and))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq ands t)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(pop cl--loop-args))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (and ands loop-for-bindings)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push (nreverse loop-for-bindings) cl--loop-bindings)
|
|
|
|
|
(setq cl--loop-bindings (nconc (mapcar 'list loop-for-bindings)
|
|
|
|
|
cl--loop-bindings)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if loop-for-sets
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push `(progn
|
2012-06-07 15:25:48 -04:00
|
|
|
|
,(cl--loop-let (nreverse loop-for-sets) 'setq ands)
|
2014-10-17 01:09:24 -04:00
|
|
|
|
t)
|
|
|
|
|
cl--loop-body))
|
2018-01-08 19:11:20 +09:00
|
|
|
|
(when loop-for-steps
|
|
|
|
|
(setq cl--loop-guard-cond t)
|
|
|
|
|
(push (cons (if ands 'cl-psetq 'setq)
|
|
|
|
|
(apply 'append (nreverse loop-for-steps)))
|
|
|
|
|
cl--loop-steps))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'repeat)
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(let ((temp (make-symbol "--cl-var--")))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push (list (list temp (pop cl--loop-args))) cl--loop-bindings)
|
|
|
|
|
(push `(>= (setq ,temp (1- ,temp)) 0) cl--loop-body)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2000-01-28 17:31:00 +00:00
|
|
|
|
((memq word '(collect collecting))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let ((what (pop cl--loop-args))
|
|
|
|
|
(var (cl--loop-handle-accum nil 'nreverse)))
|
|
|
|
|
(if (eq var cl--loop-accum-var)
|
|
|
|
|
(push `(progn (push ,what ,var) t) cl--loop-body)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push `(progn
|
|
|
|
|
(setq ,var (nconc ,var (list ,what)))
|
2014-10-17 01:09:24 -04:00
|
|
|
|
t)
|
|
|
|
|
cl--loop-body))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(nconc nconcing append appending))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let ((what (pop cl--loop-args))
|
|
|
|
|
(var (cl--loop-handle-accum nil 'nreverse)))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push `(progn
|
|
|
|
|
(setq ,var
|
2012-06-07 15:25:48 -04:00
|
|
|
|
,(if (eq var cl--loop-accum-var)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(nconc
|
|
|
|
|
(,(if (memq word '(nconc nconcing))
|
|
|
|
|
#'nreverse #'reverse)
|
|
|
|
|
,what)
|
|
|
|
|
,var)
|
|
|
|
|
`(,(if (memq word '(nconc nconcing))
|
|
|
|
|
#'nconc #'append)
|
2014-10-17 01:09:24 -04:00
|
|
|
|
,var ,what)))
|
|
|
|
|
t)
|
|
|
|
|
cl--loop-body)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(concat concating))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let ((what (pop cl--loop-args))
|
|
|
|
|
(var (cl--loop-handle-accum "")))
|
|
|
|
|
(push `(progn (cl-callf concat ,var ,what) t) cl--loop-body)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(vconcat vconcating))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let ((what (pop cl--loop-args))
|
|
|
|
|
(var (cl--loop-handle-accum [])))
|
|
|
|
|
(push `(progn (cl-callf vconcat ,var ,what) t) cl--loop-body)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(sum summing))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let ((what (pop cl--loop-args))
|
|
|
|
|
(var (cl--loop-handle-accum 0)))
|
|
|
|
|
(push `(progn (cl-incf ,var ,what) t) cl--loop-body)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(count counting))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let ((what (pop cl--loop-args))
|
|
|
|
|
(var (cl--loop-handle-accum 0)))
|
|
|
|
|
(push `(progn (if ,what (cl-incf ,var)) t) cl--loop-body)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(minimize minimizing maximize maximizing))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(push `(progn ,(macroexp-let2 macroexp-copyable-p temp
|
|
|
|
|
(pop cl--loop-args)
|
|
|
|
|
(let* ((var (cl--loop-handle-accum nil))
|
|
|
|
|
(func (intern (substring (symbol-name word)
|
|
|
|
|
0 3))))
|
|
|
|
|
`(setq ,var (if ,var (,func ,var ,temp) ,temp))))
|
|
|
|
|
t)
|
|
|
|
|
cl--loop-body))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'with)
|
|
|
|
|
(let ((bindings nil))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(while (progn (push (list (pop cl--loop-args)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(and (eq (car cl--loop-args) '=)
|
|
|
|
|
(cl--pop2 cl--loop-args)))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
bindings)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(eq (car cl--loop-args) 'and))
|
|
|
|
|
(pop cl--loop-args))
|
|
|
|
|
(push (nreverse bindings) cl--loop-bindings)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'while)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push (pop cl--loop-args) cl--loop-body))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'until)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push `(not ,(pop cl--loop-args)) cl--loop-body))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'always)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(or cl--loop-finish-flag
|
|
|
|
|
(setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push `(setq ,cl--loop-finish-flag ,(pop cl--loop-args)) cl--loop-body)
|
|
|
|
|
(setq cl--loop-result t))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'never)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(or cl--loop-finish-flag
|
|
|
|
|
(setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push `(setq ,cl--loop-finish-flag (not ,(pop cl--loop-args)))
|
|
|
|
|
cl--loop-body)
|
|
|
|
|
(setq cl--loop-result t))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'thereis)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(or cl--loop-finish-flag
|
|
|
|
|
(setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
|
|
|
|
|
(or cl--loop-result-var
|
|
|
|
|
(setq cl--loop-result-var (make-symbol "--cl-var--")))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push `(setq ,cl--loop-finish-flag
|
|
|
|
|
(not (setq ,cl--loop-result-var ,(pop cl--loop-args))))
|
|
|
|
|
cl--loop-body))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(if when unless))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let* ((cond (pop cl--loop-args))
|
|
|
|
|
(then (let ((cl--loop-body nil))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(cl--parse-loop-clause)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(cl--loop-build-ands (nreverse cl--loop-body))))
|
|
|
|
|
(else (let ((cl--loop-body nil))
|
|
|
|
|
(if (eq (car cl--loop-args) 'else)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(progn (pop cl--loop-args) (cl--parse-loop-clause)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(cl--loop-build-ands (nreverse cl--loop-body))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(simple (and (eq (car then) t) (eq (car else) t))))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (eq (car cl--loop-args) 'end) (pop cl--loop-args))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (eq word 'unless) (setq then (prog1 else (setq else then))))
|
|
|
|
|
(let ((form (cons (if simple (cons 'progn (nth 1 then)) (nth 2 then))
|
|
|
|
|
(if simple (nth 1 else) (list (nth 2 else))))))
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(setq form (if (cl--expr-contains form 'it)
|
|
|
|
|
`(let ((it ,cond)) (if it ,@form))
|
|
|
|
|
`(if ,cond ,@form)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push (if simple `(progn ,form t) form) cl--loop-body))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((memq word '(do doing))
|
|
|
|
|
(let ((body nil))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(or (consp (car cl--loop-args)) (error "Syntax error on `do' clause"))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(while (consp (car cl--loop-args)) (push (pop cl--loop-args) body))
|
|
|
|
|
(push (cons 'progn (nreverse (cons t body))) cl--loop-body)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq word 'return)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(or cl--loop-finish-flag
|
|
|
|
|
(setq cl--loop-finish-flag (make-symbol "--cl-var--")))
|
|
|
|
|
(or cl--loop-result-var
|
|
|
|
|
(setq cl--loop-result-var (make-symbol "--cl-var--")))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(push `(setq ,cl--loop-result-var ,(pop cl--loop-args)
|
2014-10-17 01:09:24 -04:00
|
|
|
|
,cl--loop-finish-flag nil)
|
|
|
|
|
cl--loop-body))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
(t
|
2012-11-03 11:32:09 -07:00
|
|
|
|
;; This is an advertised interface: (info "(cl)Other Clauses").
|
|
|
|
|
(let ((handler (and (symbolp word) (get word 'cl-loop-handler))))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(or handler (error "Expected a cl-loop keyword, found %s" word))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(funcall handler))))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (eq (car cl--loop-args) 'and)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(progn (pop cl--loop-args) (cl--parse-loop-clause)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(defun cl--unused-var-p (sym)
|
|
|
|
|
(or (null sym) (eq ?_ (aref (symbol-name sym) 0))))
|
|
|
|
|
|
|
|
|
|
(defun cl--loop-let (specs body par) ; modifies cl--loop-bindings
|
|
|
|
|
"Build an expression equivalent to (let SPECS BODY).
|
|
|
|
|
SPECS can include bindings using `cl-loop's destructuring (not to be
|
|
|
|
|
confused with the patterns of `cl-destructuring-bind').
|
|
|
|
|
If PAR is nil, do the bindings step by step, like `let*'.
|
|
|
|
|
If BODY is `setq', then use SPECS for assignments rather than for bindings."
|
|
|
|
|
(let ((temps nil) (new nil))
|
|
|
|
|
(when par
|
|
|
|
|
(let ((p specs))
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(while (and p (or (symbolp (car-safe (car p))) (null (cl-cadar p))))
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(setq p (cdr p)))
|
|
|
|
|
(when p
|
|
|
|
|
(setq par nil)
|
|
|
|
|
(dolist (spec specs)
|
|
|
|
|
(or (macroexp-const-p (cadr spec))
|
|
|
|
|
(let ((temp (make-symbol "--cl-var--")))
|
|
|
|
|
(push (list temp (cadr spec)) temps)
|
|
|
|
|
(setcar (cdr spec) temp)))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(while specs
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(let* ((binding (pop specs))
|
|
|
|
|
(spec (car-safe binding)))
|
|
|
|
|
(if (and (consp binding) (or (consp spec) (cl--unused-var-p spec)))
|
|
|
|
|
(let* ((nspecs nil)
|
|
|
|
|
(expr (car (cdr-safe binding)))
|
|
|
|
|
(temp (last spec 0)))
|
|
|
|
|
(if (and (cl--unused-var-p temp) (null expr))
|
|
|
|
|
nil ;; Don't bother declaring/setting `temp' since it won't
|
|
|
|
|
;; be used when `expr' is nil, anyway.
|
2014-04-22 21:40:35 -04:00
|
|
|
|
(when (or (null temp)
|
|
|
|
|
(and (eq body 'setq) (cl--unused-var-p temp)))
|
2013-09-27 21:07:18 -04:00
|
|
|
|
;; Prefer a fresh uninterned symbol over "_to", to avoid
|
|
|
|
|
;; warnings that we set an unused variable.
|
|
|
|
|
(setq temp (make-symbol "--cl-var--"))
|
|
|
|
|
;; Make sure this temp variable is locally declared.
|
2014-04-21 17:18:12 -04:00
|
|
|
|
(when (eq body 'setq)
|
|
|
|
|
(push (list (list temp)) cl--loop-bindings)))
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(push (list temp expr) new))
|
|
|
|
|
(while (consp spec)
|
|
|
|
|
(push (list (pop spec)
|
|
|
|
|
(and expr (list (if spec 'pop 'car) temp)))
|
|
|
|
|
nspecs))
|
|
|
|
|
(setq specs (nconc (nreverse nspecs) specs)))
|
|
|
|
|
(push binding new))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (eq body 'setq)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(let ((set (cons (if par 'cl-psetq 'setq)
|
|
|
|
|
(apply 'nconc (nreverse new)))))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(if temps `(let* ,(nreverse temps) ,set) set))
|
|
|
|
|
`(,(if par 'let 'let*)
|
|
|
|
|
,(nconc (nreverse temps) (nreverse new)) ,@body))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(defun cl--loop-handle-accum (def &optional func) ; uses loop-*
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (eq (car cl--loop-args) 'into)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(let ((var (cl--pop2 cl--loop-args)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(or (memq var cl--loop-accum-vars)
|
|
|
|
|
(progn (push (list (list var def)) cl--loop-bindings)
|
|
|
|
|
(push var cl--loop-accum-vars)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
var)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(or cl--loop-accum-var
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(progn
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(push (list (list
|
|
|
|
|
(setq cl--loop-accum-var (make-symbol "--cl-var--"))
|
|
|
|
|
def))
|
|
|
|
|
cl--loop-bindings)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(setq cl--loop-result (if func (list func cl--loop-accum-var)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
cl--loop-accum-var))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
cl--loop-accum-var))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--loop-build-ands (clauses)
|
2012-09-09 21:16:13 -04:00
|
|
|
|
"Return various representations of (and . CLAUSES).
|
|
|
|
|
CLAUSES is a list of Elisp expressions, where clauses of the form
|
|
|
|
|
\(progn E1 E2 E3 .. t) are the focus of particular optimizations.
|
|
|
|
|
The return value has shape (COND BODY COMBO)
|
|
|
|
|
such that COMBO is equivalent to (and . CLAUSES)."
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((ands nil)
|
|
|
|
|
(body nil))
|
2012-09-09 21:16:13 -04:00
|
|
|
|
;; Look through `clauses', trying to optimize (progn ,@A t) (progn ,@B) ,@C
|
|
|
|
|
;; into (progn ,@A ,@B) ,@C.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(while clauses
|
|
|
|
|
(if (and (eq (car-safe (car clauses)) 'progn)
|
|
|
|
|
(eq (car (last (car clauses))) t))
|
|
|
|
|
(if (cdr clauses)
|
|
|
|
|
(setq clauses (cons (nconc (butlast (car clauses))
|
|
|
|
|
(if (eq (car-safe (cadr clauses))
|
|
|
|
|
'progn)
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(cl-cdadr clauses)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(list (cadr clauses))))
|
|
|
|
|
(cddr clauses)))
|
2012-09-09 21:16:13 -04:00
|
|
|
|
;; A final (progn ,@A t) is moved outside of the `and'.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(setq body (cdr (butlast (pop clauses)))))
|
|
|
|
|
(push (pop clauses) ands)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq ands (or (nreverse ands) (list t)))
|
|
|
|
|
(list (if (cdr ands) (cons 'and ands) (car ands))
|
|
|
|
|
body
|
|
|
|
|
(let ((full (if body
|
|
|
|
|
(append ands (list (cons 'progn (append body '(t)))))
|
|
|
|
|
ands)))
|
|
|
|
|
(if (cdr full) (cons 'and full) (car full))))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Other iteration control structures.
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-do (steps endtest &rest body)
|
2018-09-29 18:06:03 +09:00
|
|
|
|
"Bind variables and run BODY forms until END-TEST returns non-nil.
|
|
|
|
|
First, each VAR is bound to the associated INIT value as if by a `let' form.
|
|
|
|
|
Then, in each iteration of the loop, the END-TEST is evaluated; if true,
|
|
|
|
|
the loop is finished. Otherwise, the BODY forms are evaluated, then each
|
|
|
|
|
VAR is set to the associated STEP expression (as if by a `cl-psetq' form)
|
|
|
|
|
and the next iteration begins.
|
|
|
|
|
|
|
|
|
|
Once the END-TEST becomes true, the RESULT forms are evaluated (with
|
|
|
|
|
the VARs still bound to their values) to produce the result
|
|
|
|
|
returned by `cl-do'.
|
|
|
|
|
|
|
|
|
|
Note that the entire loop is enclosed in an implicit `nil' block, so
|
|
|
|
|
that you can use `cl-return' to exit at any time.
|
|
|
|
|
|
|
|
|
|
Also note that END-TEST is checked before evaluating BODY. If END-TEST
|
|
|
|
|
is initially non-nil, `cl-do' will exit without running BODY.
|
|
|
|
|
|
|
|
|
|
For more details, see `cl-do' description in Info node `(cl) Iteration'.
|
2004-05-08 17:23:08 +00:00
|
|
|
|
|
|
|
|
|
\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 2)
|
|
|
|
|
(debug
|
2012-05-17 17:39:36 -04:00
|
|
|
|
((&rest &or symbolp (symbolp &optional form form))
|
|
|
|
|
(form body)
|
|
|
|
|
cl-declarations body)))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(cl--expand-do-loop steps endtest body nil))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-do* (steps endtest &rest body)
|
2018-09-29 18:06:03 +09:00
|
|
|
|
"Bind variables and run BODY forms until END-TEST returns non-nil.
|
|
|
|
|
First, each VAR is bound to the associated INIT value as if by a `let*' form.
|
|
|
|
|
Then, in each iteration of the loop, the END-TEST is evaluated; if true,
|
|
|
|
|
the loop is finished. Otherwise, the BODY forms are evaluated, then each
|
|
|
|
|
VAR is set to the associated STEP expression (as if by a `setq'
|
|
|
|
|
form) and the next iteration begins.
|
|
|
|
|
|
|
|
|
|
Once the END-TEST becomes true, the RESULT forms are evaluated (with
|
|
|
|
|
the VARs still bound to their values) to produce the result
|
|
|
|
|
returned by `cl-do*'.
|
|
|
|
|
|
|
|
|
|
Note that the entire loop is enclosed in an implicit `nil' block, so
|
|
|
|
|
that you can use `cl-return' to exit at any time.
|
|
|
|
|
|
|
|
|
|
Also note that END-TEST is checked before evaluating BODY. If END-TEST
|
|
|
|
|
is initially non-nil, `cl-do*' will exit without running BODY.
|
|
|
|
|
|
|
|
|
|
This is to `cl-do' what `let*' is to `let'.
|
|
|
|
|
For more details, see `cl-do*' description in Info node `(cl) Iteration'.
|
2004-05-08 17:23:08 +00:00
|
|
|
|
|
|
|
|
|
\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(declare (indent 2) (debug cl-do))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(cl--expand-do-loop steps endtest body t))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(defun cl--expand-do-loop (steps endtest body star)
|
2012-06-03 21:05:17 -04:00
|
|
|
|
`(cl-block nil
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(,(if star 'let* 'let)
|
|
|
|
|
,(mapcar (lambda (c) (if (consp c) (list (car c) (nth 1 c)) c))
|
|
|
|
|
steps)
|
|
|
|
|
(while (not ,(car endtest))
|
|
|
|
|
,@body
|
|
|
|
|
,@(let ((sets (mapcar (lambda (c)
|
|
|
|
|
(and (consp c) (cdr (cdr c))
|
|
|
|
|
(list (car c) (nth 2 c))))
|
|
|
|
|
steps)))
|
|
|
|
|
(setq sets (delq nil sets))
|
|
|
|
|
(and sets
|
|
|
|
|
(list (cons (if (or star (not (cdr sets)))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
'setq 'cl-psetq)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(apply 'append sets))))))
|
|
|
|
|
,@(or (cdr endtest) '(nil)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-dolist (spec &rest body)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Loop over a list.
|
2000-01-30 13:19:09 +00:00
|
|
|
|
Evaluate BODY with VAR bound to each `car' from LIST, in turn.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
Then evaluate RESULT to get return value, default nil.
|
2011-08-02 20:49:12 +02:00
|
|
|
|
An implicit nil block is established around the loop.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
|
|
|
|
\(fn (VAR LIST [RESULT]) BODY...)"
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 19:13:41 -04:00
|
|
|
|
(declare (debug ((symbolp form &optional form) cl-declarations body))
|
|
|
|
|
(indent 1))
|
2012-11-12 22:00:09 -05:00
|
|
|
|
(let ((loop `(dolist ,spec ,@body)))
|
2015-03-26 13:32:45 -04:00
|
|
|
|
(if (advice-member-p 'cl--wrap-in-nil-block 'dolist)
|
2012-11-12 22:00:09 -05:00
|
|
|
|
loop `(cl-block nil ,loop))))
|
2000-01-30 13:19:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-dotimes (spec &rest body)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Loop a certain number of times.
|
2000-01-30 13:19:09 +00:00
|
|
|
|
Evaluate BODY with VAR bound to successive integers from 0, inclusive,
|
|
|
|
|
to COUNT, exclusive. Then evaluate RESULT to get return value, default
|
2002-09-27 23:16:27 +00:00
|
|
|
|
nil.
|
|
|
|
|
|
|
|
|
|
\(fn (VAR COUNT [RESULT]) BODY...)"
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 19:13:41 -04:00
|
|
|
|
(declare (debug cl-dolist) (indent 1))
|
2012-11-12 22:00:09 -05:00
|
|
|
|
(let ((loop `(dotimes ,spec ,@body)))
|
2015-03-26 13:32:45 -04:00
|
|
|
|
(if (advice-member-p 'cl--wrap-in-nil-block 'dotimes)
|
2012-11-12 22:00:09 -05:00
|
|
|
|
loop `(cl-block nil ,loop))))
|
2000-01-30 13:19:09 +00:00
|
|
|
|
|
2012-12-06 22:56:57 -05:00
|
|
|
|
(defvar cl--tagbody-alist nil)
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-tagbody (&rest labels-or-stmts)
|
|
|
|
|
"Execute statements while providing for control transfers to labels.
|
|
|
|
|
Each element of LABELS-OR-STMTS can be either a label (integer or symbol)
|
|
|
|
|
or a `cons' cell, in which case it's taken to be a statement.
|
|
|
|
|
This distinction is made before performing macroexpansion.
|
|
|
|
|
Statements are executed in sequence left to right, discarding any return value,
|
|
|
|
|
stopping only when reaching the end of LABELS-OR-STMTS.
|
|
|
|
|
Any statement can transfer control at any time to the statements that follow
|
|
|
|
|
one of the labels with the special form (go LABEL).
|
|
|
|
|
Labels have lexical scope and dynamic extent."
|
|
|
|
|
(let ((blocks '())
|
|
|
|
|
(first-label (if (consp (car labels-or-stmts))
|
|
|
|
|
'cl--preamble (pop labels-or-stmts))))
|
|
|
|
|
(let ((block (list first-label)))
|
|
|
|
|
(dolist (label-or-stmt labels-or-stmts)
|
|
|
|
|
(if (consp label-or-stmt) (push label-or-stmt block)
|
|
|
|
|
;; Add a "go to next block" to implement the fallthrough.
|
|
|
|
|
(unless (eq 'go (car-safe (car-safe block)))
|
|
|
|
|
(push `(go ,label-or-stmt) block))
|
|
|
|
|
(push (nreverse block) blocks)
|
|
|
|
|
(setq block (list label-or-stmt))))
|
|
|
|
|
(unless (eq 'go (car-safe (car-safe block)))
|
2018-11-05 01:22:15 +01:00
|
|
|
|
(push '(go cl--exit) block))
|
2012-12-06 22:56:57 -05:00
|
|
|
|
(push (nreverse block) blocks))
|
2015-05-25 09:39:35 -04:00
|
|
|
|
(let ((catch-tag (make-symbol "cl--tagbody-tag"))
|
|
|
|
|
(cl--tagbody-alist cl--tagbody-alist))
|
2012-12-06 22:56:57 -05:00
|
|
|
|
(push (cons 'cl--exit catch-tag) cl--tagbody-alist)
|
|
|
|
|
(dolist (block blocks)
|
|
|
|
|
(push (cons (car block) catch-tag) cl--tagbody-alist))
|
|
|
|
|
(macroexpand-all
|
|
|
|
|
`(let ((next-label ',first-label))
|
|
|
|
|
(while
|
|
|
|
|
(not (eq (setq next-label
|
|
|
|
|
(catch ',catch-tag
|
|
|
|
|
(cl-case next-label
|
|
|
|
|
,@blocks)))
|
|
|
|
|
'cl--exit))))
|
|
|
|
|
`((go . ,(lambda (label)
|
|
|
|
|
(let ((catch-tag (cdr (assq label cl--tagbody-alist))))
|
|
|
|
|
(unless catch-tag
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "Unknown cl-tagbody go label `%S'" label))
|
2012-12-06 22:56:57 -05:00
|
|
|
|
`(throw ',catch-tag ',label))))
|
|
|
|
|
,@macroexpand-all-environment)))))
|
|
|
|
|
|
2016-07-12 12:05:01 -04:00
|
|
|
|
(defun cl--prog (binder bindings body)
|
|
|
|
|
(let (decls)
|
|
|
|
|
(while (eq 'declare (car-safe (car body)))
|
|
|
|
|
(push (pop body) decls))
|
|
|
|
|
`(cl-block nil
|
|
|
|
|
(,binder ,bindings
|
|
|
|
|
,@(nreverse decls)
|
|
|
|
|
(cl-tagbody . ,body)))))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-prog (bindings &rest body)
|
|
|
|
|
"Run BODY like a `cl-tagbody' after setting up the BINDINGS.
|
|
|
|
|
Shorthand for (cl-block nil (let BINDINGS (cl-tagbody BODY)))"
|
|
|
|
|
(cl--prog 'let bindings body))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-prog* (bindings &rest body)
|
|
|
|
|
"Run BODY like a `cl-tagbody' after setting up the BINDINGS.
|
|
|
|
|
Shorthand for (cl-block nil (let* BINDINGS (cl-tagbody BODY)))"
|
|
|
|
|
(cl--prog 'let* bindings body))
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-do-symbols (spec &rest body)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Loop over all symbols.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
Evaluate BODY with VAR bound to each interned symbol, or to each symbol
|
2002-09-27 23:16:27 +00:00
|
|
|
|
from OBARRAY.
|
|
|
|
|
|
|
|
|
|
\(fn (VAR [OBARRAY [RESULT]]) BODY...)"
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 1)
|
|
|
|
|
(debug ((symbolp &optional form form) cl-declarations body)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
;; Apparently this doesn't have an implicit block.
|
2012-06-03 21:05:17 -04:00
|
|
|
|
`(cl-block nil
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(let (,(car spec))
|
|
|
|
|
(mapatoms #'(lambda (,(car spec)) ,@body)
|
|
|
|
|
,@(and (cadr spec) (list (cadr spec))))
|
2015-04-10 01:50:22 -04:00
|
|
|
|
,(nth 2 spec))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-do-all-symbols (spec &rest body)
|
2012-11-03 11:03:39 -07:00
|
|
|
|
"Like `cl-do-symbols', but use the default obarray.
|
|
|
|
|
|
|
|
|
|
\(fn (VAR [RESULT]) BODY...)"
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 1) (debug ((symbolp &optional form) cl-declarations body)))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
`(cl-do-symbols (,(car spec) nil ,(cadr spec)) ,@body))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Assignments.
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-psetq (&rest args)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Set SYMs to the values VALs in parallel.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
This is like `setq', except that all VAL forms are evaluated (in order)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
before assigning any symbols SYM to the corresponding values.
|
|
|
|
|
|
|
|
|
|
\(fn SYM VAL SYM VAL ...)"
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug setq))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(cons 'cl-psetf args))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Binding control structures.
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-progv (symbols values &rest body)
|
2000-05-05 20:01:01 +00:00
|
|
|
|
"Bind SYMBOLS to VALUES dynamically in BODY.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists.
|
(function*, case, ecase, typecase, etypecase, progv, lexical-let, lexical-let*,
multiple-value-bind, multiple-value-setq, shiftf): Improve argument/docstring
consistency.
2005-05-22 17:51:22 +00:00
|
|
|
|
Each symbol in the first list is bound to the corresponding value in the
|
More cl doc updates
* doc/misc/cl.texi: Don't mess with the TeX section number counter.
Use Texinfo recommended convention for quotes+punctuation.
(Overview, Sequence Functions): Rephrase for better line-breaking.
(Time of Evaluation, Type Predicates, Modify Macros, Function Bindings)
(Macro Bindings, Conditionals, Iteration, Loop Basics)
(Random Numbers, Mapping over Sequences, Structures)
(Porting Common Lisp): Further updates for cl-lib namespace.
(Modify Macros, Declarations, Macro Bindings, Structures):
Break long lines in examples.
(Dynamic Bindings): Update for changed progv behavior.
(Loop Examples, Efficiency Concerns): Markup fixes.
(Structures): Remove TeX margin change.
* lisp/emacs-lisp/cl-macs.el (cl-progv): Doc fix.
* etc/NEWS: Related markup.
2012-10-24 20:58:40 -04:00
|
|
|
|
second list (or to nil if VALUES is shorter than SYMBOLS); then the
|
1993-07-30 20:15:09 +00:00
|
|
|
|
BODY forms are executed and their result is returned. This is much like
|
|
|
|
|
a `let' form, except that the list of symbols can be computed at run-time."
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 2) (debug (form form body)))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(let ((bodyfun (make-symbol "body"))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 19:13:41 -04:00
|
|
|
|
(binds (make-symbol "binds"))
|
|
|
|
|
(syms (make-symbol "syms"))
|
|
|
|
|
(vals (make-symbol "vals")))
|
|
|
|
|
`(progn
|
|
|
|
|
(let* ((,syms ,symbols)
|
|
|
|
|
(,vals ,values)
|
|
|
|
|
(,bodyfun (lambda () ,@body))
|
|
|
|
|
(,binds ()))
|
|
|
|
|
(while ,syms
|
|
|
|
|
(push (list (pop ,syms) (list 'quote (pop ,vals))) ,binds))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(eval (list 'let ,binds (list 'funcall (list 'quote ,bodyfun))))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2015-01-15 08:58:45 -05:00
|
|
|
|
(defconst cl--labels-magic (make-symbol "cl--labels-magic"))
|
|
|
|
|
|
2012-06-07 22:54:35 -04:00
|
|
|
|
(defvar cl--labels-convert-cache nil)
|
|
|
|
|
|
|
|
|
|
(defun cl--labels-convert (f)
|
|
|
|
|
"Special macro-expander to rename (function F) references in `cl-labels'."
|
|
|
|
|
(cond
|
|
|
|
|
;; ¡¡Big Ugly Hack!! We can't use a compiler-macro because those are checked
|
|
|
|
|
;; *after* handling `function', but we want to stop macroexpansion from
|
|
|
|
|
;; being applied infinitely, so we use a cache to return the exact `form'
|
|
|
|
|
;; being expanded even though we don't receive it.
|
|
|
|
|
((eq f (car cl--labels-convert-cache)) (cdr cl--labels-convert-cache))
|
|
|
|
|
(t
|
2015-01-15 08:58:45 -05:00
|
|
|
|
(let* ((found (assq f macroexpand-all-environment))
|
|
|
|
|
(replacement (and found
|
|
|
|
|
(ignore-errors
|
|
|
|
|
(funcall (cdr found) cl--labels-magic)))))
|
|
|
|
|
(if (and replacement (eq cl--labels-magic (car replacement)))
|
|
|
|
|
(nth 1 replacement)
|
2012-06-07 22:54:35 -04:00
|
|
|
|
(let ((res `(function ,f)))
|
|
|
|
|
(setq cl--labels-convert-cache (cons f res))
|
|
|
|
|
res))))))
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-flet (bindings &rest body)
|
2012-11-15 13:35:05 -05:00
|
|
|
|
"Make local function definitions.
|
2018-06-12 18:41:46 -04:00
|
|
|
|
Each definition can take the form (FUNC EXP) where
|
2015-01-14 14:37:10 -05:00
|
|
|
|
FUNC is the function name, and EXP is an expression that returns the
|
|
|
|
|
function value to which it should be bound, or it can take the more common
|
|
|
|
|
form \(FUNC ARGLIST BODY...) which is a shorthand
|
|
|
|
|
for (FUNC (lambda ARGLIST BODY)).
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
2018-06-12 18:41:46 -04:00
|
|
|
|
FUNC is defined only within FORM, not BODY, so you can't write
|
|
|
|
|
recursive function definitions. Use `cl-labels' for that. See
|
|
|
|
|
info node `(cl) Function Bindings' for details.
|
|
|
|
|
|
2002-09-27 23:16:27 +00:00
|
|
|
|
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(declare (indent 1) (debug ((&rest (cl-defun)) cl-declarations body)))
|
2012-06-07 22:54:35 -04:00
|
|
|
|
(let ((binds ()) (newenv macroexpand-all-environment))
|
|
|
|
|
(dolist (binding bindings)
|
2015-01-14 14:37:10 -05:00
|
|
|
|
(let ((var (make-symbol (format "--cl-%s--" (car binding))))
|
|
|
|
|
(args-and-body (cdr binding)))
|
|
|
|
|
(if (and (= (length args-and-body) 1) (symbolp (car args-and-body)))
|
|
|
|
|
;; Optimize (cl-flet ((fun var)) body).
|
|
|
|
|
(setq var (car args-and-body))
|
|
|
|
|
(push (list var (if (= (length args-and-body) 1)
|
|
|
|
|
(car args-and-body)
|
|
|
|
|
`(cl-function (lambda . ,args-and-body))))
|
|
|
|
|
binds))
|
2012-06-07 22:54:35 -04:00
|
|
|
|
(push (cons (car binding)
|
2015-01-15 08:58:45 -05:00
|
|
|
|
(lambda (&rest args)
|
|
|
|
|
(if (eq (car args) cl--labels-magic)
|
|
|
|
|
(list cl--labels-magic var)
|
|
|
|
|
`(funcall ,var ,@args))))
|
2012-06-07 22:54:35 -04:00
|
|
|
|
newenv)))
|
2015-01-14 14:37:10 -05:00
|
|
|
|
;; FIXME: Eliminate those functions which aren't referenced.
|
2015-01-15 08:58:45 -05:00
|
|
|
|
(macroexp-let* (nreverse binds)
|
|
|
|
|
(macroexpand-all
|
|
|
|
|
`(progn ,@body)
|
|
|
|
|
;; Don't override lexical-let's macro-expander.
|
|
|
|
|
(if (assq 'function newenv) newenv
|
|
|
|
|
(cons (cons 'function #'cl--labels-convert) newenv))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-06-27 11:11:28 -04:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-flet* (bindings &rest body)
|
2012-11-15 13:35:05 -05:00
|
|
|
|
"Make local function definitions.
|
2012-06-27 11:11:28 -04:00
|
|
|
|
Like `cl-flet' but the definitions can refer to previous ones.
|
|
|
|
|
|
|
|
|
|
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 19:13:41 -04:00
|
|
|
|
(declare (indent 1) (debug cl-flet))
|
2012-06-27 11:11:28 -04:00
|
|
|
|
(cond
|
|
|
|
|
((null bindings) (macroexp-progn body))
|
|
|
|
|
((null (cdr bindings)) `(cl-flet ,bindings ,@body))
|
|
|
|
|
(t `(cl-flet (,(pop bindings)) (cl-flet* ,bindings ,@body)))))
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-labels (bindings &rest body)
|
2018-06-12 18:41:46 -04:00
|
|
|
|
"Make local (recursive) function definitions.
|
|
|
|
|
Each definition can take the form (FUNC ARGLIST BODY...) where
|
|
|
|
|
FUNC is the function name, ARGLIST its arguments, and BODY the
|
|
|
|
|
forms of the function body. FUNC is defined in any BODY, as well
|
|
|
|
|
as FORM, so you can write recursive and mutually recursive
|
|
|
|
|
function definitions. See info node `(cl) Function Bindings' for
|
|
|
|
|
details.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
|
|
|
|
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(declare (indent 1) (debug cl-flet))
|
2012-06-07 22:54:35 -04:00
|
|
|
|
(let ((binds ()) (newenv macroexpand-all-environment))
|
|
|
|
|
(dolist (binding bindings)
|
|
|
|
|
(let ((var (make-symbol (format "--cl-%s--" (car binding)))))
|
|
|
|
|
(push (list var `(cl-function (lambda . ,(cdr binding)))) binds)
|
|
|
|
|
(push (cons (car binding)
|
2015-01-15 08:58:45 -05:00
|
|
|
|
(lambda (&rest args)
|
|
|
|
|
(if (eq (car args) cl--labels-magic)
|
|
|
|
|
(list cl--labels-magic var)
|
|
|
|
|
(cl-list* 'funcall var args))))
|
Move old compatiblity to cl.el. Remove cl-macroexpand-all.
* emacs-lisp/cl-extra.el (cl-map-keymap, cl-copy-tree)
(cl-not-hash-table, cl-builtin-gethash, cl-builtin-remhash)
(cl-builtin-clrhash, cl-builtin-maphash, cl-gethash, cl-puthash)
(cl-remhash, cl-clrhash, cl-maphash, cl-make-hash-table)
(cl-hash-table-p, cl-hash-table-count): Move to cl.el.
(cl-macroexpand-cmacs): Remove var.
(cl-macroexpand-all, cl-macroexpand-body): Remove funs.
Use macroexpand-all instead.
* emacs-lisp/cl-lib.el (cl-macro-environment): Remove decl.
(cl-macroexpand): Move to cl-macs.el and rename to cl--sm-macroexpand.
(cl-member): Remove old alias.
* emacs-lisp/cl-macs.el (cl-macro-environment): Remove var.
Use macroexpand-all-environment instead.
(cl--old-macroexpand): New var.
(cl--sm-macroexpand): New function.
(cl-symbol-macrolet): Use it during macro expansion.
(cl--function-convert-cache): New var.
(cl--function-convert): New function, extracted from
cl-macroexpand-all.
(cl-lexical-let): Use it.
* emacs-lisp/cl.el (cl-macroexpand, cl-macro-environment)
(cl-macroexpand-all, cl-not-hash-table, cl-builtin-gethash)
(cl-builtin-remhash, cl-builtin-clrhash, cl-builtin-maphash)
(cl-map-keymap, cl-copy-tree, cl-gethash, cl-puthash, cl-remhash)
(cl-clrhash, cl-maphash, cl-make-hash-table, cl-hash-table-p)
(cl-hash-table-count): Add old compatibility aliases.
2012-06-07 15:48:22 -04:00
|
|
|
|
newenv)))
|
2012-06-07 22:54:35 -04:00
|
|
|
|
(macroexpand-all `(letrec ,(nreverse binds) ,@body)
|
|
|
|
|
;; Don't override lexical-let's macro-expander.
|
|
|
|
|
(if (assq 'function newenv) newenv
|
|
|
|
|
(cons (cons 'function #'cl--labels-convert) newenv)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;; The following ought to have a better definition for use with newer
|
|
|
|
|
;; byte compilers.
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-macrolet (bindings &rest body)
|
2005-05-17 00:26:59 +00:00
|
|
|
|
"Make temporary macro definitions.
|
2012-06-03 21:05:17 -04:00
|
|
|
|
This is like `cl-flet', but for macros instead of functions.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
|
|
|
|
\(fn ((NAME ARGLIST BODY...) ...) FORM...)"
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 1)
|
2018-07-20 21:54:00 -07:00
|
|
|
|
(debug (cl-macrolet-expr)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (cdr bindings)
|
2012-06-03 21:05:17 -04:00
|
|
|
|
`(cl-macrolet (,(car bindings)) (cl-macrolet ,(cdr bindings) ,@body))
|
2014-06-06 07:08:59 +08:00
|
|
|
|
(if (null bindings) (macroexp-progn body)
|
|
|
|
|
(let* ((name (caar bindings))
|
|
|
|
|
(res (cl--transform-lambda (cdar bindings) name)))
|
|
|
|
|
(eval (car res))
|
|
|
|
|
(macroexpand-all (macroexp-progn body)
|
2015-01-14 14:37:10 -05:00
|
|
|
|
(cons (cons name
|
|
|
|
|
(eval `(cl-function (lambda ,@(cdr res))) t))
|
2014-06-06 07:08:59 +08:00
|
|
|
|
macroexpand-all-environment))))))
|
Move old compatiblity to cl.el. Remove cl-macroexpand-all.
* emacs-lisp/cl-extra.el (cl-map-keymap, cl-copy-tree)
(cl-not-hash-table, cl-builtin-gethash, cl-builtin-remhash)
(cl-builtin-clrhash, cl-builtin-maphash, cl-gethash, cl-puthash)
(cl-remhash, cl-clrhash, cl-maphash, cl-make-hash-table)
(cl-hash-table-p, cl-hash-table-count): Move to cl.el.
(cl-macroexpand-cmacs): Remove var.
(cl-macroexpand-all, cl-macroexpand-body): Remove funs.
Use macroexpand-all instead.
* emacs-lisp/cl-lib.el (cl-macro-environment): Remove decl.
(cl-macroexpand): Move to cl-macs.el and rename to cl--sm-macroexpand.
(cl-member): Remove old alias.
* emacs-lisp/cl-macs.el (cl-macro-environment): Remove var.
Use macroexpand-all-environment instead.
(cl--old-macroexpand): New var.
(cl--sm-macroexpand): New function.
(cl-symbol-macrolet): Use it during macro expansion.
(cl--function-convert-cache): New var.
(cl--function-convert): New function, extracted from
cl-macroexpand-all.
(cl-lexical-let): Use it.
* emacs-lisp/cl.el (cl-macroexpand, cl-macro-environment)
(cl-macroexpand-all, cl-not-hash-table, cl-builtin-gethash)
(cl-builtin-remhash, cl-builtin-clrhash, cl-builtin-maphash)
(cl-map-keymap, cl-copy-tree, cl-gethash, cl-puthash, cl-remhash)
(cl-clrhash, cl-maphash, cl-make-hash-table, cl-hash-table-p)
(cl-hash-table-count): Add old compatibility aliases.
2012-06-07 15:48:22 -04:00
|
|
|
|
|
2018-02-08 21:40:46 -05:00
|
|
|
|
(defun cl--sm-macroexpand (orig-fun exp &optional env)
|
|
|
|
|
"Special macro expander advice used inside `cl-symbol-macrolet'.
|
|
|
|
|
This function extends `macroexpand' during macro expansion
|
|
|
|
|
of `cl-symbol-macrolet' to additionally expand symbol macros."
|
2017-04-21 23:37:05 -04:00
|
|
|
|
(let ((macroexpand-all-environment env)
|
|
|
|
|
(venv (alist-get :cl-symbol-macros env)))
|
Move old compatiblity to cl.el. Remove cl-macroexpand-all.
* emacs-lisp/cl-extra.el (cl-map-keymap, cl-copy-tree)
(cl-not-hash-table, cl-builtin-gethash, cl-builtin-remhash)
(cl-builtin-clrhash, cl-builtin-maphash, cl-gethash, cl-puthash)
(cl-remhash, cl-clrhash, cl-maphash, cl-make-hash-table)
(cl-hash-table-p, cl-hash-table-count): Move to cl.el.
(cl-macroexpand-cmacs): Remove var.
(cl-macroexpand-all, cl-macroexpand-body): Remove funs.
Use macroexpand-all instead.
* emacs-lisp/cl-lib.el (cl-macro-environment): Remove decl.
(cl-macroexpand): Move to cl-macs.el and rename to cl--sm-macroexpand.
(cl-member): Remove old alias.
* emacs-lisp/cl-macs.el (cl-macro-environment): Remove var.
Use macroexpand-all-environment instead.
(cl--old-macroexpand): New var.
(cl--sm-macroexpand): New function.
(cl-symbol-macrolet): Use it during macro expansion.
(cl--function-convert-cache): New var.
(cl--function-convert): New function, extracted from
cl-macroexpand-all.
(cl-lexical-let): Use it.
* emacs-lisp/cl.el (cl-macroexpand, cl-macro-environment)
(cl-macroexpand-all, cl-not-hash-table, cl-builtin-gethash)
(cl-builtin-remhash, cl-builtin-clrhash, cl-builtin-maphash)
(cl-map-keymap, cl-copy-tree, cl-gethash, cl-puthash, cl-remhash)
(cl-clrhash, cl-maphash, cl-make-hash-table, cl-hash-table-p)
(cl-hash-table-count): Add old compatibility aliases.
2012-06-07 15:48:22 -04:00
|
|
|
|
(while
|
|
|
|
|
(progn
|
2018-02-08 21:40:46 -05:00
|
|
|
|
(setq exp (funcall orig-fun exp env))
|
2012-08-06 15:53:45 -04:00
|
|
|
|
(pcase exp
|
|
|
|
|
((pred symbolp)
|
|
|
|
|
;; Perform symbol-macro expansion.
|
2017-04-21 23:37:05 -04:00
|
|
|
|
(let ((symval (assq exp venv)))
|
|
|
|
|
(when symval
|
|
|
|
|
(setq exp (cadr symval)))))
|
2019-05-16 15:29:36 -04:00
|
|
|
|
(`(setq . ,args)
|
2012-08-06 15:53:45 -04:00
|
|
|
|
;; Convert setq to setf if required by symbol-macro expansion.
|
2019-05-16 15:29:36 -04:00
|
|
|
|
(let ((convert nil)
|
|
|
|
|
(rargs nil))
|
|
|
|
|
(while args
|
|
|
|
|
(let ((place (pop args)))
|
|
|
|
|
;; Here, we know `place' should be a symbol.
|
|
|
|
|
(while
|
|
|
|
|
(let ((symval (assq place venv)))
|
|
|
|
|
(when symval
|
|
|
|
|
(setq place (cadr symval))
|
|
|
|
|
(if (symbolp place)
|
|
|
|
|
t ;Repeat.
|
|
|
|
|
(setq convert t)
|
|
|
|
|
nil))))
|
|
|
|
|
(push place rargs)
|
|
|
|
|
(push (pop args) rargs)))
|
|
|
|
|
(setq exp (cons (if convert 'setf 'setq)
|
|
|
|
|
(nreverse rargs)))
|
|
|
|
|
convert))
|
2017-11-27 15:33:30 -05:00
|
|
|
|
;; CL's symbol-macrolet used to treat re-bindings as candidates for
|
|
|
|
|
;; expansion (turning the let into a letf if needed), contrary to
|
|
|
|
|
;; Common-Lisp where such re-bindings hide the symbol-macro.
|
|
|
|
|
;; Not sure if there actually is code out there which depends
|
|
|
|
|
;; on this behavior (haven't found any yet).
|
|
|
|
|
;; Such code should explicitly use `cl-letf' instead, I think.
|
|
|
|
|
;;
|
2012-08-06 15:53:45 -04:00
|
|
|
|
;; (`(,(or `let `let*) . ,(or `(,bindings . ,body) dontcare))
|
2017-11-27 15:33:30 -05:00
|
|
|
|
;; (let ((letf nil) (found nil) (nbs ()))
|
2012-08-06 15:53:45 -04:00
|
|
|
|
;; (dolist (binding bindings)
|
|
|
|
|
;; (let* ((var (if (symbolp binding) binding (car binding)))
|
2017-11-27 15:33:30 -05:00
|
|
|
|
;; (sm (assq var venv)))
|
|
|
|
|
;; (push (if (not (cdr sm))
|
|
|
|
|
;; binding
|
|
|
|
|
;; (let ((nexp (cadr sm)))
|
|
|
|
|
;; (setq found t)
|
|
|
|
|
;; (unless (symbolp nexp) (setq letf t))
|
|
|
|
|
;; (cons nexp (cdr-safe binding))))
|
2012-08-06 15:53:45 -04:00
|
|
|
|
;; nbs)))
|
|
|
|
|
;; (when found
|
2017-11-27 15:33:30 -05:00
|
|
|
|
;; (setq exp `(,(if letf
|
|
|
|
|
;; (if (eq (car exp) 'let) 'cl-letf 'cl-letf*)
|
|
|
|
|
;; (car exp))
|
2012-08-06 15:53:45 -04:00
|
|
|
|
;; ,(nreverse nbs)
|
2017-11-27 15:33:30 -05:00
|
|
|
|
;; ,@body)))))
|
|
|
|
|
;;
|
|
|
|
|
;; We implement the Common-Lisp behavior, instead (see bug#26073):
|
|
|
|
|
;; The behavior of CL made sense in a dynamically scoped
|
|
|
|
|
;; language, but nowadays, lexical scoping semantics is more often
|
|
|
|
|
;; expected.
|
2018-11-05 01:22:15 +01:00
|
|
|
|
(`(,(or 'let 'let*) . ,(or `(,bindings . ,body) dontcare))
|
2017-11-27 15:33:30 -05:00
|
|
|
|
(let ((nbs ()) (found nil))
|
|
|
|
|
(dolist (binding bindings)
|
|
|
|
|
(let* ((var (if (symbolp binding) binding (car binding)))
|
|
|
|
|
(val (and found (consp binding) (eq 'let* (car exp))
|
|
|
|
|
(list (macroexpand-all (cadr binding)
|
|
|
|
|
env)))))
|
|
|
|
|
(push (if (assq var venv)
|
2018-02-08 21:40:46 -05:00
|
|
|
|
;; This binding should hide "its" surrounding
|
|
|
|
|
;; symbol-macro, but given the way macroexpand-all
|
|
|
|
|
;; works (i.e. the `env' we receive as input will
|
|
|
|
|
;; be (re)applied to the code we return), we can't
|
2017-11-27 15:33:30 -05:00
|
|
|
|
;; prevent application of `env' to the
|
|
|
|
|
;; sub-expressions, so we need to α-rename this
|
|
|
|
|
;; variable instead.
|
|
|
|
|
(let ((nvar (make-symbol (symbol-name var))))
|
|
|
|
|
(setq found t)
|
|
|
|
|
(push (list var nvar) venv)
|
|
|
|
|
(push (cons :cl-symbol-macros venv) env)
|
|
|
|
|
(cons nvar (or val (cdr-safe binding))))
|
|
|
|
|
(if val (cons var val) binding))
|
|
|
|
|
nbs)))
|
|
|
|
|
(when found
|
|
|
|
|
(setq exp `(,(car exp)
|
|
|
|
|
,(nreverse nbs)
|
|
|
|
|
,@(macroexp-unprogn
|
|
|
|
|
(macroexpand-all (macroexp-progn body)
|
|
|
|
|
env)))))
|
|
|
|
|
nil))
|
2018-02-08 21:40:46 -05:00
|
|
|
|
;; Do the same as for `let' but for variables introduced
|
|
|
|
|
;; via other means, such as `lambda' and `condition-case'.
|
|
|
|
|
(`(function (lambda ,args . ,body))
|
|
|
|
|
(let ((nargs ()) (found nil))
|
|
|
|
|
(dolist (var args)
|
|
|
|
|
(push (cond
|
|
|
|
|
((memq var '(&optional &rest)) var)
|
|
|
|
|
((assq var venv)
|
|
|
|
|
(let ((nvar (make-symbol (symbol-name var))))
|
|
|
|
|
(setq found t)
|
|
|
|
|
(push (list var nvar) venv)
|
|
|
|
|
(push (cons :cl-symbol-macros venv) env)
|
|
|
|
|
nvar))
|
|
|
|
|
(t var))
|
|
|
|
|
nargs))
|
|
|
|
|
(when found
|
|
|
|
|
(setq exp `(function
|
|
|
|
|
(lambda ,(nreverse nargs)
|
|
|
|
|
. ,(mapcar (lambda (exp)
|
|
|
|
|
(macroexpand-all exp env))
|
|
|
|
|
body)))))
|
|
|
|
|
nil))
|
|
|
|
|
((and `(condition-case ,var ,exp . ,clauses)
|
|
|
|
|
(guard (assq var venv)))
|
|
|
|
|
(let ((nvar (make-symbol (symbol-name var))))
|
|
|
|
|
(push (list var nvar) venv)
|
|
|
|
|
(push (cons :cl-symbol-macros venv) env)
|
|
|
|
|
(setq exp
|
|
|
|
|
`(condition-case ,nvar ,(macroexpand-all exp env)
|
|
|
|
|
. ,(mapcar
|
|
|
|
|
(lambda (clause)
|
|
|
|
|
`(,(car clause)
|
|
|
|
|
. ,(mapcar (lambda (exp)
|
|
|
|
|
(macroexpand-all exp env))
|
|
|
|
|
(cdr clause))))
|
|
|
|
|
clauses)))
|
|
|
|
|
nil))
|
2012-08-06 15:53:45 -04:00
|
|
|
|
)))
|
|
|
|
|
exp))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-symbol-macrolet (bindings &rest body)
|
2005-05-17 00:26:59 +00:00
|
|
|
|
"Make symbol macro definitions.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
Within the body FORMs, references to the variable NAME will be replaced
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...).
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
|
|
|
|
\(fn ((NAME EXPANSION) ...) FORM...)"
|
2016-10-22 00:14:44 +02:00
|
|
|
|
(declare (indent 1) (debug ((&rest (symbolp sexp)) cl-declarations body)))
|
2018-02-08 21:40:46 -05:00
|
|
|
|
(let ((malformed-bindings nil)
|
|
|
|
|
(advised (advice-member-p #'cl--sm-macroexpand 'macroexpand)))
|
2017-04-21 23:37:05 -04:00
|
|
|
|
(dolist (binding bindings)
|
|
|
|
|
(unless (and (consp binding) (symbolp (car binding))
|
|
|
|
|
(consp (cdr binding)) (null (cddr binding)))
|
|
|
|
|
(push binding malformed-bindings)))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
2018-02-08 21:40:46 -05:00
|
|
|
|
(unless advised
|
|
|
|
|
(advice-add 'macroexpand :around #'cl--sm-macroexpand))
|
|
|
|
|
(let* ((venv (cdr (assq :cl-symbol-macros
|
|
|
|
|
macroexpand-all-environment)))
|
2017-04-21 23:37:05 -04:00
|
|
|
|
(expansion
|
|
|
|
|
(macroexpand-all (macroexp-progn body)
|
|
|
|
|
(cons (cons :cl-symbol-macros
|
|
|
|
|
(append bindings venv))
|
|
|
|
|
macroexpand-all-environment))))
|
|
|
|
|
(if malformed-bindings
|
|
|
|
|
(macroexp--warn-and-return
|
|
|
|
|
(format-message "Malformed `cl-symbol-macrolet' binding(s): %S"
|
|
|
|
|
(nreverse malformed-bindings))
|
|
|
|
|
expansion)
|
|
|
|
|
expansion)))
|
2018-02-08 21:40:46 -05:00
|
|
|
|
(unless advised
|
|
|
|
|
(advice-remove 'macroexpand #'cl--sm-macroexpand)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;;; Multiple values.
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-multiple-value-bind (vars form &rest body)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Collect multiple return values.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
FORM must return a list; the BODY is then executed with the first N elements
|
|
|
|
|
of this list bound (`let'-style) to each of the symbols SYM in turn. This
|
2013-07-12 03:11:22 +02:00
|
|
|
|
is analogous to the Common Lisp `multiple-value-bind' macro, using lists to
|
2012-06-03 21:05:17 -04:00
|
|
|
|
simulate true multiple return values. For compatibility, (cl-values A B C) is
|
2002-09-27 23:16:27 +00:00
|
|
|
|
a synonym for (list A B C).
|
|
|
|
|
|
(function*, case, ecase, typecase, etypecase, progv, lexical-let, lexical-let*,
multiple-value-bind, multiple-value-setq, shiftf): Improve argument/docstring
consistency.
2005-05-22 17:51:22 +00:00
|
|
|
|
\(fn (SYM...) FORM BODY)"
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 2) (debug ((&rest symbolp) form body)))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(let ((temp (make-symbol "--cl-var--")) (n -1))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(let* ((,temp ,form)
|
|
|
|
|
,@(mapcar (lambda (v)
|
|
|
|
|
(list v `(nth ,(setq n (1+ n)) ,temp)))
|
|
|
|
|
vars))
|
|
|
|
|
,@body)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-multiple-value-setq (vars form)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Collect multiple return values.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
FORM must return a list; the first N elements of this list are stored in
|
|
|
|
|
each of the symbols SYM in turn. This is analogous to the Common Lisp
|
2013-07-12 03:11:22 +02:00
|
|
|
|
`multiple-value-setq' macro, using lists to simulate true multiple return
|
2012-06-03 21:05:17 -04:00
|
|
|
|
values. For compatibility, (cl-values A B C) is a synonym for (list A B C).
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
(function*, case, ecase, typecase, etypecase, progv, lexical-let, lexical-let*,
multiple-value-bind, multiple-value-setq, shiftf): Improve argument/docstring
consistency.
2005-05-22 17:51:22 +00:00
|
|
|
|
\(fn (SYM...) FORM)"
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 1) (debug ((&rest symbolp) form)))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(cond ((null vars) `(progn ,form nil))
|
|
|
|
|
((null (cdr vars)) `(setq ,(car vars) (car ,form)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(t
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(let* ((temp (make-symbol "--cl-var--")) (n 0))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(let ((,temp ,form))
|
|
|
|
|
(prog1 (setq ,(pop vars) (car ,temp))
|
|
|
|
|
(setq ,@(apply #'nconc
|
|
|
|
|
(mapcar (lambda (v)
|
|
|
|
|
(list v `(nth ,(setq n (1+ n))
|
|
|
|
|
,temp)))
|
|
|
|
|
vars)))))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Declarations.
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-locally (&rest body)
|
2012-11-05 00:29:12 -08:00
|
|
|
|
"Equivalent to `progn'."
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug t))
|
|
|
|
|
(cons 'progn body))
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2014-04-19 19:34:22 -07:00
|
|
|
|
(defmacro cl-the (type form)
|
|
|
|
|
"Return FORM. If type-checking is enabled, assert that it is of TYPE."
|
2012-05-17 17:51:15 -04:00
|
|
|
|
(declare (indent 1) (debug (cl-type-spec form)))
|
2014-04-19 19:34:22 -07:00
|
|
|
|
(if (not (or (not (cl--compiling-file))
|
|
|
|
|
(< cl--optimize-speed 3)
|
|
|
|
|
(= cl--optimize-safety 3)))
|
|
|
|
|
form
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(macroexp-let2 macroexp-copyable-p temp form
|
|
|
|
|
`(progn (unless (cl-typep ,temp ',type)
|
|
|
|
|
(signal 'wrong-type-argument
|
|
|
|
|
(list ',type ,temp ',form)))
|
|
|
|
|
,temp))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(defvar cl--proclaim-history t) ; for future compilers
|
|
|
|
|
(defvar cl--declare-stack t) ; for future compilers
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(defun cl--do-proclaim (spec hist)
|
|
|
|
|
(and hist (listp cl--proclaim-history) (push spec cl--proclaim-history))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(cond ((eq (car-safe spec) 'special)
|
|
|
|
|
(if (boundp 'byte-compile-bound-variables)
|
|
|
|
|
(setq byte-compile-bound-variables
|
|
|
|
|
(append (cdr spec) byte-compile-bound-variables))))
|
|
|
|
|
|
|
|
|
|
((eq (car-safe spec) 'inline)
|
|
|
|
|
(while (setq spec (cdr spec))
|
|
|
|
|
(or (memq (get (car spec) 'byte-optimizer)
|
|
|
|
|
'(nil byte-compile-inline-expand))
|
|
|
|
|
(error "%s already has a byte-optimizer, can't make it inline"
|
|
|
|
|
(car spec)))
|
|
|
|
|
(put (car spec) 'byte-optimizer 'byte-compile-inline-expand)))
|
|
|
|
|
|
|
|
|
|
((eq (car-safe spec) 'notinline)
|
|
|
|
|
(while (setq spec (cdr spec))
|
|
|
|
|
(if (eq (get (car spec) 'byte-optimizer)
|
|
|
|
|
'byte-compile-inline-expand)
|
|
|
|
|
(put (car spec) 'byte-optimizer nil))))
|
|
|
|
|
|
|
|
|
|
((eq (car-safe spec) 'optimize)
|
|
|
|
|
(let ((speed (assq (nth 1 (assq 'speed (cdr spec)))
|
|
|
|
|
'((0 nil) (1 t) (2 t) (3 t))))
|
|
|
|
|
(safety (assq (nth 1 (assq 'safety (cdr spec)))
|
|
|
|
|
'((0 t) (1 t) (2 t) (3 nil)))))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(if speed (setq cl--optimize-speed (car speed)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
byte-optimize (nth 1 speed)))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(if safety (setq cl--optimize-safety (car safety)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
byte-compile-delete-errors (nth 1 safety)))))
|
|
|
|
|
|
|
|
|
|
((and (eq (car-safe spec) 'warn) (boundp 'byte-compile-warnings))
|
|
|
|
|
(while (setq spec (cdr spec))
|
|
|
|
|
(if (consp (car spec))
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(if (eq (cl-cadar spec) 0)
|
2007-10-28 23:51:29 +00:00
|
|
|
|
(byte-compile-disable-warning (caar spec))
|
|
|
|
|
(byte-compile-enable-warning (caar spec)))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
;;; Process any proclamations made before cl-macs was loaded.
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(defvar cl--proclaims-deferred)
|
|
|
|
|
(let ((p (reverse cl--proclaims-deferred)))
|
|
|
|
|
(while p (cl--do-proclaim (pop p) t))
|
|
|
|
|
(setq cl--proclaims-deferred nil))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-declare (&rest specs)
|
2011-07-15 16:59:42 +02:00
|
|
|
|
"Declare SPECS about the current function while compiling.
|
2011-07-15 15:46:52 +02:00
|
|
|
|
For instance
|
|
|
|
|
|
2013-07-12 03:11:22 +02:00
|
|
|
|
(cl-declare (warn 0))
|
2011-07-15 15:46:52 +02:00
|
|
|
|
|
2011-07-15 18:01:18 +02:00
|
|
|
|
will turn off byte-compile warnings in the function.
|
|
|
|
|
See Info node `(cl)Declarations' for details."
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(if (cl--compiling-file)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(while specs
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(if (listp cl--declare-stack) (push (car specs) cl--declare-stack))
|
|
|
|
|
(cl--do-proclaim (pop specs) nil)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
;;; The standard modify macros.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
;; `setf' is now part of core Elisp, defined in gv.el.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-psetf (&rest args)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Set PLACEs to the values VALs in parallel.
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
This is like `setf', except that all VAL forms are evaluated (in order)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
before assigning any PLACEs to the corresponding values.
|
|
|
|
|
|
|
|
|
|
\(fn PLACE VAL PLACE VAL ...)"
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
(declare (debug setf))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((p args) (simple t) (vars nil))
|
|
|
|
|
(while p
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (or (not (symbolp (car p))) (cl--expr-depends-p (nth 1 p) vars))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq simple nil))
|
|
|
|
|
(if (memq (car p) vars)
|
|
|
|
|
(error "Destination duplicated in psetf: %s" (car p)))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (pop p) vars)
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(or p (error "Odd number of arguments to cl-psetf"))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(pop p))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if simple
|
2012-09-04 13:40:25 -04:00
|
|
|
|
`(progn (setq ,@args) nil)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq args (reverse args))
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
(let ((expr `(setf ,(cadr args) ,(car args))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(while (setq args (cddr args))
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
(setq expr `(setf ,(cadr args) (prog1 ,(car args) ,expr))))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(progn ,expr nil)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-remf (place tag)
|
2000-05-05 20:01:01 +00:00
|
|
|
|
"Remove TAG from property list PLACE.
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
PLACE may be a symbol, or any generalized variable allowed by `setf'.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
The form returns true if TAG was found and removed, nil otherwise."
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug (place form)))
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
(gv-letplace (tval setter) place
|
|
|
|
|
(macroexp-let2 macroexp-copyable-p ttag tag
|
|
|
|
|
`(if (eq ,ttag (car ,tval))
|
|
|
|
|
(progn ,(funcall setter `(cddr ,tval))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
t)
|
2012-06-12 14:10:34 -04:00
|
|
|
|
(cl--do-remf ,tval ,ttag)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-shiftf (place &rest args)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Shift left among PLACEs.
|
2012-06-03 21:05:17 -04:00
|
|
|
|
Example: (cl-shiftf A B C) sets A to B, B to C, and returns the old A.
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
Each PLACE may be a symbol, or any generalized variable allowed by `setf'.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
(function*, case, ecase, typecase, etypecase, progv, lexical-let, lexical-let*,
multiple-value-bind, multiple-value-setq, shiftf): Improve argument/docstring
consistency.
2005-05-22 17:51:22 +00:00
|
|
|
|
\(fn PLACE... VAL)"
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug (&rest place)))
|
2001-11-30 08:23:25 +00:00
|
|
|
|
(cond
|
|
|
|
|
((null args) place)
|
2012-06-03 21:05:17 -04:00
|
|
|
|
((symbolp place) `(prog1 ,place (setq ,place (cl-shiftf ,@args))))
|
2001-11-30 08:23:25 +00:00
|
|
|
|
(t
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
(gv-letplace (getter setter) place
|
|
|
|
|
`(prog1 ,getter
|
|
|
|
|
,(funcall setter `(cl-shiftf ,@args)))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-rotatef (&rest args)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Rotate left among PLACEs.
|
2012-06-03 21:05:17 -04:00
|
|
|
|
Example: (cl-rotatef A B C) sets A to B, B to C, and C to A. It returns nil.
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
Each PLACE may be a symbol, or any generalized variable allowed by `setf'.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
|
|
|
|
\(fn PLACE...)"
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug (&rest place)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (not (memq nil (mapcar 'symbolp args)))
|
|
|
|
|
(and (cdr args)
|
|
|
|
|
(let ((sets nil)
|
|
|
|
|
(first (car args)))
|
|
|
|
|
(while (cdr args)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(setq sets (nconc sets (list (pop args) (car args)))))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
`(cl-psetf ,@sets ,(car args) ,first)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let* ((places (reverse args))
|
2004-11-16 04:05:29 +00:00
|
|
|
|
(temp (make-symbol "--cl-rotatef--"))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(form temp))
|
|
|
|
|
(while (cdr places)
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
(setq form
|
|
|
|
|
(gv-letplace (getter setter) (pop places)
|
|
|
|
|
`(prog1 ,getter ,(funcall setter form)))))
|
|
|
|
|
(gv-letplace (getter setter) (car places)
|
|
|
|
|
(macroexp-let* `((,temp ,getter))
|
|
|
|
|
`(progn ,(funcall setter form) nil))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 19:13:41 -04:00
|
|
|
|
;; FIXME: `letf' is unsatisfactory because it does not really "restore" the
|
|
|
|
|
;; previous state. If the getter/setter loses information, that info is
|
|
|
|
|
;; not recovered.
|
|
|
|
|
|
|
|
|
|
(defun cl--letf (bindings simplebinds binds body)
|
|
|
|
|
;; It's not quite clear what the semantics of cl-letf should be.
|
|
|
|
|
;; E.g. in (cl-letf ((PLACE1 VAL1) (PLACE2 VAL2)) BODY), while it's clear
|
|
|
|
|
;; that the actual assignments ("bindings") should only happen after
|
|
|
|
|
;; evaluating VAL1 and VAL2, it's not clear when the sub-expressions of
|
|
|
|
|
;; PLACE1 and PLACE2 should be evaluated. Should we have
|
|
|
|
|
;; PLACE1; VAL1; PLACE2; VAL2; bind1; bind2
|
|
|
|
|
;; or
|
|
|
|
|
;; VAL1; VAL2; PLACE1; PLACE2; bind1; bind2
|
|
|
|
|
;; or
|
|
|
|
|
;; VAL1; VAL2; PLACE1; bind1; PLACE2; bind2
|
|
|
|
|
;; Common-Lisp's `psetf' does the first, so we'll do the same.
|
|
|
|
|
(if (null bindings)
|
|
|
|
|
(if (and (null binds) (null simplebinds)) (macroexp-progn body)
|
|
|
|
|
`(let* (,@(mapcar (lambda (x)
|
|
|
|
|
(pcase-let ((`(,vold ,getter ,_setter ,_vnew) x))
|
|
|
|
|
(list vold getter)))
|
|
|
|
|
binds)
|
|
|
|
|
,@simplebinds)
|
|
|
|
|
(unwind-protect
|
|
|
|
|
,(macroexp-progn
|
|
|
|
|
(append
|
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar (lambda (x)
|
|
|
|
|
(pcase x
|
|
|
|
|
;; If there's no vnew, do nothing.
|
|
|
|
|
(`(,_vold ,_getter ,setter ,vnew)
|
|
|
|
|
(funcall setter vnew))))
|
|
|
|
|
binds))
|
|
|
|
|
body))
|
|
|
|
|
,@(mapcar (lambda (x)
|
|
|
|
|
(pcase-let ((`(,vold ,_getter ,setter ,_vnew) x))
|
|
|
|
|
(funcall setter vold)))
|
|
|
|
|
binds))))
|
2017-11-27 15:33:30 -05:00
|
|
|
|
(let* ((binding (car bindings))
|
|
|
|
|
(place (macroexpand (car binding) macroexpand-all-environment)))
|
|
|
|
|
(gv-letplace (getter setter) place
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 19:13:41 -04:00
|
|
|
|
(macroexp-let2 nil vnew (cadr binding)
|
2017-11-27 15:33:30 -05:00
|
|
|
|
(if (symbolp place)
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 19:13:41 -04:00
|
|
|
|
;; Special-case for simple variables.
|
|
|
|
|
(cl--letf (cdr bindings)
|
|
|
|
|
(cons `(,getter ,(if (cdr binding) vnew getter))
|
|
|
|
|
simplebinds)
|
|
|
|
|
binds body)
|
|
|
|
|
(cl--letf (cdr bindings) simplebinds
|
|
|
|
|
(cons `(,(make-symbol "old") ,getter ,setter
|
|
|
|
|
,@(if (cdr binding) (list vnew)))
|
|
|
|
|
binds)
|
|
|
|
|
body)))))))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-letf (bindings &rest body)
|
|
|
|
|
"Temporarily bind to PLACEs.
|
|
|
|
|
This is the analogue of `let', but with generalized variables (in the
|
|
|
|
|
sense of `setf') for the PLACEs. Each PLACE is set to the corresponding
|
|
|
|
|
VALUE, then the BODY forms are executed. On exit, either normally or
|
|
|
|
|
because of a `throw' or error, the PLACEs are set back to their original
|
|
|
|
|
values. Note that this macro is *not* available in Common Lisp.
|
|
|
|
|
As a special case, if `(PLACE)' is used instead of `(PLACE VALUE)',
|
|
|
|
|
the PLACE is not modified before executing BODY.
|
|
|
|
|
|
|
|
|
|
\(fn ((PLACE VALUE) ...) BODY...)"
|
2017-04-25 07:42:01 -07:00
|
|
|
|
(declare (indent 1) (debug ((&rest [&or (symbolp form)
|
|
|
|
|
(gate gv-place &optional form)])
|
|
|
|
|
body)))
|
2017-11-27 15:33:30 -05:00
|
|
|
|
(if (and (not (cdr bindings)) (cdar bindings) (symbolp (caar bindings))
|
|
|
|
|
(not (assq (caar bindings)
|
|
|
|
|
(alist-get :cl-symbol-macros macroexpand-all-environment))))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 19:13:41 -04:00
|
|
|
|
`(let ,bindings ,@body)
|
|
|
|
|
(cl--letf bindings () () body)))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-letf* (bindings &rest body)
|
|
|
|
|
"Temporarily bind to PLACEs.
|
|
|
|
|
Like `cl-letf' but where the bindings are performed one at a time,
|
|
|
|
|
rather than all at the end (i.e. like `let*' rather than like `let')."
|
|
|
|
|
(declare (indent 1) (debug cl-letf))
|
|
|
|
|
(dolist (binding (reverse bindings))
|
|
|
|
|
(setq body (list `(cl-letf (,binding) ,@body))))
|
|
|
|
|
(macroexp-progn body))
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-callf (func place &rest args)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Set PLACE to (FUNC PLACE ARGS...).
|
2019-05-24 00:50:20 +02:00
|
|
|
|
FUNC should be an unquoted function name or a lambda expression.
|
|
|
|
|
PLACE may be a symbol, or any generalized variable allowed by
|
|
|
|
|
`setf'."
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(declare (indent 2) (debug (cl-function place &rest form)))
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
(gv-letplace (getter setter) place
|
|
|
|
|
(let* ((rargs (cons getter args)))
|
|
|
|
|
(funcall setter
|
|
|
|
|
(if (symbolp func) (cons func rargs)
|
|
|
|
|
`(funcall #',func ,@rargs))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-callf2 (func arg1 place &rest args)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Set PLACE to (FUNC ARG1 PLACE ARGS...).
|
2012-06-03 21:05:17 -04:00
|
|
|
|
Like `cl-callf', but PLACE is the second argument of FUNC, not the first.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
|
|
|
|
\(fn FUNC ARG1 PLACE ARGS...)"
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(declare (indent 3) (debug (cl-function form place &rest form)))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (and (cl--safe-expr-p arg1) (cl--simple-expr-p place) (symbolp func))
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
`(setf ,place (,func ,arg1 ,place ,@args))
|
|
|
|
|
(macroexp-let2 nil a1 arg1
|
|
|
|
|
(gv-letplace (getter setter) place
|
|
|
|
|
(let* ((rargs (cl-list* a1 getter args)))
|
|
|
|
|
(funcall setter
|
|
|
|
|
(if (symbolp func) (cons func rargs)
|
|
|
|
|
`(funcall #',func ,@rargs))))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2015-03-18 10:31:07 -04:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-defsubst (name args &rest body)
|
|
|
|
|
"Define NAME as a function.
|
|
|
|
|
Like `defun', except the function is automatically declared `inline' and
|
|
|
|
|
the arguments are immutable.
|
|
|
|
|
ARGLIST allows full Common Lisp conventions, and BODY is implicitly
|
|
|
|
|
surrounded by (cl-block NAME ...).
|
|
|
|
|
The function's arguments should be treated as immutable.
|
|
|
|
|
|
|
|
|
|
\(fn NAME ARGLIST [DOCSTRING] BODY...)"
|
|
|
|
|
(declare (debug cl-defun) (indent 2))
|
|
|
|
|
(let* ((argns (cl--arglist-args args))
|
2015-03-20 16:29:21 -04:00
|
|
|
|
(real-args (if (eq '&cl-defs (car args)) (cddr args) args))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(p argns)
|
|
|
|
|
;; (pbody (cons 'progn body))
|
|
|
|
|
)
|
2015-03-20 16:29:21 -04:00
|
|
|
|
(while (and p (eq (cl--expr-contains real-args (car p)) 1)) (pop p))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
`(progn
|
|
|
|
|
,(if p nil ; give up if defaults refer to earlier args
|
|
|
|
|
`(cl-define-compiler-macro ,name
|
|
|
|
|
,(if (memq '&key args)
|
|
|
|
|
`(&whole cl-whole &cl-quote ,@args)
|
|
|
|
|
(cons '&cl-quote args))
|
2017-08-18 08:15:25 -04:00
|
|
|
|
,(format "compiler-macro for inlining `%s'." name)
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(cl--defsubst-expand
|
2017-08-18 08:15:25 -04:00
|
|
|
|
',argns '(cl-block ,name ,@(cdr (macroexp-parse-body body)))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
;; We used to pass `simple' as
|
|
|
|
|
;; (not (or unsafe (cl-expr-access-order pbody argns)))
|
|
|
|
|
;; But this is much too simplistic since it
|
|
|
|
|
;; does not pay attention to the argvs (and
|
|
|
|
|
;; cl-expr-access-order itself is also too naive).
|
|
|
|
|
nil
|
|
|
|
|
,(and (memq '&key args) 'cl-whole) nil ,@argns)))
|
|
|
|
|
(cl-defun ,name ,args ,@body))))
|
|
|
|
|
|
|
|
|
|
(defun cl--defsubst-expand (argns body simple whole _unsafe &rest argvs)
|
|
|
|
|
(if (and whole (not (cl--safe-expr-p (cons 'progn argvs)))) whole
|
|
|
|
|
(if (cl--simple-exprs-p argvs) (setq simple t))
|
|
|
|
|
(let* ((substs ())
|
|
|
|
|
(lets (delq nil
|
|
|
|
|
(cl-mapcar (lambda (argn argv)
|
|
|
|
|
(if (or simple (macroexp-const-p argv))
|
|
|
|
|
(progn (push (cons argn argv) substs)
|
|
|
|
|
nil)
|
|
|
|
|
(list argn argv)))
|
|
|
|
|
argns argvs))))
|
|
|
|
|
;; FIXME: `sublis/subst' will happily substitute the symbol
|
|
|
|
|
;; `argn' in places where it's not used as a reference
|
|
|
|
|
;; to a variable.
|
|
|
|
|
;; FIXME: `sublis/subst' will happily copy `argv' to a different
|
|
|
|
|
;; scope, leading to name capture.
|
|
|
|
|
(setq body (cond ((null substs) body)
|
|
|
|
|
((null (cdr substs))
|
|
|
|
|
(cl-subst (cdar substs) (caar substs) body))
|
|
|
|
|
(t (cl--sublis substs body))))
|
|
|
|
|
(if lets `(let ,lets ,body) body))))
|
|
|
|
|
|
|
|
|
|
(defun cl--sublis (alist tree)
|
|
|
|
|
"Perform substitutions indicated by ALIST in TREE (non-destructively)."
|
|
|
|
|
(let ((x (assq tree alist)))
|
|
|
|
|
(cond
|
|
|
|
|
(x (cdr x))
|
|
|
|
|
((consp tree)
|
|
|
|
|
(cons (cl--sublis alist (car tree)) (cl--sublis alist (cdr tree))))
|
|
|
|
|
(t tree))))
|
|
|
|
|
|
1993-07-30 20:15:09 +00:00
|
|
|
|
;;; Structures.
|
|
|
|
|
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(defmacro cl--find-class (type)
|
|
|
|
|
`(get ,type 'cl--class))
|
|
|
|
|
|
|
|
|
|
;; Rather than hard code cl-structure-object, we indirect through this variable
|
|
|
|
|
;; for bootstrapping reasons.
|
|
|
|
|
(defvar cl--struct-default-parent nil)
|
|
|
|
|
|
2019-04-02 12:24:52 -04:00
|
|
|
|
(defvar cl--struct-inline t
|
|
|
|
|
"If non-nil, `cl-defstruct' will define inlinable functions.")
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-defstruct (struct &rest descs)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
"Define a struct type.
|
2010-01-16 15:04:29 -05:00
|
|
|
|
This macro defines a new data type called NAME that stores data
|
|
|
|
|
in SLOTs. It defines a `make-NAME' constructor, a `copy-NAME'
|
|
|
|
|
copier, a `NAME-p' predicate, and slot accessors named `NAME-SLOT'.
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
You can use the accessors to set the corresponding slots, via `setf'.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
2010-01-16 15:04:29 -05:00
|
|
|
|
NAME may instead take the form (NAME OPTIONS...), where each
|
2012-10-06 13:34:57 -04:00
|
|
|
|
OPTION is either a single keyword or (KEYWORD VALUE) where
|
|
|
|
|
KEYWORD can be one of :conc-name, :constructor, :copier, :predicate,
|
2019-04-02 12:24:52 -04:00
|
|
|
|
:type, :named, :initial-offset, :print-function, :noinline, or :include.
|
2010-01-16 15:04:29 -05:00
|
|
|
|
|
2013-06-11 22:16:02 -04:00
|
|
|
|
Each SLOT may instead take the form (SNAME SDEFAULT SOPTIONS...), where
|
|
|
|
|
SDEFAULT is the default value of that slot and SOPTIONS are keyword-value
|
|
|
|
|
pairs for that slot.
|
2013-07-12 03:11:22 +02:00
|
|
|
|
Currently, only one keyword is supported, `:read-only'. If this has a
|
|
|
|
|
non-nil value, that slot cannot be set via `setf'.
|
2010-01-16 15:04:29 -05:00
|
|
|
|
|
|
|
|
|
\(fn NAME SLOTS...)"
|
2012-09-04 13:40:25 -04:00
|
|
|
|
(declare (doc-string 2) (indent 1)
|
2012-05-17 21:46:20 -04:00
|
|
|
|
(debug
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(&define ;Makes top-level form not be wrapped.
|
|
|
|
|
[&or symbolp
|
|
|
|
|
(gate
|
|
|
|
|
symbolp &rest
|
2016-09-14 21:50:31 +02:00
|
|
|
|
[&or symbolp
|
|
|
|
|
(&or [":conc-name" symbolp]
|
|
|
|
|
[":constructor" symbolp &optional cl-lambda-list]
|
|
|
|
|
[":copier" symbolp]
|
|
|
|
|
[":predicate" symbolp]
|
|
|
|
|
[":include" symbolp &rest sexp] ;; Not finished.
|
|
|
|
|
[":print-function" sexp]
|
|
|
|
|
[":type" symbolp]
|
|
|
|
|
[":named"]
|
|
|
|
|
[":initial-offset" natnump])])]
|
2012-05-17 17:39:36 -04:00
|
|
|
|
[&optional stringp]
|
|
|
|
|
;; All the above is for the following def-form.
|
2016-10-18 22:28:17 +02:00
|
|
|
|
&rest &or symbolp (symbolp &optional def-form &rest sexp))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let* ((name (if (consp struct) (car struct) struct))
|
|
|
|
|
(opts (cdr-safe struct))
|
|
|
|
|
(slots nil)
|
|
|
|
|
(defaults nil)
|
|
|
|
|
(conc-name (concat (symbol-name name) "-"))
|
|
|
|
|
(constructor (intern (format "make-%s" name)))
|
|
|
|
|
(constrs nil)
|
|
|
|
|
(copier (intern (format "copy-%s" name)))
|
|
|
|
|
(predicate (intern (format "%s-p" name)))
|
|
|
|
|
(print-func nil) (print-auto nil)
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(safety (if (cl--compiling-file) cl--optimize-safety 3))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(include nil)
|
2017-03-14 13:52:40 +01:00
|
|
|
|
;; There are 4 types of structs:
|
|
|
|
|
;; - `vector' type: means we should use a vector, which can come
|
|
|
|
|
;; with or without a tag `name', which is usually in slot 0
|
|
|
|
|
;; but obeys :initial-offset.
|
|
|
|
|
;; - `list' type: same as `vector' but using lists.
|
|
|
|
|
;; - `record' type: means we should use a record, which necessarily
|
|
|
|
|
;; comes tagged in slot 0. Currently we'll use the `name' as
|
|
|
|
|
;; the tag, but we may want to change it so that the class object
|
|
|
|
|
;; is used as the tag.
|
|
|
|
|
;; - nil type: this is the "pre-record default", which uses a vector
|
|
|
|
|
;; with a tag in slot 0 which is a symbol of the form
|
|
|
|
|
;; `cl-struct-NAME'. We need to still support this for backward
|
|
|
|
|
;; compatibility with old .elc files.
|
|
|
|
|
(tag name)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(tag-symbol (intern (format "cl-struct-%s-tags" name)))
|
|
|
|
|
(include-descs nil)
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(include-name nil)
|
2017-03-14 13:52:40 +01:00
|
|
|
|
(type nil) ;nil here means not specified explicitly.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(named nil)
|
2019-04-02 12:24:52 -04:00
|
|
|
|
(cldefsym (if cl--struct-inline 'cl-defsubst 'cl-defun))
|
|
|
|
|
(defsym (if cl--struct-inline 'cl-defsubst 'defun))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(forms nil)
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(docstring (if (stringp (car descs)) (pop descs)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
pred-form pred-check)
|
2017-12-21 18:25:49 +01:00
|
|
|
|
;; Can't use `cl-check-type' yet.
|
|
|
|
|
(unless (cl--struct-name-p name)
|
|
|
|
|
(signal 'wrong-type-argument (list 'cl-struct-name-p name 'name)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq descs (cons '(cl-tag-slot)
|
|
|
|
|
(mapcar (function (lambda (x) (if (consp x) x (list x))))
|
|
|
|
|
descs)))
|
|
|
|
|
(while opts
|
|
|
|
|
(let ((opt (if (consp (car opts)) (caar opts) (car opts)))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(args (cdr-safe (pop opts))))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
(cond ((eq opt :conc-name)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if args
|
|
|
|
|
(setq conc-name (if (car args)
|
|
|
|
|
(symbol-name (car args)) ""))))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
((eq opt :constructor)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (cdr args)
|
2005-11-27 20:59:10 +00:00
|
|
|
|
(progn
|
|
|
|
|
;; If this defines a constructor of the same name as
|
|
|
|
|
;; the default one, don't define the default.
|
|
|
|
|
(if (eq (car args) constructor)
|
|
|
|
|
(setq constructor nil))
|
|
|
|
|
(push args constrs))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if args (setq constructor (car args)))))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
((eq opt :copier)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if args (setq copier (car args))))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
((eq opt :predicate)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if args (setq predicate (car args))))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
((eq opt :include)
|
2015-03-18 10:31:07 -04:00
|
|
|
|
;; FIXME: Actually, we can include more than once as long as
|
|
|
|
|
;; we include EIEIO classes rather than cl-structs!
|
|
|
|
|
(when include-name (error "Can't :include more than once"))
|
|
|
|
|
(setq include-name (car args))
|
|
|
|
|
(setq include-descs (mapcar (function
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(if (consp x) x (list x))))
|
|
|
|
|
(cdr args))))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
((eq opt :print-function)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq print-func (car args)))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
((eq opt :type)
|
2017-03-14 13:52:40 +01:00
|
|
|
|
(setq type (car args))
|
|
|
|
|
(unless (memq type '(vector list))
|
|
|
|
|
(error "Invalid :type specifier: %s" type)))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
((eq opt :named)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq named t))
|
2019-04-02 12:24:52 -04:00
|
|
|
|
((eq opt :noinline)
|
|
|
|
|
(setq defsym 'defun) (setq cldefsym 'cl-defun))
|
2000-05-05 20:01:01 +00:00
|
|
|
|
((eq opt :initial-offset)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq descs (nconc (make-list (car args) '(cl-skip-slot))
|
|
|
|
|
descs)))
|
|
|
|
|
(t
|
2016-10-18 22:28:17 +02:00
|
|
|
|
(error "Structure option %s unrecognized" opt)))))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(unless (or include-name type)
|
|
|
|
|
(setq include-name cl--struct-default-parent))
|
|
|
|
|
(when include-name (setq include (cl--struct-get-class include-name)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if print-func
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(setq print-func
|
|
|
|
|
`(progn (funcall #',print-func cl-x cl-s cl-n) t))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(or type (and include (not (cl--struct-class-print include)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq print-auto t
|
|
|
|
|
print-func (and (or (not (or include type)) (null print-func))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(progn
|
|
|
|
|
(princ ,(format "#S(%s" name) cl-s))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if include
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(let* ((inc-type (cl--struct-class-type include))
|
|
|
|
|
(old-descs (cl-struct-slot-info include)))
|
|
|
|
|
(and type (not (eq inc-type type))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(error ":type disagrees with :include for %s" name))
|
|
|
|
|
(while include-descs
|
|
|
|
|
(setcar (memq (or (assq (caar include-descs) old-descs)
|
|
|
|
|
(error "No slot %s in included struct %s"
|
|
|
|
|
(caar include-descs) include))
|
|
|
|
|
old-descs)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(pop include-descs)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq descs (append old-descs (delq (assq 'cl-tag-slot descs) descs))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
type inc-type
|
2017-03-14 13:52:40 +01:00
|
|
|
|
named (if (memq type '(vector list))
|
|
|
|
|
(assq 'cl-tag-slot descs)
|
|
|
|
|
'true))
|
|
|
|
|
(if (cl--struct-class-named include) (setq named t)))
|
|
|
|
|
(unless type
|
2015-02-16 01:37:57 -05:00
|
|
|
|
(setq named 'true)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(or named (setq descs (delq (assq 'cl-tag-slot descs) descs)))
|
2014-10-23 17:44:36 -04:00
|
|
|
|
(when (and (null predicate) named)
|
|
|
|
|
(setq predicate (intern (format "cl--struct-%s-p" name))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq pred-form (and named
|
|
|
|
|
(let ((pos (- (length descs)
|
|
|
|
|
(length (memq (assq 'cl-tag-slot descs)
|
|
|
|
|
descs)))))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(cond
|
2017-03-14 13:52:40 +01:00
|
|
|
|
((null type) ;Record type.
|
|
|
|
|
`(memq (type-of cl-x) ,tag-symbol))
|
|
|
|
|
((eq type 'vector)
|
2015-01-27 22:41:31 -05:00
|
|
|
|
`(and (vectorp cl-x)
|
|
|
|
|
(>= (length cl-x) ,(length descs))
|
|
|
|
|
(memq (aref cl-x ,pos) ,tag-symbol)))
|
|
|
|
|
((= pos 0) `(memq (car-safe cl-x) ,tag-symbol))
|
|
|
|
|
(t `(and (consp cl-x)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(memq (nth ,pos cl-x) ,tag-symbol))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
pred-check (and pred-form (> safety 0)
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(if (and (eq (cl-caadr pred-form) 'vectorp)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(= safety 1))
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(cons 'and (cl-cdddr pred-form))
|
2014-10-23 17:44:36 -04:00
|
|
|
|
`(,predicate cl-x))))
|
2016-12-02 00:03:57 -05:00
|
|
|
|
(when pred-form
|
2019-04-02 12:24:52 -04:00
|
|
|
|
(push `(,defsym ,predicate (cl-x)
|
2016-12-02 00:03:57 -05:00
|
|
|
|
(declare (side-effect-free error-free))
|
|
|
|
|
,(if (eq (car pred-form) 'and)
|
|
|
|
|
(append pred-form '(t))
|
|
|
|
|
`(and ,pred-form t)))
|
|
|
|
|
forms)
|
|
|
|
|
(push `(put ',name 'cl-deftype-satisfies ',predicate) forms))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(let ((pos 0) (descp descs))
|
|
|
|
|
(while descp
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(let* ((desc (pop descp))
|
2016-10-18 22:28:17 +02:00
|
|
|
|
(slot (pop desc)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if (memq slot '(cl-tag-slot cl-skip-slot))
|
|
|
|
|
(progn
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push nil slots)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(push (and (eq slot 'cl-tag-slot) `',tag)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
defaults))
|
|
|
|
|
(if (assq slot descp)
|
|
|
|
|
(error "Duplicate slots named %s in %s" slot name))
|
|
|
|
|
(let ((accessor (intern (format "%s%s" conc-name slot))))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push slot slots)
|
2016-10-18 22:28:17 +02:00
|
|
|
|
(push (pop desc) defaults)
|
2016-05-27 19:22:29 -04:00
|
|
|
|
;; The arg "cl-x" is referenced by name in eg pred-form
|
|
|
|
|
;; and pred-check, so changing it is not straightforward.
|
2019-04-02 12:24:52 -04:00
|
|
|
|
(push `(,defsym ,accessor (cl-x)
|
2016-05-27 19:22:29 -04:00
|
|
|
|
,(format "Access slot \"%s\" of `%s' struct CL-X."
|
2019-05-16 22:00:57 -04:00
|
|
|
|
slot name)
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(declare (side-effect-free t))
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
,@(and pred-check
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(list `(or ,pred-check
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(signal 'wrong-type-argument
|
2016-05-27 19:22:29 -04:00
|
|
|
|
(list ',name cl-x)))))
|
|
|
|
|
,(if (memq type '(nil vector)) `(aref cl-x ,pos)
|
|
|
|
|
(if (= pos 0) '(car cl-x)
|
|
|
|
|
`(nth ,pos cl-x))))
|
2014-07-20 21:41:59 -04:00
|
|
|
|
forms)
|
2016-10-18 22:28:17 +02:00
|
|
|
|
(when (cl-oddp (length desc))
|
2017-01-03 16:07:44 -05:00
|
|
|
|
(push
|
|
|
|
|
(macroexp--warn-and-return
|
|
|
|
|
(format "Missing value for option `%S' of slot `%s' in struct %s!"
|
|
|
|
|
(car (last desc)) slot name)
|
|
|
|
|
'nil)
|
|
|
|
|
forms)
|
|
|
|
|
(when (and (keywordp (car defaults))
|
|
|
|
|
(not (keywordp (car desc))))
|
|
|
|
|
(let ((kw (car defaults)))
|
|
|
|
|
(push
|
|
|
|
|
(macroexp--warn-and-return
|
|
|
|
|
(format " I'll take `%s' to be an option rather than a default value."
|
|
|
|
|
kw)
|
|
|
|
|
'nil)
|
|
|
|
|
forms)
|
|
|
|
|
(push kw desc)
|
|
|
|
|
(setcar defaults nil))))
|
2016-10-18 22:28:17 +02:00
|
|
|
|
(if (plist-get desc ':read-only)
|
2012-10-09 02:01:10 -04:00
|
|
|
|
(push `(gv-define-expander ,accessor
|
|
|
|
|
(lambda (_cl-do _cl-x)
|
|
|
|
|
(error "%s is a read-only slot" ',accessor)))
|
|
|
|
|
forms)
|
|
|
|
|
;; For normal slots, we don't need to define a setf-expander,
|
|
|
|
|
;; since gv-get can use the compiler macro to get the
|
|
|
|
|
;; same result.
|
|
|
|
|
;; (push `(gv-define-setter ,accessor (cl-val cl-x)
|
|
|
|
|
;; ;; If cl is loaded only for compilation,
|
|
|
|
|
;; ;; the call to cl--struct-setf-expander would
|
|
|
|
|
;; ;; cause a warning because it may not be
|
|
|
|
|
;; ;; defined at run time. Suppress that warning.
|
|
|
|
|
;; (progn
|
|
|
|
|
;; (declare-function
|
|
|
|
|
;; cl--struct-setf-expander "cl-macs"
|
|
|
|
|
;; (x name accessor pred-form pos))
|
|
|
|
|
;; (cl--struct-setf-expander
|
|
|
|
|
;; cl-val cl-x ',name ',accessor
|
|
|
|
|
;; ,(and pred-check `',pred-check)
|
|
|
|
|
;; ,pos)))
|
|
|
|
|
;; forms)
|
|
|
|
|
)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if print-auto
|
|
|
|
|
(nconc print-func
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(list `(princ ,(format " %s" slot) cl-s)
|
|
|
|
|
`(prin1 (,accessor cl-x) cl-s)))))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq pos (1+ pos))))
|
|
|
|
|
(setq slots (nreverse slots)
|
|
|
|
|
defaults (nreverse defaults))
|
|
|
|
|
(and copier
|
2017-04-07 18:54:40 -07:00
|
|
|
|
(push `(defalias ',copier #'copy-sequence)
|
2017-03-14 13:52:40 +01:00
|
|
|
|
forms))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if constructor
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list constructor
|
2015-07-07 02:14:16 -04:00
|
|
|
|
(cons '&key (delq nil (copy-sequence slots))))
|
|
|
|
|
constrs))
|
|
|
|
|
(pcase-dolist (`(,cname ,args ,doc) constrs)
|
|
|
|
|
(let* ((anames (cl--arglist-args args))
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(make (cl-mapcar (function (lambda (s d) (if (memq s anames) s d)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
slots defaults)))
|
2019-04-02 12:24:52 -04:00
|
|
|
|
(push `(,cldefsym ,cname
|
2015-03-16 16:11:38 -04:00
|
|
|
|
(&cl-defs (nil ,@descs) ,@args)
|
2015-11-07 11:25:31 +00:00
|
|
|
|
,(if (stringp doc) doc
|
2015-07-07 02:14:16 -04:00
|
|
|
|
(format "Constructor for objects of type `%s'." name))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
,@(if (cl--safe-expr-p `(progn ,@(mapcar #'cl-second descs)))
|
|
|
|
|
'((declare (side-effect-free t))))
|
2017-03-14 13:52:40 +01:00
|
|
|
|
(,(or type #'record) ,@make))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
forms)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if print-auto (nconc print-func (list '(princ ")" cl-s) t)))
|
2012-06-13 16:52:25 -04:00
|
|
|
|
;; Don't bother adding to cl-custom-print-functions since it's not used
|
|
|
|
|
;; by anything anyway!
|
|
|
|
|
;;(if print-func
|
|
|
|
|
;; (push `(if (boundp 'cl-custom-print-functions)
|
|
|
|
|
;; (push
|
|
|
|
|
;; ;; The auto-generated function does not pay attention to
|
|
|
|
|
;; ;; the depth argument cl-n.
|
|
|
|
|
;; (lambda (cl-x cl-s ,(if print-auto '_cl-n 'cl-n))
|
|
|
|
|
;; (and ,pred-form ,print-func))
|
|
|
|
|
;; cl-custom-print-functions))
|
|
|
|
|
;; forms))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
`(progn
|
|
|
|
|
(defvar ,tag-symbol)
|
|
|
|
|
,@(nreverse forms)
|
2015-03-18 10:31:07 -04:00
|
|
|
|
;; Call cl-struct-define during compilation as well, so that
|
|
|
|
|
;; a subsequent cl-defstruct in the same file can correctly include this
|
|
|
|
|
;; struct as a parent.
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(eval-and-compile
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(cl-struct-define ',name ,docstring ',include-name
|
2017-03-24 09:21:52 -04:00
|
|
|
|
',(or type 'record) ,(eq named t) ',descs
|
|
|
|
|
',tag-symbol ',tag ',print-auto))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
',name)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2015-03-23 18:24:30 -04:00
|
|
|
|
;;; Add cl-struct support to pcase
|
|
|
|
|
|
2015-03-23 23:40:06 -04:00
|
|
|
|
(defun cl--struct-all-parents (class)
|
|
|
|
|
(when (cl--struct-class-p class)
|
|
|
|
|
(let ((res ())
|
|
|
|
|
(classes (list class)))
|
|
|
|
|
;; BFS precedence.
|
|
|
|
|
(while (let ((class (pop classes)))
|
|
|
|
|
(push class res)
|
|
|
|
|
(setq classes
|
|
|
|
|
(append classes
|
|
|
|
|
(cl--class-parents class)))))
|
|
|
|
|
(nreverse res))))
|
|
|
|
|
|
2015-03-23 18:24:30 -04:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(pcase-defmacro cl-struct (type &rest fields)
|
2018-05-21 17:16:31 +02:00
|
|
|
|
"Pcase patterns that match cl-struct EXPVAL of type TYPE.
|
|
|
|
|
Elements of FIELDS can be of the form (NAME PAT) in which case the
|
|
|
|
|
contents of field NAME is matched against PAT, or they can be of
|
|
|
|
|
the form NAME which is a shorthand for (NAME NAME)."
|
2015-09-05 17:10:50 +02:00
|
|
|
|
(declare (debug (sexp &rest [&or (sexp pcase-PAT) sexp])))
|
2015-03-23 23:40:06 -04:00
|
|
|
|
`(and (pred (pcase--flip cl-typep ',type))
|
2015-03-23 18:24:30 -04:00
|
|
|
|
,@(mapcar
|
|
|
|
|
(lambda (field)
|
|
|
|
|
(let* ((name (if (consp field) (car field) field))
|
|
|
|
|
(pat (if (consp field) (cadr field) field)))
|
|
|
|
|
`(app ,(if (eq (cl-struct-sequence-type type) 'list)
|
|
|
|
|
`(nth ,(cl-struct-slot-offset type name))
|
|
|
|
|
`(pcase--flip aref ,(cl-struct-slot-offset type name)))
|
|
|
|
|
,pat)))
|
|
|
|
|
fields)))
|
|
|
|
|
|
2017-03-14 13:52:40 +01:00
|
|
|
|
(defun cl--defstruct-predicate (type)
|
|
|
|
|
(let ((cons (assq (cl-struct-sequence-type type)
|
2018-11-05 01:22:15 +01:00
|
|
|
|
'((list . consp)
|
2017-03-14 13:52:40 +01:00
|
|
|
|
(vector . vectorp)
|
|
|
|
|
(nil . recordp)))))
|
|
|
|
|
(if cons
|
|
|
|
|
(cdr cons)
|
|
|
|
|
'recordp)))
|
|
|
|
|
|
2015-03-23 23:40:06 -04:00
|
|
|
|
(defun cl--pcase-mutually-exclusive-p (orig pred1 pred2)
|
|
|
|
|
"Extra special cases for `cl-typep' predicates."
|
|
|
|
|
(let* ((x1 pred1) (x2 pred2)
|
|
|
|
|
(t1
|
|
|
|
|
(and (eq 'pcase--flip (car-safe x1)) (setq x1 (cdr x1))
|
|
|
|
|
(eq 'cl-typep (car-safe x1)) (setq x1 (cdr x1))
|
|
|
|
|
(null (cdr-safe x1)) (setq x1 (car x1))
|
|
|
|
|
(eq 'quote (car-safe x1)) (cadr x1)))
|
|
|
|
|
(t2
|
|
|
|
|
(and (eq 'pcase--flip (car-safe x2)) (setq x2 (cdr x2))
|
|
|
|
|
(eq 'cl-typep (car-safe x2)) (setq x2 (cdr x2))
|
|
|
|
|
(null (cdr-safe x2)) (setq x2 (car x2))
|
|
|
|
|
(eq 'quote (car-safe x2)) (cadr x2))))
|
|
|
|
|
(or
|
|
|
|
|
(and (symbolp t1) (symbolp t2)
|
|
|
|
|
(let ((c1 (cl--find-class t1))
|
|
|
|
|
(c2 (cl--find-class t2)))
|
|
|
|
|
(and c1 c2
|
|
|
|
|
(not (or (memq c1 (cl--struct-all-parents c2))
|
|
|
|
|
(memq c2 (cl--struct-all-parents c1)))))))
|
|
|
|
|
(let ((c1 (and (symbolp t1) (cl--find-class t1))))
|
|
|
|
|
(and c1 (cl--struct-class-p c1)
|
2017-03-14 13:52:40 +01:00
|
|
|
|
(funcall orig (cl--defstruct-predicate t1)
|
2015-03-23 23:40:06 -04:00
|
|
|
|
pred2)))
|
|
|
|
|
(let ((c2 (and (symbolp t2) (cl--find-class t2))))
|
|
|
|
|
(and c2 (cl--struct-class-p c2)
|
|
|
|
|
(funcall orig pred1
|
2017-03-14 13:52:40 +01:00
|
|
|
|
(cl--defstruct-predicate t2))))
|
2015-03-23 23:40:06 -04:00
|
|
|
|
(funcall orig pred1 pred2))))
|
|
|
|
|
(advice-add 'pcase--mutually-exclusive-p
|
|
|
|
|
:around #'cl--pcase-mutually-exclusive-p)
|
|
|
|
|
|
|
|
|
|
|
2014-04-19 19:34:22 -07:00
|
|
|
|
(defun cl-struct-sequence-type (struct-type)
|
|
|
|
|
"Return the sequence used to build STRUCT-TYPE.
|
2017-03-14 13:52:40 +01:00
|
|
|
|
STRUCT-TYPE is a symbol naming a struct type. Return `record',
|
|
|
|
|
`vector`, or `list' if STRUCT-TYPE is a struct type, nil otherwise."
|
2014-04-22 12:22:13 -04:00
|
|
|
|
(declare (side-effect-free t) (pure t))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(cl--struct-class-type (cl--struct-get-class struct-type)))
|
2014-04-19 19:34:22 -07:00
|
|
|
|
|
|
|
|
|
(defun cl-struct-slot-info (struct-type)
|
|
|
|
|
"Return a list of slot names of struct STRUCT-TYPE.
|
|
|
|
|
Each entry is a list (SLOT-NAME . OPTS), where SLOT-NAME is a
|
|
|
|
|
slot name symbol and OPTS is a list of slot options given to
|
|
|
|
|
`cl-defstruct'. Dummy slots that represent the struct name and
|
|
|
|
|
slots skipped by :initial-offset may appear in the list."
|
2014-04-22 12:22:13 -04:00
|
|
|
|
(declare (side-effect-free t) (pure t))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(let* ((class (cl--struct-get-class struct-type))
|
|
|
|
|
(slots (cl--struct-class-slots class))
|
|
|
|
|
(type (cl--struct-class-type class))
|
|
|
|
|
(descs (if type () (list '(cl-tag-slot)))))
|
|
|
|
|
(dotimes (i (length slots))
|
|
|
|
|
(let ((slot (aref slots i)))
|
|
|
|
|
(push `(,(cl--slot-descriptor-name slot)
|
|
|
|
|
,(cl--slot-descriptor-initform slot)
|
|
|
|
|
,@(if (not (eq (cl--slot-descriptor-type slot) t))
|
|
|
|
|
`(:type ,(cl--slot-descriptor-type slot)))
|
|
|
|
|
,@(cl--slot-descriptor-props slot))
|
|
|
|
|
descs)))
|
|
|
|
|
(nreverse descs)))
|
2014-04-19 19:34:22 -07:00
|
|
|
|
|
2015-07-07 02:14:16 -04:00
|
|
|
|
(define-error 'cl-struct-unknown-slot "struct %S has no slot %S")
|
|
|
|
|
|
2014-04-19 19:34:22 -07:00
|
|
|
|
(defun cl-struct-slot-offset (struct-type slot-name)
|
|
|
|
|
"Return the offset of slot SLOT-NAME in STRUCT-TYPE.
|
|
|
|
|
The returned zero-based slot index is relative to the start of
|
|
|
|
|
the structure data type and is adjusted for any structure name
|
|
|
|
|
and :initial-offset slots. Signal error if struct STRUCT-TYPE
|
|
|
|
|
does not contain SLOT-NAME."
|
2014-04-22 12:22:13 -04:00
|
|
|
|
(declare (side-effect-free t) (pure t))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(or (gethash slot-name
|
|
|
|
|
(cl--class-index-table (cl--struct-get-class struct-type)))
|
2015-07-07 02:14:16 -04:00
|
|
|
|
(signal 'cl-struct-unknown-slot (list struct-type slot-name))))
|
2014-04-19 19:34:22 -07:00
|
|
|
|
|
2014-01-23 10:01:41 -05:00
|
|
|
|
(defvar byte-compile-function-environment)
|
|
|
|
|
(defvar byte-compile-macro-environment)
|
|
|
|
|
|
|
|
|
|
(defun cl--macroexp-fboundp (sym)
|
|
|
|
|
"Return non-nil if SYM will be bound when we run the code.
|
|
|
|
|
Of course, we really can't know that for sure, so it's just a heuristic."
|
|
|
|
|
(or (fboundp sym)
|
|
|
|
|
(and (cl--compiling-file)
|
|
|
|
|
(or (cdr (assq sym byte-compile-function-environment))
|
|
|
|
|
(cdr (assq sym byte-compile-macro-environment))))))
|
|
|
|
|
|
2015-02-14 00:46:29 -05:00
|
|
|
|
(put 'null 'cl-deftype-satisfies #'null)
|
|
|
|
|
(put 'atom 'cl-deftype-satisfies #'atom)
|
|
|
|
|
(put 'real 'cl-deftype-satisfies #'numberp)
|
|
|
|
|
(put 'fixnum 'cl-deftype-satisfies #'integerp)
|
|
|
|
|
(put 'base-char 'cl-deftype-satisfies #'characterp)
|
2015-12-04 08:28:39 -05:00
|
|
|
|
(put 'character 'cl-deftype-satisfies #'natnump)
|
2015-02-14 00:46:29 -05:00
|
|
|
|
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2015-02-14 00:46:29 -05:00
|
|
|
|
(define-inline cl-typep (val type)
|
|
|
|
|
(inline-letevals (val)
|
|
|
|
|
(pcase (inline-const-val type)
|
|
|
|
|
((and `(,name . ,args) (guard (get name 'cl-deftype-handler)))
|
|
|
|
|
(inline-quote
|
|
|
|
|
(cl-typep ,val ',(apply (get name 'cl-deftype-handler) args))))
|
|
|
|
|
(`(,(and name (or 'integer 'float 'real 'number))
|
|
|
|
|
. ,(or `(,min ,max) pcase--dontcare))
|
|
|
|
|
(inline-quote
|
|
|
|
|
(and (cl-typep ,val ',name)
|
|
|
|
|
,(if (memq min '(* nil)) t
|
|
|
|
|
(if (consp min)
|
|
|
|
|
(inline-quote (> ,val ',(car min)))
|
|
|
|
|
(inline-quote (>= ,val ',min))))
|
|
|
|
|
,(if (memq max '(* nil)) t
|
|
|
|
|
(if (consp max)
|
|
|
|
|
(inline-quote (< ,val ',(car max)))
|
|
|
|
|
(inline-quote (<= ,val ',max)))))))
|
|
|
|
|
(`(not ,type) (inline-quote (not (cl-typep ,val ',type))))
|
|
|
|
|
(`(,(and name (or 'and 'or)) . ,types)
|
|
|
|
|
(cond
|
|
|
|
|
((null types) (inline-quote ',(eq name 'and)))
|
|
|
|
|
((null (cdr types))
|
|
|
|
|
(inline-quote (cl-typep ,val ',(car types))))
|
|
|
|
|
(t
|
|
|
|
|
(let ((head (car types))
|
|
|
|
|
(rest `(,name . ,(cdr types))))
|
|
|
|
|
(cond
|
|
|
|
|
((eq name 'and)
|
|
|
|
|
(inline-quote (and (cl-typep ,val ',head)
|
|
|
|
|
(cl-typep ,val ',rest))))
|
|
|
|
|
(t
|
|
|
|
|
(inline-quote (or (cl-typep ,val ',head)
|
|
|
|
|
(cl-typep ,val ',rest)))))))))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
(`(eql ,v) (inline-quote (and (eql ,val ',v) t)))
|
|
|
|
|
(`(member . ,args) (inline-quote (and (memql ,val ',args) t)))
|
2015-02-14 00:46:29 -05:00
|
|
|
|
(`(satisfies ,pred) (inline-quote (funcall #',pred ,val)))
|
|
|
|
|
((and (pred symbolp) type (guard (get type 'cl-deftype-handler)))
|
|
|
|
|
(inline-quote
|
|
|
|
|
(cl-typep ,val ',(funcall (get type 'cl-deftype-handler)))))
|
|
|
|
|
((and (pred symbolp) type (guard (get type 'cl-deftype-satisfies)))
|
|
|
|
|
(inline-quote (funcall #',(get type 'cl-deftype-satisfies) ,val)))
|
|
|
|
|
((and (or 'nil 't) type) (inline-quote ',type))
|
|
|
|
|
((and (pred symbolp) type)
|
|
|
|
|
(let* ((name (symbol-name type))
|
|
|
|
|
(namep (intern (concat name "p"))))
|
|
|
|
|
(cond
|
|
|
|
|
((cl--macroexp-fboundp namep) (inline-quote (funcall #',namep ,val)))
|
|
|
|
|
((cl--macroexp-fboundp
|
|
|
|
|
(setq namep (intern (concat name "-p"))))
|
|
|
|
|
(inline-quote (funcall #',namep ,val)))
|
|
|
|
|
((cl--macroexp-fboundp type) (inline-quote (funcall #',type ,val)))
|
|
|
|
|
(t (error "Unknown type %S" type)))))
|
|
|
|
|
(type (error "Bad type spec: %s" type)))))
|
|
|
|
|
|
2013-06-11 22:16:02 -04:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-check-type (form type &optional string)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
"Verify that FORM is of type TYPE; signal an error if not.
|
|
|
|
|
STRING is an optional description of the desired type."
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug (place cl-type-spec &optional stringp)))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(and (or (not (cl--compiling-file))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(< cl--optimize-speed 3) (= cl--optimize-safety 3))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(macroexp-let2 macroexp-copyable-p temp form
|
|
|
|
|
`(progn (or (cl-typep ,temp ',type)
|
|
|
|
|
(signal 'wrong-type-argument
|
|
|
|
|
(list ,(or string `',type) ,temp ',form)))
|
|
|
|
|
nil))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-assert (form &optional show-args string &rest args)
|
2012-06-27 11:11:28 -04:00
|
|
|
|
;; FIXME: This is actually not compatible with Common-Lisp's `assert'.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
"Verify that FORM returns non-nil; signal an error if not.
|
|
|
|
|
Second arg SHOW-ARGS means to include arguments of FORM in message.
|
|
|
|
|
Other args STRING and ARGS... are arguments to be passed to `error'.
|
|
|
|
|
They are not evaluated unless the assertion fails. If STRING is
|
|
|
|
|
omitted, a default message listing FORM itself is used."
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug (form &rest form)))
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(and (or (not (cl--compiling-file))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(< cl--optimize-speed 3) (= cl--optimize-safety 3))
|
2008-01-25 22:52:50 +00:00
|
|
|
|
(let ((sargs (and show-args
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(delq nil (mapcar (lambda (x)
|
|
|
|
|
(unless (macroexp-const-p x)
|
|
|
|
|
x))
|
2016-07-03 23:44:14 -04:00
|
|
|
|
(cdr-safe form))))))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(progn
|
|
|
|
|
(or ,form
|
2015-02-14 00:46:29 -05:00
|
|
|
|
(cl--assertion-failed
|
|
|
|
|
',form ,@(if (or string sargs args)
|
|
|
|
|
`(,string (list ,@sargs) (list ,@args)))))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
nil))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;;; Compiler macros.
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-define-compiler-macro (func args &rest body)
|
2000-05-05 20:01:01 +00:00
|
|
|
|
"Define a compiler-only macro.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
This is like `defmacro', but macro expansion occurs only if the call to
|
|
|
|
|
FUNC is compiled (i.e., not interpreted). Compiler macros should be used
|
|
|
|
|
for optimizing the way calls to FUNC are compiled; the form returned by
|
|
|
|
|
BODY should do the same thing as a call to the normal function called
|
|
|
|
|
FUNC, though possibly more efficiently. Note that, like regular macros,
|
|
|
|
|
compiler macros are expanded repeatedly until no further expansions are
|
|
|
|
|
possible. Unlike regular macros, BODY can decide to \"punt\" and leave the
|
|
|
|
|
original function call alone by declaring an initial `&whole foo' parameter
|
|
|
|
|
and then returning foo."
|
2014-02-21 12:45:26 -05:00
|
|
|
|
(declare (debug cl-defmacro) (indent 2))
|
1998-01-22 02:26:48 +00:00
|
|
|
|
(let ((p args) (res nil))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(while (consp p) (push (pop p) res))
|
1998-01-22 02:26:48 +00:00
|
|
|
|
(setq args (nconc (nreverse res) (and p (list '&rest p)))))
|
2014-11-09 00:14:25 -05:00
|
|
|
|
;; FIXME: The code in bytecomp mishandles top-level expressions that define
|
|
|
|
|
;; uninterned functions. E.g. it would generate code like:
|
|
|
|
|
;; (defalias '#1=#:foo--cmacro #[514 ...])
|
|
|
|
|
;; (put 'foo 'compiler-macro '#:foo--cmacro)
|
|
|
|
|
;; So we circumvent this by using an interned name.
|
|
|
|
|
(let ((fname (intern (concat (symbol-name func) "--cmacro"))))
|
2013-06-11 22:16:02 -04:00
|
|
|
|
`(eval-and-compile
|
|
|
|
|
;; Name the compiler-macro function, so that `symbol-file' can find it.
|
|
|
|
|
(cl-defun ,fname ,(if (memq '&whole args) (delq '&whole args)
|
|
|
|
|
(cons '_cl-whole-arg args))
|
|
|
|
|
,@body)
|
|
|
|
|
(put ',func 'compiler-macro #',fname))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defun cl-compiler-macroexpand (form)
|
2012-11-05 00:29:12 -08:00
|
|
|
|
"Like `macroexpand', but for compiler macros.
|
|
|
|
|
Expands FORM repeatedly until no further expansion is possible.
|
|
|
|
|
Returns FORM unchanged if it has no compiler macro, or if it has a
|
|
|
|
|
macro that returns its `&whole' argument."
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(while
|
|
|
|
|
(let ((func (car-safe form)) (handler nil))
|
|
|
|
|
(while (and (symbolp func)
|
2012-06-05 11:41:12 -04:00
|
|
|
|
(not (setq handler (get func 'compiler-macro)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(fboundp func)
|
2012-07-25 21:27:33 -04:00
|
|
|
|
(or (not (autoloadp (symbol-function func)))
|
|
|
|
|
(autoload-do-load (symbol-function func) func)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(setq func (symbol-function func)))
|
|
|
|
|
(and handler
|
|
|
|
|
(not (eq form (setq form (apply handler form (cdr form))))))))
|
|
|
|
|
form)
|
|
|
|
|
|
2011-03-18 20:21:27 -04:00
|
|
|
|
;; Optimize away unused block-wrappers.
|
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defvar cl--active-block-names nil)
|
2011-03-18 20:21:27 -04:00
|
|
|
|
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(cl-define-compiler-macro cl--block-wrapper (cl-form)
|
2011-03-18 20:21:27 -04:00
|
|
|
|
(let* ((cl-entry (cons (nth 1 (nth 1 cl-form)) nil))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(cl--active-block-names (cons cl-entry cl--active-block-names))
|
2011-03-18 20:21:27 -04:00
|
|
|
|
(cl-body (macroexpand-all ;Performs compiler-macro expansions.
|
2013-11-06 23:38:00 -05:00
|
|
|
|
(macroexp-progn (cddr cl-form))
|
2011-03-18 20:21:27 -04:00
|
|
|
|
macroexpand-all-environment)))
|
|
|
|
|
;; FIXME: To avoid re-applying macroexpand-all, we'd like to be able
|
|
|
|
|
;; to indicate that this return value is already fully expanded.
|
|
|
|
|
(if (cdr cl-entry)
|
2013-11-07 14:30:43 -05:00
|
|
|
|
`(catch ,(nth 1 cl-form) ,@(macroexp-unprogn cl-body))
|
2011-03-18 20:21:27 -04:00
|
|
|
|
cl-body)))
|
|
|
|
|
|
Use lexical-binding for all of CL, and clean up its namespace.
* lisp/emacs-lisp/cl-lib.el: Use lexical-binding.
(cl-map-extents, cl-maclisp-member): Remove.
(cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
(cl--set-substring, cl--block-wrapper, cl--block-throw)
(cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
* lisp/emacs-lisp/cl-extra.el: Use lexical-binding.
(cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
(cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
(cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
* lisp/emacs-lisp/cl-seq.el: Use lexical-binding.
(cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
(cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
(cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
* lisp/emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
* lisp/edmacro.el (edmacro-mismatch): Simplify to remove dependence on
CL's internals.
2012-06-11 11:52:50 -04:00
|
|
|
|
(cl-define-compiler-macro cl--block-throw (cl-tag cl-value)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(let ((cl-found (assq (nth 1 cl-tag) cl--active-block-names)))
|
2011-03-18 20:21:27 -04:00
|
|
|
|
(if cl-found (setcdr cl-found t)))
|
|
|
|
|
`(throw ,cl-tag ,cl-value))
|
|
|
|
|
|
2007-06-29 04:37:34 +00:00
|
|
|
|
;; Compile-time optimizations for some functions defined in this package.
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-06-08 22:26:47 -04:00
|
|
|
|
(defun cl--compiler-macro-member (form a list &rest keys)
|
2000-05-05 20:01:01 +00:00
|
|
|
|
(let ((test (and (= (length keys) 2) (eq (car keys) :test)
|
2014-04-21 11:00:19 -07:00
|
|
|
|
(cl--const-expr-val (nth 1 keys)))))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(cond ((eq test 'eq) `(memq ,a ,list))
|
|
|
|
|
((eq test 'equal) `(member ,a ,list))
|
|
|
|
|
((or (null keys) (eq test 'eql)) `(memql ,a ,list))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(t form))))
|
|
|
|
|
|
2012-06-08 22:26:47 -04:00
|
|
|
|
(defun cl--compiler-macro-assoc (form a list &rest keys)
|
2000-05-05 20:01:01 +00:00
|
|
|
|
(let ((test (and (= (length keys) 2) (eq (car keys) :test)
|
2014-04-21 11:00:19 -07:00
|
|
|
|
(cl--const-expr-val (nth 1 keys)))))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
(cond ((eq test 'eq) `(assq ,a ,list))
|
|
|
|
|
((eq test 'equal) `(assoc ,a ,list))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
((and (macroexp-const-p a) (or (null keys) (eq test 'eql)))
|
2014-04-21 11:00:19 -07:00
|
|
|
|
(if (floatp (cl--const-expr-val a))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(assoc ,a ,list) `(assq ,a ,list)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(t form))))
|
|
|
|
|
|
Fix compiler-expansion of CL's cXXr functions.
* emacs-lisp/cl-lib.el (cl--defalias): New function.
(cl-values, cl-values-list, cl-copy-seq, cl-svref, cl-first)
(cl-second, cl-rest, cl-endp, cl-third, cl-fourth): Use it.
(cl-plusp, cl-minusp, cl-fifth, cl-sixth, cl-seventh, cl-eighth)
(cl-ninth, cl-tenth): Mark them as inlinable.
(cl-caaar, cl-caadr, cl-cadar, cl-caddr, cl-cdaar, cl-cdadr)
(cl-cddar, cl-cdddr, cl-caaaar, cl-caaadr, cl-caadar, cl-caaddr)
(cl-cadaar, cl-cadadr, cl-caddar, cl-cadddr, cl-cdaaar, cl-cdaadr)
(cl-cdadar, cl-cdaddr, cl-cddaar, cl-cddadr, cl-cdddar, cl-cddddr):
Add a compiler-macro declaration to use cl--compiler-macro-cXXr.
(cl-list*, cl-adjoin): Don't put an autoload manually.
* emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin)
(cl--compiler-macro-list*): Add autoload cookie.
(cl--compiler-macro-cXXr): New function.
* help-fns.el (help-fns--compiler-macro): New function extracted from
describe-function-1; follow aliases and use `compiler-macro' property.
(describe-function-1): Use it.
Fixes: debbugs:11673
2012-06-11 16:35:00 -04:00
|
|
|
|
;;;###autoload
|
2012-06-08 22:26:47 -04:00
|
|
|
|
(defun cl--compiler-macro-adjoin (form a list &rest keys)
|
2013-06-04 22:35:40 -04:00
|
|
|
|
(if (memq :key keys) form
|
2014-11-24 22:57:53 +08:00
|
|
|
|
(macroexp-let2* macroexp-copyable-p ((va a) (vlist list))
|
|
|
|
|
`(if (cl-member ,va ,vlist ,@keys) ,vlist (cons ,va ,vlist)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2012-06-08 22:26:47 -04:00
|
|
|
|
(defun cl--compiler-macro-get (_form sym prop &optional def)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(if def
|
2012-06-03 21:05:17 -04:00
|
|
|
|
`(cl-getf (symbol-plist ,sym) ,prop ,def)
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(get ,sym ,prop)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
Fix compiler-expansion of CL's cXXr functions.
* emacs-lisp/cl-lib.el (cl--defalias): New function.
(cl-values, cl-values-list, cl-copy-seq, cl-svref, cl-first)
(cl-second, cl-rest, cl-endp, cl-third, cl-fourth): Use it.
(cl-plusp, cl-minusp, cl-fifth, cl-sixth, cl-seventh, cl-eighth)
(cl-ninth, cl-tenth): Mark them as inlinable.
(cl-caaar, cl-caadr, cl-cadar, cl-caddr, cl-cdaar, cl-cdadr)
(cl-cddar, cl-cdddr, cl-caaaar, cl-caaadr, cl-caadar, cl-caaddr)
(cl-cadaar, cl-cadadr, cl-caddar, cl-cadddr, cl-cdaaar, cl-cdaadr)
(cl-cdadar, cl-cdaddr, cl-cddaar, cl-cddadr, cl-cdddar, cl-cddddr):
Add a compiler-macro declaration to use cl--compiler-macro-cXXr.
(cl-list*, cl-adjoin): Don't put an autoload manually.
* emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin)
(cl--compiler-macro-list*): Add autoload cookie.
(cl--compiler-macro-cXXr): New function.
* help-fns.el (help-fns--compiler-macro): New function extracted from
describe-function-1; follow aliases and use `compiler-macro' property.
(describe-function-1): Use it.
Fixes: debbugs:11673
2012-06-11 16:35:00 -04:00
|
|
|
|
(dolist (y '(cl-first cl-second cl-third cl-fourth
|
|
|
|
|
cl-fifth cl-sixth cl-seventh
|
|
|
|
|
cl-eighth cl-ninth cl-tenth
|
|
|
|
|
cl-rest cl-endp cl-plusp cl-minusp
|
2015-04-10 01:50:22 -04:00
|
|
|
|
cl-caaar cl-caadr cl-cadar
|
|
|
|
|
cl-caddr cl-cdaar cl-cdadr
|
|
|
|
|
cl-cddar cl-cdddr cl-caaaar
|
|
|
|
|
cl-caaadr cl-caadar cl-caaddr
|
|
|
|
|
cl-cadaar cl-cadadr cl-caddar
|
|
|
|
|
cl-cadddr cl-cdaaar cl-cdaadr
|
|
|
|
|
cl-cdadar cl-cdaddr cl-cddaar
|
|
|
|
|
cl-cddadr cl-cdddar cl-cddddr))
|
Fix compiler-expansion of CL's cXXr functions.
* emacs-lisp/cl-lib.el (cl--defalias): New function.
(cl-values, cl-values-list, cl-copy-seq, cl-svref, cl-first)
(cl-second, cl-rest, cl-endp, cl-third, cl-fourth): Use it.
(cl-plusp, cl-minusp, cl-fifth, cl-sixth, cl-seventh, cl-eighth)
(cl-ninth, cl-tenth): Mark them as inlinable.
(cl-caaar, cl-caadr, cl-cadar, cl-caddr, cl-cdaar, cl-cdadr)
(cl-cddar, cl-cdddr, cl-caaaar, cl-caaadr, cl-caadar, cl-caaddr)
(cl-cadaar, cl-cadadr, cl-caddar, cl-cadddr, cl-cdaaar, cl-cdaadr)
(cl-cdadar, cl-cdaddr, cl-cddaar, cl-cddadr, cl-cdddar, cl-cddddr):
Add a compiler-macro declaration to use cl--compiler-macro-cXXr.
(cl-list*, cl-adjoin): Don't put an autoload manually.
* emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin)
(cl--compiler-macro-list*): Add autoload cookie.
(cl--compiler-macro-cXXr): New function.
* help-fns.el (help-fns--compiler-macro): New function extracted from
describe-function-1; follow aliases and use `compiler-macro' property.
(describe-function-1): Use it.
Fixes: debbugs:11673
2012-06-11 16:35:00 -04:00
|
|
|
|
(put y 'side-effect-free t))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;;; Things that are inline.
|
2013-02-19 21:07:07 -05:00
|
|
|
|
(cl-proclaim '(inline cl-acons cl-map cl-concatenate cl-notany
|
2014-04-21 23:18:15 -04:00
|
|
|
|
cl-notevery cl-revappend cl-nreconc gethash))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;;; Things that are side-effect-free.
|
2014-04-22 12:22:13 -04:00
|
|
|
|
(mapc (lambda (x) (function-put x 'side-effect-free t))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
'(cl-oddp cl-evenp cl-signum last butlast cl-ldiff cl-pairlis cl-gcd
|
|
|
|
|
cl-lcm cl-isqrt cl-floor cl-ceiling cl-truncate cl-round cl-mod cl-rem
|
|
|
|
|
cl-subseq cl-list-length cl-get cl-getf))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
;;; Things that are side-effect-and-error-free.
|
2014-04-22 12:22:13 -04:00
|
|
|
|
(mapc (lambda (x) (function-put x 'side-effect-free 'error-free))
|
2013-02-19 21:07:07 -05:00
|
|
|
|
'(eql cl-list* cl-subst cl-acons cl-equalp
|
2012-12-06 16:29:29 -05:00
|
|
|
|
cl-random-state-p copy-tree cl-sublis))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2014-04-20 07:46:13 -07:00
|
|
|
|
;;; Types and assertions.
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-deftype (name arglist &rest body)
|
|
|
|
|
"Define NAME as a new data type.
|
|
|
|
|
The type name can then be used in `cl-typecase', `cl-check-type', etc."
|
2014-05-04 12:37:56 -07:00
|
|
|
|
(declare (debug cl-defmacro) (doc-string 3) (indent 2))
|
2014-04-20 07:46:13 -07:00
|
|
|
|
`(cl-eval-when (compile load eval)
|
|
|
|
|
(put ',name 'cl-deftype-handler
|
2015-03-16 16:11:38 -04:00
|
|
|
|
(cl-function (lambda (&cl-defs ('*) ,@arglist) ,@body)))))
|
2014-04-20 07:46:13 -07:00
|
|
|
|
|
2018-11-05 01:22:15 +01:00
|
|
|
|
(cl-deftype extended-char () '(and character (not base-char)))
|
2015-02-14 00:46:29 -05:00
|
|
|
|
|
2014-04-20 07:46:13 -07:00
|
|
|
|
;;; Additional functions that we can now define because we've defined
|
2014-04-21 23:18:15 -04:00
|
|
|
|
;;; `cl-defsubst' and `cl-typep'.
|
2014-04-20 07:46:13 -07:00
|
|
|
|
|
2015-02-14 00:46:29 -05:00
|
|
|
|
(define-inline cl-struct-slot-value (struct-type slot-name inst)
|
2014-04-20 07:46:13 -07:00
|
|
|
|
"Return the value of slot SLOT-NAME in INST of STRUCT-TYPE.
|
|
|
|
|
STRUCT and SLOT-NAME are symbols. INST is a structure instance."
|
2014-04-22 12:22:13 -04:00
|
|
|
|
(declare (side-effect-free t))
|
2015-02-14 00:46:29 -05:00
|
|
|
|
(inline-letevals (struct-type slot-name inst)
|
|
|
|
|
(inline-quote
|
|
|
|
|
(progn
|
|
|
|
|
(unless (cl-typep ,inst ,struct-type)
|
|
|
|
|
(signal 'wrong-type-argument (list ,struct-type ,inst)))
|
|
|
|
|
;; We could use `elt', but since the byte compiler will resolve the
|
|
|
|
|
;; branch below at compile time, it's more efficient to use the
|
|
|
|
|
;; type-specific accessor.
|
2015-02-19 13:14:51 -05:00
|
|
|
|
(if (eq (cl-struct-sequence-type ,struct-type) 'list)
|
|
|
|
|
(nth (cl-struct-slot-offset ,struct-type ,slot-name) ,inst)
|
|
|
|
|
(aref ,inst (cl-struct-slot-offset ,struct-type ,slot-name)))))))
|
2014-04-20 07:46:13 -07:00
|
|
|
|
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(run-hooks 'cl-macs-load-hook)
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;; Local variables:
|
|
|
|
|
;; generated-autoload-file: "cl-loaddefs.el"
|
|
|
|
|
;; End:
|
2002-12-07 21:34:00 +00:00
|
|
|
|
|
2012-06-07 22:54:35 -04:00
|
|
|
|
(provide 'cl-macs)
|
|
|
|
|
|
1993-07-30 20:15:09 +00:00
|
|
|
|
;;; cl-macs.el ends here
|