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
|
|
|
|
|
2025-01-01 07:39:17 +00:00
|
|
|
|
;; Copyright (C) 1993, 2001-2025 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))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2015-04-10 01:50:22 -04:00
|
|
|
|
(define-obsolete-function-alias 'cl--compiler-macro-cXXr
|
2020-03-10 18:23:41 -04:00
|
|
|
|
#'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)
|
2023-10-31 23:37:10 +00:00
|
|
|
|
"Map `cl--simple-expr-p' to each element of list XS."
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(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)))))
|
|
|
|
|
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(defun cl--const-expr-p (x)
|
2023-10-31 23:37:10 +00:00
|
|
|
|
"Check if X is constant (i.e., no side effects or dependencies).
|
|
|
|
|
|
|
|
|
|
See `macroexp-const-p' for similar functionality without cl-lib dependency."
|
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\"."
|
Make cl-gensym obsolete in favor of built-in gensym
* lisp/emacs-lisp/cl-macs.el (cl-gensym): Declare function
obsolete in favor of gensym, added in Emacs 26.1. The only reason
for its existence is that it allows an integer argument, but
that's not really useful, so it's better to remove this complexity.
Ref: https://lists.gnu.org/r/emacs-devel/2017-09/msg00313.html
* doc/misc/cl.texi (Symbols, Creating Symbols, Efficiency Concerns)
(Obsolete Setf Customization): Don't document above obsolete function.
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause):
* lisp/emacs-lisp/edebug.el (edebug-make-form-wrapper):
* lisp/obsolete/cl.el (cl--function-convert, lexical-let):
* lisp/obsolete/thumbs.el (thumbs-temp-file):
* lisp/progmodes/eglot.el (eglot--lambda)
(eglot--when-live-buffer, eglot--when-buffer-window)
(eglot--collecting-xrefs, eglot--glob-parse):
* lisp/progmodes/flymake.el (flymake--run-backend):
* test/lisp/emacs-lisp/package-tests.el (with-package-test):
* test/lisp/progmodes/eglot-tests.el (eglot--guessing-contact):
* test/lisp/progmodes/elisp-mode-tests.el
(elisp-shorthand-read-buffer, elisp-shorthand-read-from-string): Prefer
plain gensym to cl-gensym in files that can depend on Emacs 26.1.
* lisp/jsonrpc.el (jsonrpc-lambda, jsonrpc-request): Prefer gensym to
cl-gensym only when defined, as this file supports Emacs 25.1
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-lib-test-gensym): Simplify
test as 'should' no longer uses cl-gensym.
2025-02-25 00:12:00 +01:00
|
|
|
|
(declare (obsolete gensym "31.1"))
|
2017-09-13 10:38:05 -04:00
|
|
|
|
(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.
|
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-spec 'cl-declarations
|
|
|
|
|
'(&rest ("cl-declare" &rest sexp)))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-spec 'cl-declarations-or-string
|
2021-02-14 21:13:35 -05:00
|
|
|
|
'(lambda-doc &or ("declare" def-declarations) cl-declarations))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-spec 'cl-lambda-list
|
|
|
|
|
'(([&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
|
2020-06-10 15:46:12 +02:00
|
|
|
|
&or (cl-lambda-arg &optional def-form) arg]]
|
2017-10-16 11:09:29 -07:00
|
|
|
|
. [&or arg nil])))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-spec 'cl-&optional-arg
|
|
|
|
|
'(&or (cl-lambda-arg &optional def-form arg) arg))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-spec 'cl-&key-arg
|
|
|
|
|
'(&or ([&or (symbolp cl-lambda-arg) arg] &optional def-form arg) arg))
|
2017-10-16 11:09:29 -07:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-spec 'cl-lambda-arg
|
|
|
|
|
'(&or arg cl-lambda-list1))
|
2017-10-16 11:09:29 -07:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-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 (cl-lambda-arg &optional def-form) arg]]
|
|
|
|
|
. [&or arg nil])))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-spec 'cl-type-spec '(sexp))
|
2013-09-25 14:39:53 -08: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
|
|
|
|
(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
|
|
|
|
|
2023-06-25 11:38:40 -04:00
|
|
|
|
(defun cl--slet (bindings body &optional nowarn)
|
2023-06-23 11:37:12 -04:00
|
|
|
|
"Like `cl--slet*' but for \"parallel let\"."
|
2023-06-25 11:38:40 -04:00
|
|
|
|
(let ((dyns nil)) ;Vars declared as dynbound among the bindings?
|
2023-06-28 09:24:30 -04:00
|
|
|
|
(when lexical-binding
|
|
|
|
|
(dolist (binding bindings) ;; `seq-some' lead to bootstrap problems.
|
|
|
|
|
(when (macroexp--dynamic-variable-p (car binding))
|
|
|
|
|
(push (car binding) dyns))))
|
2023-06-24 11:44:32 -04:00
|
|
|
|
(cond
|
2023-06-25 11:38:40 -04:00
|
|
|
|
(dyns
|
|
|
|
|
(let ((form `(funcall (lambda (,@(mapcar #'car bindings))
|
|
|
|
|
,@(macroexp-unprogn body))
|
|
|
|
|
,@(mapcar #'cadr bindings))))
|
|
|
|
|
(if (not nowarn) form
|
|
|
|
|
`(with-suppressed-warnings ((lexical ,@dyns)) ,form))))
|
2023-06-24 11:44:32 -04:00
|
|
|
|
((null (cdr bindings))
|
|
|
|
|
(macroexp-let* bindings body))
|
|
|
|
|
(t `(let ,bindings ,@(macroexp-unprogn body))))))
|
2023-06-23 11:37:12 -04:00
|
|
|
|
|
2023-06-23 10:45:49 -04:00
|
|
|
|
(defun cl--slet* (bindings body)
|
|
|
|
|
"Like `macroexp-let*' but uses static scoping for all the BINDINGS."
|
2023-06-23 11:37:12 -04:00
|
|
|
|
(if (null bindings) body
|
|
|
|
|
(cl--slet `(,(car bindings)) (cl--slet* (cdr bindings) body))))
|
2023-06-23 10:45:49 -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
|
|
|
|
(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.
|
2021-12-20 11:04:37 -05:00
|
|
|
|
(let ((slen (length simple-args))
|
|
|
|
|
(usage-str
|
2015-03-16 16:11:38 -04:00
|
|
|
|
;; Macro expansion can take place in the middle of
|
|
|
|
|
;; apparently harmless computation, so it should not
|
|
|
|
|
;; touch the match-data.
|
|
|
|
|
(save-match-data
|
2021-12-20 11:04:37 -05:00
|
|
|
|
(help--docstring-quote
|
|
|
|
|
(let ((print-gensym nil) (print-quoted t)
|
|
|
|
|
(print-escape-newlines t))
|
|
|
|
|
(format "%S" (cons 'fn (cl--make-usage-args
|
|
|
|
|
orig-args))))))))
|
|
|
|
|
(when (memq '&optional simple-args)
|
Prefer decf to cl-decf
* lisp/auth-source-pass.el (auth-source-pass--find-match-many):
* lisp/calendar/time-date.el (decoded-time-add)
(decoded-time--alter-month, decoded-time--alter-day):
* lisp/dired.el (dired--move-to-next-line):
* lisp/dom.el (dom-pp):
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda):
* lisp/emacs-lisp/cl-print.el (cl-print-to-string-with-limit):
* lisp/emacs-lisp/cl-seq.el (cl-fill, cl-replace, cl-substitute):
* lisp/emacs-lisp/comp-cstr.el (comp--range-union)
(comp--range-intersection):
* lisp/emacs-lisp/comp.el (comp-vec-prepend, comp--emit-narg-prologue):
* lisp/emacs-lisp/edebug.el (edebug--strip-instrumentation):
* lisp/emacs-lisp/eldoc.el (eldoc--invoke-strategy):
* lisp/emacs-lisp/pp.el (pp--format-definition):
* lisp/emacs-lisp/smie.el (smie-config--guess-1):
* lisp/eshell/esh-io.el (eshell-close-handle, eshell-set-output-handle):
* lisp/gnus/gnus-async.el (gnus-async-prefetch-article):
* lisp/gnus/gnus-group.el (gnus-group-mark-group)
(gnus-group-yank-group):
* lisp/gnus/gnus-salt.el (gnus-tree-forward-line):
* lisp/gnus/gnus-score.el (gnus-decay-scores):
* lisp/gnus/gnus-srvr.el (gnus-browse-toggle-subscription-at-point):
* lisp/gnus/gnus-sum.el (gnus-build-sparse-threads, gnus-parent-headers)
(gnus-update-marks, gnus-summary-work-articles)
(gnus-summary-refer-parent-article, gnus-summary-next-thread)
(gnus-read-header, gnus-summary-insert-new-articles):
* lisp/gnus/gnus-topic.el (gnus-topic-forward-topic):
* lisp/gnus/gnus.el (gnus-short-group-name):
* lisp/gnus/message.el (message-remove-first-header)
(message-shorten-references, message-insert-screenshot):
* lisp/gnus/mm-url.el (mm-url-insert):
* lisp/gnus/nnselect.el (nnselect-push-info):
* lisp/ibuffer.el (ibuffer-backward-line, ibuffer-forward-line)
(ibuffer-map-lines):
* lisp/icomplete.el (icomplete--render-vertical):
* lisp/image/image-dired-external.el (image-dired-create-thumb-1):
* lisp/image/image-dired.el (image-dired-delete-char):
* lisp/mail/ietf-drums-date.el (ietf-drums-date--tokenize-string):
* lisp/mh-e/mh-utils.el (mh-sub-folders-parse):
* lisp/minibuffer.el (minibuffer-completion-help):
* lisp/mpc.el (mpc-cmd-move, mpc-songpointer-refresh-hairy):
* lisp/net/eww.el (eww-process-text-input):
* lisp/net/pop3.el (pop3-wait-for-messages, pop3-uidl-stat)
(pop3-uidl-dele):
* lisp/net/shr-color.el (shr-color-hue-to-rgb):
* lisp/play/5x5.el (5x5-up, 5x5-left):
* lisp/play/decipher.el (decipher-read-alphabet, decipher--digram-total)
(decipher-analyze-buffer):
* lisp/play/hanoi.el (hanoi-insert-ring, hanoi-move-ring):
* lisp/profiler.el (profiler-format-number)
(profiler-calltree-build-unified):
* lisp/progmodes/antlr-mode.el (antlr-next-rule, antlr-indent-line):
* lisp/progmodes/c-ts-common.el (c-ts-common-statement-offset):
* lisp/progmodes/ebrowse.el
(ebrowse-cyclic-display-next/previous-member-list):
* lisp/progmodes/hideif.el (hif-backward-comment):
* lisp/progmodes/js.el (js-beginning-of-defun, js-end-of-defun)
(js-ts--syntax-propertize):
* lisp/progmodes/typescript-ts-mode.el
(tsx-ts--syntax-propertize-captures):
* lisp/rect.el (rectangle--*-char):
* lisp/term.el (term-emulate-terminal):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-index.el (reftex-index-next-phrase):
* lisp/textmodes/reftex-parse.el (reftex-init-section-numbers):
* lisp/textmodes/reftex-sel.el (reftex-select-unmark):
* lisp/textmodes/reftex.el (reftex-silence-toc-markers):
* lisp/treesit.el (treesit-navigate-thing):
* lisp/vc/diff-mode.el (diff-sanity-check-context-hunk-half,
(diff-sanity-check-hunk):
* lisp/vc/pcvs-util.el (cvs-first):
* lisp/vc/smerge-mode.el (smerge-get-current):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* test/lisp/net/socks-tests.el
(socks-tests-perform-hello-world-http-request):
* test/src/buffer-tests.el (test-overlay-randomly): Prefer decf to
cl-defc in all code where we can.
2025-02-22 19:06:11 +01:00
|
|
|
|
(decf slen))
|
2021-12-20 11:04:37 -05:00
|
|
|
|
(setq header
|
|
|
|
|
(cons
|
|
|
|
|
(if (eq :documentation (car-safe (car header)))
|
|
|
|
|
`(:documentation (help-add-fundoc-usage
|
|
|
|
|
,(cadr (pop header))
|
|
|
|
|
,usage-str))
|
|
|
|
|
(help-add-fundoc-usage
|
|
|
|
|
(if (stringp (car header)) (pop header))
|
|
|
|
|
;; Be careful with make-symbol and (back)quote,
|
|
|
|
|
;; see bug#12884.
|
|
|
|
|
usage-str))
|
|
|
|
|
header))
|
2015-03-16 16:11:38 -04:00
|
|
|
|
;; 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))))))))
|
2020-03-10 18:08:54 -04:00
|
|
|
|
`((,@(nreverse simple-args) ,@rest-args)
|
2015-03-16 16:11:38 -04:00
|
|
|
|
,@header
|
2023-06-23 11:37:12 -04:00
|
|
|
|
;; Function arguments are unconditionally statically scoped (bug#47552).
|
2023-06-23 10:45:49 -04:00
|
|
|
|
,(cl--slet* 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.
|
2023-08-21 09:16:17 +02:00
|
|
|
|
(&define [&name symbolp]
|
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))
|
2020-03-10 18:08:54 -04:00
|
|
|
|
`(defun ,name ,@(cl--transform-lambda (cons args body) name)))
|
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.
|
2021-02-13 16:21:53 -05:00
|
|
|
|
(&define [&name sexp] ;Allow (setf ...) additionally to symbols.
|
2015-03-02 16:41:59 -08:00
|
|
|
|
cl-lambda-list
|
|
|
|
|
cl-declarations-or-string
|
|
|
|
|
[&optional ("interactive" interactive)]
|
|
|
|
|
def-body))
|
|
|
|
|
(doc-string 3)
|
|
|
|
|
(indent 2))
|
|
|
|
|
(require 'generator)
|
2020-03-10 18:08:54 -04:00
|
|
|
|
`(iter-defun ,name ,@(cl--transform-lambda (cons args body) name)))
|
2015-03-02 16:41:59 -08:00
|
|
|
|
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; The lambda list for macros is different from that of normal lambdas.
|
2022-03-07 22:27:19 -05:00
|
|
|
|
|
|
|
|
|
;; `cl-macro-list' is shared between a few different use cases that
|
|
|
|
|
;; don't all support exactly the same set of special keywords: the
|
|
|
|
|
;; debug spec accepts hence a superset of what the macros
|
|
|
|
|
;; actually support.
|
|
|
|
|
;; For example &environment is only allowed as first or last items in the
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; top level list.
|
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-spec 'cl-macro-list
|
2022-03-07 22:27:19 -05:00
|
|
|
|
'(([&optional "&whole" arg] ; Only for compiler-macros or at lower levels.
|
|
|
|
|
[&optional "&environment" arg] ; Only at top-level.
|
2021-02-12 19:28:25 -05:00
|
|
|
|
[&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 (cl-macro-arg &optional def-form) arg]]
|
2022-03-07 22:27:19 -05:00
|
|
|
|
[&optional "&environment" arg] ; Only at top-level.
|
|
|
|
|
. [&or arg nil] ; Only allowed at lower levels.
|
2021-02-12 19:28:25 -05:00
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
(def-edebug-elem-spec 'cl-macro-arg
|
2022-03-07 22:27:19 -05:00
|
|
|
|
'(&or arg cl-macro-list))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
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))
|
2020-03-10 18:08:54 -04:00
|
|
|
|
`(defmacro ,name ,@(cl--transform-lambda (cons args body) name)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-spec 'cl-lambda-expr
|
|
|
|
|
'(&define ("lambda" cl-lambda-list
|
|
|
|
|
cl-declarations-or-string
|
|
|
|
|
[&optional ("interactive" interactive)]
|
|
|
|
|
def-body)))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2012-06-03 21:05:17 -04:00
|
|
|
|
;; Redefine function-form to also match cl-function
|
2021-02-12 19:28:25 -05:00
|
|
|
|
(def-edebug-elem-spec 'function-form
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; form at the end could also handle "function",
|
|
|
|
|
;; but recognize it specially to avoid wrapping function forms.
|
2021-02-12 19:28:25 -05:00
|
|
|
|
'(&or ([&or "quote" "function"] &or symbolp lambda-expr)
|
|
|
|
|
("cl-function" cl-function)
|
|
|
|
|
form))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
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)
|
2020-03-10 18:08:54 -04:00
|
|
|
|
`(function (lambda . ,(cl--transform-lambda (cdr func) 'cl-none)))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(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))
|
2022-08-03 01:40:32 +02:00
|
|
|
|
(if (and cl--bind-enquote (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))
|
2021-02-24 13:52:45 -05:00
|
|
|
|
(safety (if (macroexp-compiling-p) 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)))
|
2021-02-26 20:24:52 -05:00
|
|
|
|
(let ((poparg (list (if (or (cdr args) (not exactarg)) 'pop 'car-safe)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
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)))))
|
2022-08-03 01:40:32 +02:00
|
|
|
|
(varg (if (consp (car arg)) (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))
|
2022-10-23 10:14:10 +02:00
|
|
|
|
(unless (cdr ,var)
|
|
|
|
|
(error "Missing argument for %s" (car ,var)))
|
2017-11-27 12:45:16 -05:00
|
|
|
|
(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)
|
2022-03-07 22:27:19 -05:00
|
|
|
|
(debug (&define cl-macro-list def-form cl-declarations def-body)))
|
2019-07-25 21:56:17 +02:00
|
|
|
|
(let* ((cl--bind-lets nil)
|
|
|
|
|
(cl--bind-forms nil)
|
|
|
|
|
(cl--bind-defs nil)
|
|
|
|
|
(cl--bind-block args)
|
|
|
|
|
(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)))
|
2021-02-24 13:52:45 -05:00
|
|
|
|
(if (and (macroexp-compiling-p)
|
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))
|
2020-03-10 18:23:41 -04:00
|
|
|
|
(if comp (cons 'progn (mapcar #'cl--compile-time-too body))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
`(if nil nil ,@body))
|
2020-03-10 18:23:41 -04:00
|
|
|
|
(progn (if comp (eval (cons 'progn body) lexical-binding)) 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
|
2021-03-01 12:18:49 -05:00
|
|
|
|
form (cons '(cl-eval-when) macroexpand-all-environment))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(cond ((eq (car-safe form) 'progn)
|
2020-03-10 18:23:41 -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)))
|
2020-03-10 18:23:41 -04:00
|
|
|
|
(t (eval form lexical-binding) form)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
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)))
|
2021-02-24 13:52:45 -05:00
|
|
|
|
(if (macroexp-compiling-p)
|
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)
|
2020-03-10 18:23:41 -04:00
|
|
|
|
`',(eval form lexical-binding)))
|
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
|
2020-03-01 18:50:14 +01:00
|
|
|
|
is evaluated. If no clause succeeds, this macro returns nil. A
|
2018-03-08 18:48:39 -05:00
|
|
|
|
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
|
2022-09-13 17:11:53 +02:00
|
|
|
|
(let* ((head-list nil)
|
|
|
|
|
(has-otherwise nil))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
`(cond
|
|
|
|
|
,@(mapcar
|
|
|
|
|
(lambda (c)
|
2022-09-13 17:11:53 +02:00
|
|
|
|
(cons (cond (has-otherwise
|
|
|
|
|
(error "Misplaced t or `otherwise' clause"))
|
|
|
|
|
((memq (car c) '(t otherwise))
|
|
|
|
|
(setq has-otherwise t)
|
|
|
|
|
t)
|
2015-01-27 22:41:31 -05:00
|
|
|
|
((eq (car c) 'cl--ecase-error-flag)
|
|
|
|
|
`(error "cl-ecase failed: %s, %s"
|
|
|
|
|
,temp ',(reverse head-list)))
|
2022-09-13 17:12:57 +02:00
|
|
|
|
((null (car c))
|
|
|
|
|
(macroexp-warn-and-return
|
|
|
|
|
"Case nil will never match"
|
|
|
|
|
nil 'suspicious))
|
2022-09-19 13:34:51 +02:00
|
|
|
|
((and (consp (car c)) (cdar c) (not (cddar c))
|
2022-09-13 17:12:57 +02:00
|
|
|
|
(memq (caar c) '(quote function)))
|
|
|
|
|
(macroexp-warn-and-return
|
|
|
|
|
(format-message
|
|
|
|
|
(concat "Case %s will match `%s'. If "
|
|
|
|
|
"that's intended, write %s "
|
|
|
|
|
"instead. Otherwise, don't "
|
|
|
|
|
"quote `%s'.")
|
|
|
|
|
(car c) (caar c) (list (cadar c) (caar c))
|
|
|
|
|
(cadar c))
|
|
|
|
|
`(cl-member ,temp ',(car c)) 'suspicious))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
((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)
|
2020-03-01 18:50:14 +01:00
|
|
|
|
"Eval EXPR and choose 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,
|
2020-03-01 18:50:14 +01:00
|
|
|
|
this macro 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
|
2020-11-16 17:03:45 +01:00
|
|
|
|
(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))))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
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)
|
2025-01-16 17:48:21 -05:00
|
|
|
|
(let ((var (intern (format "--cl-block-%s--" name))))
|
|
|
|
|
`(cl--block-wrapper
|
|
|
|
|
;; Build a unique "tag" in the form of a fresh cons.
|
|
|
|
|
;; We include `var' in the cons, just in case it help debugging.
|
|
|
|
|
(let ((,var (cons ',var nil)))
|
|
|
|
|
(catch ,var
|
|
|
|
|
,@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))))
|
2025-01-16 17:48:21 -05: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)
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(defvar cl--loop-bindings) (defvar cl--loop-body) (defvar cl--loop-conditions)
|
2013-09-27 21:07:18 -04:00
|
|
|
|
(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)
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(defvar cl--loop-symbol-macs)
|
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:
|
2020-12-30 12:38:20 +01: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"
|
2021-05-22 13:17:00 +02:00
|
|
|
|
"count" "maximize" "minimize"
|
|
|
|
|
"if" "when" "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)
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(cl--loop-symbol-macs nil)
|
|
|
|
|
(cl--loop-conditions 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)))
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(while-body (nconc (cadr ands) (nreverse 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
|
|
|
|
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(defmacro cl--push-clause-loop-body (clause)
|
|
|
|
|
"Apply CLAUSE to both `cl--loop-conditions' and `cl--loop-body'."
|
2020-02-05 19:05:23 +01:00
|
|
|
|
(macroexp-let2 nil sym clause
|
|
|
|
|
`(progn
|
|
|
|
|
(push ,sym cl--loop-conditions)
|
|
|
|
|
(push ,sym cl--loop-body))))
|
2019-11-22 15:53:58 +01: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]
|
|
|
|
|
;; ))
|
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; (def-edebug-elem-spec 'loop-with
|
|
|
|
|
;; '("with" loop-var
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; loop-type-spec
|
|
|
|
|
;; [&optional ["=" form]]
|
|
|
|
|
;; &rest ["and" loop-var
|
|
|
|
|
;; loop-type-spec
|
|
|
|
|
;; [&optional ["=" form]]]))
|
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; (def-edebug-elem-spec 'loop-for-as
|
|
|
|
|
;; '([&or "for" "as"] loop-for-as-subclause
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; &rest ["and" loop-for-as-subclause]))
|
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; (def-edebug-elem-spec 'loop-for-as-subclause
|
|
|
|
|
;; '(loop-var
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; 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]]
|
|
|
|
|
;; ]))
|
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; (def-edebug-elem-spec 'loop-initial-final
|
|
|
|
|
;; '(&or ["initially"
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; ;; [&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]]))
|
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; (def-edebug-elem-spec 'loop-and-clause
|
|
|
|
|
;; '(loop-clause &rest ["and" loop-clause]))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; (def-edebug-elem-spec 'loop-clause
|
|
|
|
|
;; '(&or
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; [[&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
|
|
|
|
|
;; ))
|
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; (def-edebug-elem-spec 'loop-non-atomic-expr
|
|
|
|
|
;; '([¬ atom] form))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; (def-edebug-elem-spec 'loop-var
|
2012-05-17 17:39:36 -04:00
|
|
|
|
;; ;; 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)
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; '(&or (loop-var . [&or nil loop-var]) [gate symbolp]))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; (def-edebug-elem-spec 'loop-type-spec
|
|
|
|
|
;; '(&optional ["of-type" loop-d-type-spec]))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
2021-02-12 19:28:25 -05:00
|
|
|
|
;; (def-edebug-elem-spec 'loop-d-type-spec
|
|
|
|
|
;; '(&or (loop-d-type-spec . [&or nil loop-d-type-spec]) cl-type-spec))
|
2012-05-17 17:39:36 -04:00
|
|
|
|
|
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
|
Make cl-gensym obsolete in favor of built-in gensym
* lisp/emacs-lisp/cl-macs.el (cl-gensym): Declare function
obsolete in favor of gensym, added in Emacs 26.1. The only reason
for its existence is that it allows an integer argument, but
that's not really useful, so it's better to remove this complexity.
Ref: https://lists.gnu.org/r/emacs-devel/2017-09/msg00313.html
* doc/misc/cl.texi (Symbols, Creating Symbols, Efficiency Concerns)
(Obsolete Setf Customization): Don't document above obsolete function.
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause):
* lisp/emacs-lisp/edebug.el (edebug-make-form-wrapper):
* lisp/obsolete/cl.el (cl--function-convert, lexical-let):
* lisp/obsolete/thumbs.el (thumbs-temp-file):
* lisp/progmodes/eglot.el (eglot--lambda)
(eglot--when-live-buffer, eglot--when-buffer-window)
(eglot--collecting-xrefs, eglot--glob-parse):
* lisp/progmodes/flymake.el (flymake--run-backend):
* test/lisp/emacs-lisp/package-tests.el (with-package-test):
* test/lisp/progmodes/eglot-tests.el (eglot--guessing-contact):
* test/lisp/progmodes/elisp-mode-tests.el
(elisp-shorthand-read-buffer, elisp-shorthand-read-from-string): Prefer
plain gensym to cl-gensym in files that can depend on Emacs 26.1.
* lisp/jsonrpc.el (jsonrpc-lambda, jsonrpc-request): Prefer gensym to
cl-gensym only when defined, as this file supports Emacs 25.1
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-lib-test-gensym): Simplify
test as 'should' no longer uses cl-gensym.
2025-02-25 00:12:00 +01:00
|
|
|
|
;; Use `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.
|
Make cl-gensym obsolete in favor of built-in gensym
* lisp/emacs-lisp/cl-macs.el (cl-gensym): Declare function
obsolete in favor of gensym, added in Emacs 26.1. The only reason
for its existence is that it allows an integer argument, but
that's not really useful, so it's better to remove this complexity.
Ref: https://lists.gnu.org/r/emacs-devel/2017-09/msg00313.html
* doc/misc/cl.texi (Symbols, Creating Symbols, Efficiency Concerns)
(Obsolete Setf Customization): Don't document above obsolete function.
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause):
* lisp/emacs-lisp/edebug.el (edebug-make-form-wrapper):
* lisp/obsolete/cl.el (cl--function-convert, lexical-let):
* lisp/obsolete/thumbs.el (thumbs-temp-file):
* lisp/progmodes/eglot.el (eglot--lambda)
(eglot--when-live-buffer, eglot--when-buffer-window)
(eglot--collecting-xrefs, eglot--glob-parse):
* lisp/progmodes/flymake.el (flymake--run-backend):
* test/lisp/emacs-lisp/package-tests.el (with-package-test):
* test/lisp/progmodes/eglot-tests.el (eglot--guessing-contact):
* test/lisp/progmodes/elisp-mode-tests.el
(elisp-shorthand-read-buffer, elisp-shorthand-read-from-string): Prefer
plain gensym to cl-gensym in files that can depend on Emacs 26.1.
* lisp/jsonrpc.el (jsonrpc-lambda, jsonrpc-request): Prefer gensym to
cl-gensym only when defined, as this file supports Emacs 25.1
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-lib-test-gensym): Simplify
test as 'should' no longer uses cl-gensym.
2025-02-25 00:12:00 +01:00
|
|
|
|
(let ((var (or (pop cl--loop-args) (gensym "--cl-var--"))))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(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))
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(when end
|
|
|
|
|
(cl--push-clause-loop-body
|
|
|
|
|
(list
|
|
|
|
|
(if down (if excl '> '>=) (if excl '< '<=))
|
|
|
|
|
var (or end-var end))))
|
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)
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(cl--push-clause-loop-body `(consp ,temp))
|
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)
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(cl--pop2 cl--loop-args) start))
|
|
|
|
|
(first-assign (or cl--loop-first-flag
|
|
|
|
|
(setq cl--loop-first-flag
|
|
|
|
|
(make-symbol "--cl-var--")))))
|
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
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(push `(,var (if ,first-assign ,start ,var)) loop-for-sets)
|
|
|
|
|
(push `(,var (if ,(car (cl--loop-build-ands
|
|
|
|
|
(nreverse cl--loop-conditions)))
|
|
|
|
|
,then ,var))
|
|
|
|
|
loop-for-steps))
|
2020-01-04 13:14:32 +01:00
|
|
|
|
(push (if (eq start then)
|
|
|
|
|
`(,var ,then)
|
|
|
|
|
`(,var (if ,first-assign ,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--"))
|
|
|
|
|
(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)
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list temp-idx -1) loop-for-bindings)
|
2020-04-30 18:55:40 -04:00
|
|
|
|
(push `(setq ,temp-idx (1+ ,temp-idx)) cl--loop-body)
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(cl--push-clause-loop-body
|
2020-04-30 18:55:40 -04:00
|
|
|
|
`(< ,temp-idx (length ,temp-vec)))
|
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--"))
|
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)
|
2022-08-03 01:40:32 +02:00
|
|
|
|
(eq (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
|
2020-04-30 07:54:49 -04:00
|
|
|
|
(let ((temp-len (make-symbol "--cl-len--")))
|
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)
|
2020-04-30 07:54:49 -04:00
|
|
|
|
(cl--push-clause-loop-body `(< ,temp-idx ,temp-len)))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push (list var nil) loop-for-bindings)
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(cl--push-clause-loop-body `(and ,temp-seq
|
|
|
|
|
(or (consp ,temp-seq)
|
2020-04-30 07:54:49 -04:00
|
|
|
|
(< ,temp-idx (length ,temp-seq)))))
|
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)
|
2022-08-03 01:40:32 +02:00
|
|
|
|
(memq (caadr cl--loop-args) hash-types)
|
|
|
|
|
(not (eq (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))
|
2023-09-08 22:17:43 -04:00
|
|
|
|
(push (list var nil) loop-for-bindings)
|
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'"))
|
Clean up 'cl-' prefixes for local variables
The 'cl-' prefixes used for let-bound variables and argument names is a
holdover from the dynbind days. They are no longer necessary, and make
the code hard to read. This was partially cleaned up in the past; let's
finish the job now.
* lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist)
(cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany)
(cl-notevery, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays):
* lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst)
(cl--do-subst):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause):
* lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove)
(cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if)
(cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates)
(cl--delete-duplicates, cl-substitute, cl-substitute-if)
(cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if)
(cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not)
(cl-position, cl--position, cl-position-if, cl-position-if-not)
(cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search)
(cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if)
(cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not)
(cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion)
(cl-intersection, cl-nintersection, cl-set-difference)
(cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or)
(cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if)
(cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis)
(cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-'
prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
|
|
|
|
(let ((map (cl--pop2 cl--loop-args))
|
2012-12-06 16:29:29 -05:00
|
|
|
|
(other
|
|
|
|
|
(if (eq (car cl--loop-args) 'using)
|
|
|
|
|
(if (and (= (length (cadr cl--loop-args)) 2)
|
2022-08-03 01:40:32 +02:00
|
|
|
|
(memq (caadr cl--loop-args) key-types)
|
|
|
|
|
(not (eq (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)
|
Clean up 'cl-' prefixes for local variables
The 'cl-' prefixes used for let-bound variables and argument names is a
holdover from the dynbind days. They are no longer necessary, and make
the code hard to read. This was partially cleaned up in the past; let's
finish the job now.
* lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist)
(cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany)
(cl-notevery, cl--map-keymap-recursively, cl--map-intervals)
(cl--map-overlays):
* lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst)
(cl--do-subst):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause):
* lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove)
(cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if)
(cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates)
(cl--delete-duplicates, cl-substitute, cl-substitute-if)
(cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if)
(cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not)
(cl-position, cl--position, cl-position-if, cl-position-if-not)
(cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search)
(cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if)
(cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not)
(cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion)
(cl-intersection, cl-nintersection, cl-set-difference)
(cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or)
(cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if)
(cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis)
(cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-'
prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
|
|
|
|
(lambda (,var ,other) . ,body) ,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)
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(cl--push-clause-loop-body `(prog1 (not (eq ,var ,temp))
|
|
|
|
|
(or ,temp (setq ,temp ,var))))
|
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)
|
2019-11-22 15:53:58 +01:00
|
|
|
|
(cl--push-clause-loop-body `(prog1 (not (eq ,var ,temp))
|
|
|
|
|
(or ,temp (setq ,temp ,var))))
|
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)
|
2020-03-10 18:23:41 -04:00
|
|
|
|
(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
|
|
|
|
|
(push (cons (if ands 'cl-psetq 'setq)
|
2020-03-10 18:23:41 -04:00
|
|
|
|
(apply #'append (nreverse loop-for-steps)))
|
2018-01-08 19:11:20 +09:00
|
|
|
|
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)))
|
Prefer incf to cl-incf in emacs-lisp/*.el
* lisp/emacs-lisp/backtrace.el (backtrace--print-func-and-args):
* lisp/emacs-lisp/bindat.el (bindat--type):
* lisp/emacs-lisp/bytecomp.el (byte-recompile-directory):
* lisp/emacs-lisp/chart.el (chart-file-count):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer, cl--print-table):
* lisp/emacs-lisp/cl-generic.el (cl--defmethod-doc-pos):
* lisp/emacs-lisp/cl-indent.el (common-lisp-loop-part-indentation)
(common-lisp-indent-function-1, lisp-indent-defmethod):
* lisp/emacs-lisp/cl-lib.el (cl--set-substring):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause):
* lisp/emacs-lisp/cl-preloaded.el (cl-struct-define):
* lisp/emacs-lisp/cl-print.el (cl-print--cons-tail)
(cl-print--vector-contents, cl-print--struct-contents)
(cl-print--string-props):
* lisp/emacs-lisp/cl-seq.el (cl-substitute):
* lisp/emacs-lisp/comp-cstr.el (comp--range-union)
(comp--range-intersection):
* lisp/emacs-lisp/comp.el (comp-vec-append, comp--gen-counter)
(comp--op-case, comp--limplify-lap-inst, comp--limplify-block)
(comp--limplify-function, comp--maybe-add-vmvar, comp--fwprop*):
* lisp/emacs-lisp/edebug.el (edebug--called-interactively-skip):
* lisp/emacs-lisp/eldoc.el (eldoc--invoke-strategy):
* lisp/emacs-lisp/elp.el (elp--make-wrapper):
* lisp/emacs-lisp/ert-x.el (ert-kill-all-test-buffers):
* lisp/emacs-lisp/ert.el (ert--stats-set-test-and-result)
(ert-write-junit-test-summary-report):
* lisp/emacs-lisp/memory-report.el (memory-report--symbol-plist)
(memory-report--object-size-1):
* lisp/emacs-lisp/oclosure.el (oclosure--index-table)
(oclosure--define-functions):
* lisp/emacs-lisp/package.el (package-menu--perform-transaction):
* lisp/emacs-lisp/smie.el (smie-set-prec2tab, smie-prec2->grammar)
(smie-config--guess, smie-config--guess-1):
* lisp/emacs-lisp/syntax.el (syntax-propertize-rules)
(syntax-ppss--update-stats):
* lisp/emacs-lisp/track-changes.el (track-changes--after): Prefer incf
to cl-incf.
2025-02-23 00:13:21 +01:00
|
|
|
|
(push `(progn (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)))
|
Prefer incf to cl-incf in emacs-lisp/*.el
* lisp/emacs-lisp/backtrace.el (backtrace--print-func-and-args):
* lisp/emacs-lisp/bindat.el (bindat--type):
* lisp/emacs-lisp/bytecomp.el (byte-recompile-directory):
* lisp/emacs-lisp/chart.el (chart-file-count):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer, cl--print-table):
* lisp/emacs-lisp/cl-generic.el (cl--defmethod-doc-pos):
* lisp/emacs-lisp/cl-indent.el (common-lisp-loop-part-indentation)
(common-lisp-indent-function-1, lisp-indent-defmethod):
* lisp/emacs-lisp/cl-lib.el (cl--set-substring):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause):
* lisp/emacs-lisp/cl-preloaded.el (cl-struct-define):
* lisp/emacs-lisp/cl-print.el (cl-print--cons-tail)
(cl-print--vector-contents, cl-print--struct-contents)
(cl-print--string-props):
* lisp/emacs-lisp/cl-seq.el (cl-substitute):
* lisp/emacs-lisp/comp-cstr.el (comp--range-union)
(comp--range-intersection):
* lisp/emacs-lisp/comp.el (comp-vec-append, comp--gen-counter)
(comp--op-case, comp--limplify-lap-inst, comp--limplify-block)
(comp--limplify-function, comp--maybe-add-vmvar, comp--fwprop*):
* lisp/emacs-lisp/edebug.el (edebug--called-interactively-skip):
* lisp/emacs-lisp/eldoc.el (eldoc--invoke-strategy):
* lisp/emacs-lisp/elp.el (elp--make-wrapper):
* lisp/emacs-lisp/ert-x.el (ert-kill-all-test-buffers):
* lisp/emacs-lisp/ert.el (ert--stats-set-test-and-result)
(ert-write-junit-test-summary-report):
* lisp/emacs-lisp/memory-report.el (memory-report--symbol-plist)
(memory-report--object-size-1):
* lisp/emacs-lisp/oclosure.el (oclosure--index-table)
(oclosure--define-functions):
* lisp/emacs-lisp/package.el (package-menu--perform-transaction):
* lisp/emacs-lisp/smie.el (smie-set-prec2tab, smie-prec2->grammar)
(smie-config--guess, smie-config--guess-1):
* lisp/emacs-lisp/syntax.el (syntax-propertize-rules)
(syntax-ppss--update-stats):
* lisp/emacs-lisp/track-changes.el (track-changes--after): Prefer incf
to cl-incf.
2025-02-23 00:13:21 +01:00
|
|
|
|
(push `(progn (if ,what (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))
|
2022-08-03 01:40:32 +02:00
|
|
|
|
(while (and p (or (symbolp (car-safe (car p))) (null (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)
|
2020-03-10 18:23:41 -04:00
|
|
|
|
(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)
|
2022-08-03 01:40:32 +02:00
|
|
|
|
(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'.
|
|
|
|
|
|
2021-09-21 22:11:43 +02:00
|
|
|
|
Note that the entire loop is enclosed in an implicit nil block, so
|
2018-09-29 18:06:03 +09:00
|
|
|
|
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*'.
|
|
|
|
|
|
2021-09-21 22:11:43 +02:00
|
|
|
|
Note that the entire loop is enclosed in an implicit nil block, so
|
2018-09-29 18:06:03 +09:00
|
|
|
|
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)
|
2020-03-10 18:23:41 -04:00
|
|
|
|
(apply #'append sets))))))
|
2012-06-01 16:36:00 -04:00
|
|
|
|
,@(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)
|
2021-05-17 10:00:36 +02:00
|
|
|
|
(debug ((symbolp &optional form form) cl-declarations
|
|
|
|
|
def-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."
|
2021-05-17 10:00:36 +02:00
|
|
|
|
(declare (indent 2) (debug (form form def-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))
|
2021-03-20 10:01:13 +01:00
|
|
|
|
(eval (list 'let (nreverse ,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.
|
2023-08-11 23:14:05 -04:00
|
|
|
|
;; In Common Lisp, we'd use the `&whole' arg instead (see
|
|
|
|
|
;; "Macro Lambda Lists" in the CLHS).
|
|
|
|
|
((let ((symbols-with-pos-enabled nil)) ;Don't rewrite #'<X@5> => #'<X@3>
|
|
|
|
|
(eq f (car cl--labels-convert-cache)))
|
|
|
|
|
;; This value should be `eq' to the `&whole' form.
|
|
|
|
|
;; If this is not the case, we have a bug.
|
|
|
|
|
(prog1 (cdr cl--labels-convert-cache)
|
|
|
|
|
;; Drop it, so it can't accidentally interfere with some
|
|
|
|
|
;; unrelated subsequent use of `function' with the same symbol.
|
|
|
|
|
(setq cl--labels-convert-cache nil)))
|
2012-06-07 22:54:35 -04:00
|
|
|
|
(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)
|
2025-03-12 09:36:25 +08:00
|
|
|
|
;; FIXME: Here, we'd like to return the `&whole' form, but since Elisp
|
2023-08-11 23:14:05 -04:00
|
|
|
|
;; doesn't have that, we approximate it via `cl--labels-convert-cache'.
|
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.
|
2025-02-24 03:45:18 +01:00
|
|
|
|
Each definition can take the form (FUNC EXP) where 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
|
2025-04-02 15:05:02 -04:00
|
|
|
|
BODY...) which is a shorthand for (FUNC (lambda ARGLIST BODY))
|
|
|
|
|
where BODY is wrapped in a `cl-block' named FUNC.
|
2002-09-27 23:16:27 +00:00
|
|
|
|
|
2025-02-24 03:45:18 +01: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.
|
2018-06-12 18:41:46 -04:00
|
|
|
|
|
2002-09-27 23:16:27 +00:00
|
|
|
|
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
|
2019-10-16 13:07:05 +02:00
|
|
|
|
(declare (indent 1)
|
2023-09-04 17:13:45 -04:00
|
|
|
|
;; The first (symbolp form) case doesn't use `&name' because
|
|
|
|
|
;; it's hard to associate this name with the body of the function
|
|
|
|
|
;; that `form' will return (bug#65344).
|
|
|
|
|
;; We could try and use a `&name' for those cases where the
|
|
|
|
|
;; body of the function can be found, (e.g. the form wraps
|
|
|
|
|
;; some `prog1/progn/let' around the final `lambda'), but it's
|
|
|
|
|
;; not clear it's worth the trouble.
|
|
|
|
|
(debug ((&rest [&or (symbolp form)
|
|
|
|
|
(&define [&name symbolp "@cl-flet@"]
|
2023-08-23 13:03:43 +02:00
|
|
|
|
[&name [] gensym] ;Make it unique!
|
|
|
|
|
cl-lambda-list
|
|
|
|
|
cl-declarations-or-string
|
|
|
|
|
[&optional ("interactive" interactive)]
|
2023-09-04 17:13:45 -04:00
|
|
|
|
def-body)])
|
2019-10-16 13:07:05 +02:00
|
|
|
|
cl-declarations body)))
|
2012-06-07 22:54:35 -04:00
|
|
|
|
(let ((binds ()) (newenv macroexpand-all-environment))
|
|
|
|
|
(dolist (binding bindings)
|
2024-12-21 11:13:07 -05:00
|
|
|
|
(let* ((var (make-symbol (format "--cl-%s--" (car binding))))
|
|
|
|
|
(args-and-body (cdr binding))
|
|
|
|
|
(args (car args-and-body))
|
|
|
|
|
(body (cdr args-and-body)))
|
|
|
|
|
(if (and (null body)
|
|
|
|
|
(macroexp-copyable-p args))
|
2015-01-14 14:37:10 -05:00
|
|
|
|
;; Optimize (cl-flet ((fun var)) body).
|
2024-12-21 11:13:07 -05:00
|
|
|
|
(setq var args)
|
|
|
|
|
(push (list var (if (null body)
|
|
|
|
|
args
|
|
|
|
|
(let ((parsed-body (macroexp-parse-body body)))
|
|
|
|
|
`(cl-function
|
|
|
|
|
(lambda ,args
|
|
|
|
|
,@(car parsed-body)
|
|
|
|
|
(cl-block ,(car binding)
|
|
|
|
|
,@(cdr parsed-body)))))))
|
2015-01-14 14:37:10 -05:00
|
|
|
|
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)))))
|
|
|
|
|
|
2021-01-08 19:59:16 -05:00
|
|
|
|
(defun cl--self-tco (var fargs body)
|
|
|
|
|
;; This tries to "optimize" tail calls for the specific case
|
|
|
|
|
;; of recursive self-calls by replacing them with a `while' loop.
|
|
|
|
|
;; It is quite far from a general tail-call optimization, since it doesn't
|
|
|
|
|
;; even handle mutually recursive functions.
|
|
|
|
|
(letrec
|
|
|
|
|
((done nil) ;; Non-nil if some TCO happened.
|
2021-09-21 22:11:43 +02:00
|
|
|
|
;; This var always holds the value nil until (just before) we
|
2021-03-18 17:54:43 -04:00
|
|
|
|
;; exit the loop.
|
2021-01-08 19:59:16 -05:00
|
|
|
|
(retvar (make-symbol "retval"))
|
|
|
|
|
(ofargs (mapcar (lambda (s) (if (memq s cl--lambda-list-keywords) s
|
|
|
|
|
(make-symbol (symbol-name s))))
|
|
|
|
|
fargs))
|
|
|
|
|
(opt-exps (lambda (exps) ;; `exps' is in tail position!
|
|
|
|
|
(append (butlast exps)
|
|
|
|
|
(list (funcall opt (car (last exps)))))))
|
|
|
|
|
(opt
|
|
|
|
|
(lambda (exp) ;; `exp' is in tail position!
|
|
|
|
|
(pcase exp
|
|
|
|
|
;; FIXME: Optimize `apply'?
|
|
|
|
|
(`(funcall ,(pred (eq var)) . ,aargs)
|
|
|
|
|
;; This is a self-recursive call in tail position.
|
|
|
|
|
(let ((sets nil)
|
|
|
|
|
(fargs ofargs))
|
|
|
|
|
(while fargs
|
|
|
|
|
(pcase (pop fargs)
|
|
|
|
|
('&rest
|
|
|
|
|
(push (pop fargs) sets)
|
|
|
|
|
(push `(list . ,aargs) sets)
|
|
|
|
|
;; (cl-assert (null fargs))
|
|
|
|
|
)
|
|
|
|
|
('&optional nil)
|
|
|
|
|
(farg
|
|
|
|
|
(push farg sets)
|
|
|
|
|
(push (pop aargs) sets))))
|
|
|
|
|
(setq done t)
|
|
|
|
|
`(progn (setq . ,(nreverse sets))
|
|
|
|
|
:recurse)))
|
|
|
|
|
(`(progn . ,exps) `(progn . ,(funcall opt-exps exps)))
|
|
|
|
|
(`(if ,cond ,then . ,else)
|
|
|
|
|
`(if ,cond ,(funcall opt then) . ,(funcall opt-exps else)))
|
2021-03-18 13:33:09 +01:00
|
|
|
|
(`(and . ,exps) `(and . ,(funcall opt-exps exps)))
|
|
|
|
|
(`(or ,arg) (funcall opt arg))
|
|
|
|
|
(`(or ,arg . ,args)
|
|
|
|
|
(let ((val (make-symbol "val")))
|
|
|
|
|
`(let ((,val ,arg))
|
|
|
|
|
(if ,val ,(funcall opt val) ,(funcall opt `(or . ,args))))))
|
2021-01-08 19:59:16 -05:00
|
|
|
|
(`(cond . ,conds)
|
|
|
|
|
(let ((cs '()))
|
|
|
|
|
(while conds
|
|
|
|
|
(pcase (pop conds)
|
|
|
|
|
(`(,exp)
|
|
|
|
|
(push (if conds
|
|
|
|
|
;; This returns the value of `exp' but it's
|
|
|
|
|
;; only in tail position if it's the
|
|
|
|
|
;; last condition.
|
2021-03-18 17:54:43 -04:00
|
|
|
|
;; Note: This may set the var before we
|
|
|
|
|
;; actually exit the loop, but luckily it's
|
|
|
|
|
;; only the case if we set the var to nil,
|
|
|
|
|
;; so it does preserve the invariant that
|
|
|
|
|
;; the var is nil until we exit the loop.
|
2021-01-08 19:59:16 -05:00
|
|
|
|
`((setq ,retvar ,exp) nil)
|
|
|
|
|
`(,(funcall opt exp)))
|
|
|
|
|
cs))
|
|
|
|
|
(exps
|
|
|
|
|
(push (funcall opt-exps exps) cs))))
|
2021-03-18 17:54:43 -04:00
|
|
|
|
;; No need to set `retvar' to return nil.
|
|
|
|
|
`(cond . ,(nreverse cs))))
|
2021-01-08 19:59:16 -05:00
|
|
|
|
((and `(,(or 'let 'let*) ,bindings . ,exps)
|
|
|
|
|
(guard
|
|
|
|
|
;; Note: it's OK for this `let' to shadow any
|
|
|
|
|
;; of the formal arguments since we will only
|
|
|
|
|
;; setq the fresh new `ofargs' vars instead ;-)
|
2021-01-09 11:35:53 -05:00
|
|
|
|
(let ((shadowings
|
|
|
|
|
(mapcar (lambda (b) (if (consp b) (car b) b)) bindings)))
|
2021-12-20 11:59:22 +01:00
|
|
|
|
(and
|
|
|
|
|
;; If `var' is shadowed, then it clearly can't be
|
|
|
|
|
;; tail-called any more.
|
|
|
|
|
(not (memq var shadowings))
|
|
|
|
|
;; If any of the new bindings is a dynamic
|
|
|
|
|
;; variable, the body is not in tail position.
|
2021-12-20 17:29:17 +01:00
|
|
|
|
(not (delq nil (mapcar #'macroexp--dynamic-variable-p
|
|
|
|
|
shadowings)))))))
|
2021-01-08 19:59:16 -05:00
|
|
|
|
`(,(car exp) ,bindings . ,(funcall opt-exps exps)))
|
2021-04-08 22:48:02 +02:00
|
|
|
|
((and `(condition-case ,err-var ,bodyform . ,handlers)
|
|
|
|
|
(guard (not (eq err-var var))))
|
|
|
|
|
`(condition-case ,err-var
|
2021-04-07 11:31:07 +02:00
|
|
|
|
,(if (assq :success handlers)
|
|
|
|
|
bodyform
|
|
|
|
|
`(progn (setq ,retvar ,bodyform) nil))
|
2021-04-08 22:48:02 +02:00
|
|
|
|
. ,(mapcar (lambda (h)
|
|
|
|
|
(cons (car h) (funcall opt-exps (cdr h))))
|
|
|
|
|
handlers)))
|
2021-03-18 17:54:43 -04:00
|
|
|
|
('nil nil) ;No need to set `retvar' to return nil.
|
|
|
|
|
(_ `(progn (setq ,retvar ,exp) nil))))))
|
2021-01-08 19:59:16 -05:00
|
|
|
|
|
|
|
|
|
(let ((optimized-body (funcall opt-exps body)))
|
|
|
|
|
(if (not done)
|
|
|
|
|
(cons fargs body)
|
|
|
|
|
;; We use two sets of vars: `ofargs' and `fargs' because we need
|
|
|
|
|
;; to be careful that if a closure captures a formal argument
|
|
|
|
|
;; in one iteration, it needs to capture a different binding
|
|
|
|
|
;; then that of other iterations, e.g.
|
|
|
|
|
(cons
|
|
|
|
|
ofargs
|
|
|
|
|
`((let (,retvar)
|
|
|
|
|
(while (let ,(delq nil
|
|
|
|
|
(cl-mapcar
|
|
|
|
|
(lambda (a oa)
|
|
|
|
|
(unless (memq a cl--lambda-list-keywords)
|
|
|
|
|
(list a oa)))
|
|
|
|
|
fargs ofargs))
|
|
|
|
|
. ,optimized-body))
|
|
|
|
|
,retvar)))))))
|
|
|
|
|
|
2024-11-12 22:58:53 -05:00
|
|
|
|
(defun cl--self-tco-on-form (var form)
|
|
|
|
|
;; Apply self-tco to the function returned by FORM, assuming that
|
|
|
|
|
;; it will be bound to VAR.
|
|
|
|
|
(pcase form
|
|
|
|
|
(`(function (lambda ,fargs . ,ebody)) form
|
|
|
|
|
(pcase-let* ((`(,decls . ,body) (macroexp-parse-body ebody))
|
|
|
|
|
(`(,ofargs . ,obody) (cl--self-tco var fargs body)))
|
|
|
|
|
`(function (lambda ,ofargs ,@decls . ,obody))))
|
|
|
|
|
(`(let ,bindings ,form)
|
|
|
|
|
`(let ,bindings ,(cl--self-tco-on-form var form)))
|
|
|
|
|
(`(if ,cond ,exp1 ,exp2)
|
|
|
|
|
`(if ,cond ,(cl--self-tco-on-form var exp1)
|
|
|
|
|
,(cl--self-tco-on-form var exp2)))
|
|
|
|
|
(`(oclosure--fix-type ,exp1 ,exp2)
|
|
|
|
|
`(oclosure--fix-type ,exp1 ,(cl--self-tco-on-form var exp2)))
|
|
|
|
|
(_ form)))
|
|
|
|
|
|
2007-06-27 18:53:15 +00:00
|
|
|
|
;;;###autoload
|
2012-06-03 21:05:17 -04:00
|
|
|
|
(defmacro cl-labels (bindings &rest body)
|
2021-01-08 19:59:16 -05:00
|
|
|
|
"Make local (recursive) function definitions.
|
2025-02-24 03:45:18 +01:00
|
|
|
|
|
2025-03-30 00:44:50 -04:00
|
|
|
|
Each definition can take the form (FUNC EXP) where 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
|
2025-04-02 15:05:02 -04:00
|
|
|
|
BODY...) which is a shorthand for (FUNC (lambda ARGLIST BODY))
|
|
|
|
|
where BODY is wrapped in a `cl-block' named FUNC.
|
|
|
|
|
|
|
|
|
|
FUNC is in scope in any BODY or EXP, as well as in FORM, so you can write
|
|
|
|
|
recursive and mutually recursive function definitions, with the caveat
|
|
|
|
|
that EXPs are evaluated in sequence and you cannot call a FUNC before its
|
|
|
|
|
EXP has been evaluated.
|
|
|
|
|
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)))))
|
2024-12-21 11:13:07 -05:00
|
|
|
|
(push (cons var binding) 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)
|
|
|
|
|
(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)))
|
2021-01-08 19:59:16 -05:00
|
|
|
|
;; Don't override lexical-let's macro-expander.
|
|
|
|
|
(unless (assq 'function newenv)
|
|
|
|
|
(push (cons 'function #'cl--labels-convert) newenv))
|
|
|
|
|
;; Perform self-tail call elimination.
|
2024-11-12 22:58:53 -05:00
|
|
|
|
`(letrec ,(mapcar
|
|
|
|
|
(lambda (bind)
|
2024-12-21 11:13:07 -05:00
|
|
|
|
(pcase-let* ((`(,var ,fun ,sargs . ,sbody) bind))
|
2024-11-12 22:58:53 -05:00
|
|
|
|
`(,var ,(cl--self-tco-on-form
|
|
|
|
|
var (macroexpand-all
|
|
|
|
|
(if (null sbody)
|
|
|
|
|
sargs ;A (FUNC EXP) definition.
|
2024-12-21 11:13:07 -05:00
|
|
|
|
(let ((parsed-body
|
|
|
|
|
(macroexp-parse-body sbody)))
|
|
|
|
|
`(cl-function
|
|
|
|
|
(lambda ,sargs
|
|
|
|
|
,@(car parsed-body)
|
|
|
|
|
(cl-block ,fun
|
|
|
|
|
,@(cdr parsed-body))))))
|
2024-11-12 22:58:53 -05:00
|
|
|
|
newenv)))))
|
|
|
|
|
(nreverse binds))
|
2021-01-08 19:59:16 -05:00
|
|
|
|
. ,(macroexp-unprogn
|
|
|
|
|
(macroexpand-all
|
|
|
|
|
(macroexp-progn body)
|
|
|
|
|
newenv)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2021-02-14 21:13:35 -05:00
|
|
|
|
(defvar edebug-lexical-macro-ctx)
|
|
|
|
|
|
|
|
|
|
(defun cl--edebug-macrolet-interposer (bindings pf &rest specs)
|
|
|
|
|
;; (cl-assert (null (cdr bindings)))
|
|
|
|
|
(setq bindings (car bindings))
|
|
|
|
|
(let ((edebug-lexical-macro-ctx
|
|
|
|
|
(nconc (mapcar (lambda (binding)
|
|
|
|
|
(cons (car binding)
|
|
|
|
|
(when (eq 'declare (car-safe (nth 2 binding)))
|
|
|
|
|
(nth 1 (assq 'debug (cdr (nth 2 binding)))))))
|
|
|
|
|
bindings)
|
|
|
|
|
edebug-lexical-macro-ctx)))
|
|
|
|
|
(funcall pf specs)))
|
|
|
|
|
|
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)
|
2021-02-14 21:13:35 -05:00
|
|
|
|
(debug (&interpose (&rest (&define [&name symbolp "@cl-macrolet@"]
|
|
|
|
|
[&name [] gensym] ;Make it unique!
|
|
|
|
|
cl-macro-list
|
|
|
|
|
cl-declarations-or-string
|
|
|
|
|
def-body))
|
|
|
|
|
cl--edebug-macrolet-interposer
|
|
|
|
|
cl-declarations body)))
|
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)))
|
|
|
|
|
(macroexpand-all (macroexp-progn body)
|
2015-01-14 14:37:10 -05:00
|
|
|
|
(cons (cons name
|
2020-03-10 18:08:54 -04:00
|
|
|
|
(eval `(function (lambda ,@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
|
|
|
|
|
2022-09-06 00:08:35 -04:00
|
|
|
|
(defun cl--sm-macroexpand (exp &optional env)
|
|
|
|
|
"Special macro expander used inside `cl-symbol-macrolet'."
|
|
|
|
|
;; FIXME: Arguably, this should be the official definition of `macroexpand'.
|
|
|
|
|
(while (not (eq exp (setq exp (macroexpand-1 exp env)))))
|
|
|
|
|
exp)
|
|
|
|
|
|
|
|
|
|
(defun cl--sm-macroexpand-1 (orig-fun exp &optional env)
|
2018-02-08 21:40:46 -05:00
|
|
|
|
"Special macro expander advice used inside `cl-symbol-macrolet'.
|
2022-09-06 00:08:35 -04:00
|
|
|
|
This function extends `macroexpand-1' during macro expansion
|
2018-02-08 21:40:46 -05:00
|
|
|
|
of `cl-symbol-macrolet' to additionally expand symbol macros."
|
2022-09-06 00:08:35 -04:00
|
|
|
|
(let ((exp (funcall orig-fun exp env))
|
2017-04-21 23:37:05 -04:00
|
|
|
|
(venv (alist-get :cl-symbol-macros env)))
|
2022-09-06 00:08:35 -04:00
|
|
|
|
(pcase exp
|
|
|
|
|
((pred symbolp)
|
|
|
|
|
;; Try symbol-macro expansion.
|
|
|
|
|
(let ((symval (assq exp venv)))
|
|
|
|
|
(if symval (cadr symval) exp)))
|
|
|
|
|
(`(setq . ,args)
|
|
|
|
|
;; Convert setq to setf if required by symbol-macro expansion.
|
|
|
|
|
(let ((convert nil))
|
|
|
|
|
(while args
|
|
|
|
|
(let* ((place (pop args))
|
|
|
|
|
;; Here, we know `place' should be a symbol.
|
|
|
|
|
(symval (assq place venv)))
|
|
|
|
|
(pop args)
|
|
|
|
|
(when symval
|
|
|
|
|
(setq convert t))))
|
|
|
|
|
(if convert
|
|
|
|
|
(cons 'setf (cdr exp))
|
|
|
|
|
exp)))
|
|
|
|
|
;; 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.
|
|
|
|
|
;;
|
|
|
|
|
;; (`(,(or `let `let*) . ,(or `(,bindings . ,body) pcase--dontcare))
|
|
|
|
|
;; (let ((letf nil) (found nil) (nbs ()))
|
|
|
|
|
;; (dolist (binding bindings)
|
|
|
|
|
;; (let* ((var (if (symbolp binding) binding (car binding)))
|
|
|
|
|
;; (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))))
|
|
|
|
|
;; nbs)))
|
|
|
|
|
;; (when found
|
|
|
|
|
;; (setq exp `(,(if letf
|
|
|
|
|
;; (if (eq (car exp) 'let) 'cl-letf 'cl-letf*)
|
|
|
|
|
;; (car exp))
|
|
|
|
|
;; ,(nreverse nbs)
|
|
|
|
|
;; ,@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.
|
|
|
|
|
(`(,(or 'let 'let*) . ,(or `(,bindings . ,body) pcase--dontcare))
|
|
|
|
|
(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)
|
|
|
|
|
;; 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
|
|
|
|
|
;; 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)))
|
|
|
|
|
(if found
|
|
|
|
|
`(,(car exp)
|
|
|
|
|
,(nreverse nbs)
|
|
|
|
|
,@(macroexp-unprogn
|
|
|
|
|
(macroexpand-all (macroexp-progn body)
|
|
|
|
|
env)))
|
|
|
|
|
exp)))
|
|
|
|
|
;; 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))
|
|
|
|
|
(if found
|
|
|
|
|
`(function
|
|
|
|
|
(lambda ,(nreverse nargs)
|
|
|
|
|
. ,(mapcar (lambda (exp)
|
|
|
|
|
(macroexpand-all exp env))
|
|
|
|
|
body)))
|
|
|
|
|
exp)))
|
|
|
|
|
((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)
|
|
|
|
|
`(condition-case ,nvar ,(macroexpand-all exp env)
|
|
|
|
|
. ,(mapcar
|
|
|
|
|
(lambda (clause)
|
|
|
|
|
`(,(car clause)
|
|
|
|
|
. ,(mapcar (lambda (exp)
|
|
|
|
|
(macroexpand-all exp env))
|
|
|
|
|
(cdr clause))))
|
|
|
|
|
clauses))))
|
|
|
|
|
(_ 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
|
2022-09-06 00:08:35 -04:00
|
|
|
|
(advice-add 'macroexpand :override #'cl--sm-macroexpand)
|
|
|
|
|
(advice-add 'macroexpand-1 :around #'cl--sm-macroexpand-1))
|
2018-02-08 21:40:46 -05:00
|
|
|
|
(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
|
First commit of scratch/correct-warning-pos.
This branch is intended to generate correct position information in warning
and error messages from the byte compiler, and is intended thereby to fix bugs
It introduces a new mechanism, the symbol with position. This is taken over
from the previous git branch scratch/accurate-warning-pos which was abandoned
for being too slow. The main difference in the current branch is that the
symbol `nil' is never given a position, thus speeding up NILP markedly.
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-optimize-form-code-walker, byte-optimize-let-form, byte-optimize-while)
(byte-optimize-apply): Use byte-compile-warn-x in place of byte-compile-warn.
* lisp/emacs-lisp/bytecomp.el (byte-compile--form-stack): New variable.
(byte-compile-strip-s-p-1, byte-compile-strip-symbol-positions): New
functions.
(byte-compile-recurse-toplevel, byte-compile-initial-macro-environment)
(byte-compile-preprocess, byte-compile-macroexpand-declare-function): Bind
print-symbols-bare to non-nil.
(byte-compile--first-symbol, byte-compile--warning-source-offset): New
functions.
(byte-compile-warning-prefix): Modify to output two sets of position
information, the old (incorrect) set and the new set.
(byte-compile-warn): Strip positions from symbols before outputting.
(byte-compile-warn-x): New function which outputs a correct position supplied
in an argument.
(byte-compile-warn-obsolete, byte-compile-emit-callargs-warn)
(byte-compile-format-warn, byte-compile-nogroup-warn)
(byte-compile-arglist-warn, byte-compile-docstring-length-warn)
(byte-compile-warn-about-unresolved-functions, byte-compile-file)
(byte-compile--check-prefixed-var, byte-compile--declare-var)
(byte-compile-file-form-defvar-function, byte-compile-file-form-defmumble)
(byte-compile-check-lambda-list, byte-compile--warn-lexical-dynamic)
(byte-compile-lambda, byte-compile-form, byte-compile-normal-call)
(byte-compile-check-variable, byte-compile-free-vars-warn)
(byte-compile-subr-wrong-args, byte-compile-fset, byte-compile-set-default)
(byte-compile-condition-case, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-make-variable-buffer-local, byte-compile-define-symbol-prop)
(byte-compile-define-keymap): Replace byte-compile-warn with
byte-compile-warn-x.
(byte-compile-file, compile-defun): Bind symbols-with-pos-enabled to non-nil.
(compile-defun, byte-compile-from-buffer): Use `read-positioning-symbols'
rather than plain `read'.
(byte-compile-toplevel-file-form, byte-compile-form): Dynamically bind
byte-compile--form-stack.
(byte-compile-file-form-autoload, byte-compile-file-form-defvar)
(byte-compile-file-form-make-obsolete, byte-compile-lambda)
(byte-compile-push-constant, byte-compile-cond-jump-table)
(byte-compile-define-keymap, byte-compile-annotate-call-tree):
Strip positions from symbols where they are unwanted.
(byte-compile-file-form-defvar): Strip positions from symbols using
`bare-symbol'.
(byte-compile-file-form-defmumble): New variable bare-name, a version of name
without its position.
(byte-compile-lambda): Similarly, new variable bare-arglist.
(byte-compile-free-vars-warn): New argument arg supplying position information
to byte-compile-warn-x.
(byte-compile-push-constant): Manipulation of symbol positions.
(display-call-tree): Strip positions from symbols.
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv--analyze-function, cconv-analyze-form): Replace use of
byte-compile-warn with byte-compile-warn-x.
* lisp/emacs-lisp/cl-generic.el (cl-defmethod): New variable org-name which
will supply position information to a new macroexp-warn-and-return.
* lisp/emacs-lisp/cl-macs.el (cl-macs--strip-s-p-1)
(cl-macs--strip-symbol-positions): New functions to strip positions from
symbols in an expression. These duplicaate similarly named functions in
bytecomp.el.
* lisp/emacs-lisp/macroexpand.el (macroexp--warn-wrap): Calls
byte-compile-warn-x in place of byte-compile-warn.
(macroexp-warn-and-return): Commented out new position parameter _arg.
* src/.gdbinit: Add in code to handle symbols with position.
* src/alloc.c (XPNTR, set_symbol_name, valid_lisp_object_p, purecopy)
(mark_char_table, mark_object, survives_gc_p, symbol_uses_obj): Use
BARE_SYMBOL_P and XBARE_SYMBOL in place of the former SYMBOLP and XSYMBOL.
(build_symbol_with_pos): New function.
(Fgarbage_collect): Bind Qsymbols_with_pos_enabled to nil around the call to
garbage_collect.
* src/data.c (Ftype_of): Add case for PVEC_SYMBOL_WITH_POS.
(Fbare_symbol_p, Fsymbol_with_pos_p, Fbare_symbol, Fsymbol_with_pos_pos)
(Fposition_symbol): New functions.
(symbols_with_pos_enabled): New boolean variable.
* src/fns.c (internal_equal, hash_lookup): Handle symbols with position.
* src/keyboard.c (recursive_edit_1): Bind Qsymbols_with_pos_enabled and
Qprint_symbols_bare to nil.
* src/lisp.h (lisp_h_PSEUDOVECTORP): New macro.
(lisp_h_BASE_EQ): New name for the former lisp_h_EQ.
(lisp_h_EQ): Extended to handle symbols with position.
(lisp_h_NILP): Now uses BASE_EQ rather than EQ.
(lisp_h_SYMBOL_WITH_POS_P, lisp_h_BARE_SYMBOL_P): New macros.
(lisp_h_SYMBOLP): Redefined to handle symbols with position.
(BARE_SYMBOL_P, BASE_EQ): New macros.
(SYMBOLP (macro)): Removed.
(SYMBOLP (function), XSYMBOL, make_lisp_symbol, builtin_lisp_symbol)
(c_symbol_p): Moved to later in file.
(struct Lisp_Symbol_With_Pos): New data type.
(pvec_type): PVEC_SYMBOL_WITH_POS: New type code.
(PSEUDOVECTORP): Redefined to use the lisp_h_PSEUDOVECTORP.
(BARE_SYMBOL_P, SYMBOL_WITH_POS_P, SYMBOLP, XSYMBOL_WITH_POS, XBARE_SYMBOL)
(XSYMBOL, make_lisp_symbol, builtin_lisp_symbol, c_symbol_p, CHECK_SYMBOL)
(BASE_EQ): New functions, or functions moved from earlier in the file.
(SYMBOL_WITH_POS_SYM, SYMBOL_WITH_POS_POS): New INLINE functions.
* src/lread.c (read0, read1, read_list, read_vector, read_internal_start)
(list2): Add a new bool parameter locate_syms.
(Fread_positioning_symbols): New function.
(Fread_from_string, read_internal_start, read0, read1, read_list): Pass around
suitable values for locate_syms.
(read1): Build symbols with position when locate_syms is true.
* src/print.c (print_vectorlike): Add handling for PVEC_SYMBOL_WITH_POS.
(print_object): Replace EQ with BASE_EQ.
(print_symbols_bare): New boolean variable.
2021-11-29 11:19:31 +00:00
|
|
|
|
(let ((rev-malformed-bindings (nreverse malformed-bindings)))
|
|
|
|
|
(macroexp-warn-and-return
|
|
|
|
|
(format-message "Malformed `cl-symbol-macrolet' binding(s): %S"
|
|
|
|
|
rev-malformed-bindings)
|
2022-02-19 14:20:02 -05:00
|
|
|
|
expansion nil nil rev-malformed-bindings))
|
2017-04-21 23:37:05 -04:00
|
|
|
|
expansion)))
|
2018-02-08 21:40:46 -05:00
|
|
|
|
(unless advised
|
2022-09-06 00:08:35 -04:00
|
|
|
|
(advice-remove 'macroexpand #'cl--sm-macroexpand)
|
|
|
|
|
(advice-remove 'macroexpand-1 #'cl--sm-macroexpand-1)))))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
2022-04-11 09:20:35 -07:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-with-gensyms (names &rest body)
|
|
|
|
|
"Bind each of NAMES to an uninterned symbol and evaluate BODY."
|
|
|
|
|
(declare (debug (sexp body)) (indent 1))
|
|
|
|
|
`(let ,(cl-loop for name in names collect
|
|
|
|
|
`(,name (gensym (symbol-name ',name))))
|
|
|
|
|
,@body))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-once-only (names &rest body)
|
|
|
|
|
"Generate code to evaluate each of NAMES just once in BODY.
|
|
|
|
|
|
2024-10-06 13:38:57 +08:00
|
|
|
|
This macro helps with writing other macros. Each of NAMES is
|
2022-04-11 09:20:35 -07:00
|
|
|
|
either (NAME FORM) or NAME, which latter means (NAME NAME).
|
|
|
|
|
During macroexpansion, each NAME is bound to an uninterned
|
|
|
|
|
symbol. The expansion evaluates each FORM and binds it to the
|
|
|
|
|
corresponding uninterned symbol.
|
|
|
|
|
|
|
|
|
|
For example, consider this macro:
|
|
|
|
|
|
|
|
|
|
(defmacro my-cons (x)
|
|
|
|
|
(cl-once-only (x)
|
|
|
|
|
\\=`(cons ,x ,x)))
|
|
|
|
|
|
|
|
|
|
The call (my-cons (pop y)) will expand to something like this:
|
|
|
|
|
|
|
|
|
|
(let ((g1 (pop y)))
|
|
|
|
|
(cons g1 g1))
|
|
|
|
|
|
|
|
|
|
The use of `cl-once-only' ensures that the pop is performed only
|
|
|
|
|
once, as intended.
|
|
|
|
|
|
|
|
|
|
See also `macroexp-let2'."
|
|
|
|
|
(declare (debug (sexp body)) (indent 1))
|
|
|
|
|
(setq names (mapcar #'ensure-list names))
|
|
|
|
|
(let ((our-gensyms (cl-loop for _ in names collect (gensym))))
|
|
|
|
|
;; During macroexpansion, obtain a gensym for each NAME.
|
|
|
|
|
`(let ,(cl-loop for sym in our-gensyms collect `(,sym (gensym)))
|
|
|
|
|
;; Evaluate each FORM and bind to the corresponding gensym.
|
|
|
|
|
;;
|
|
|
|
|
;; We require this explicit call to `list' rather than using
|
|
|
|
|
;; (,,@(cl-loop ...)) due to a limitation of Elisp's backquote.
|
|
|
|
|
`(let ,(list
|
2022-04-12 17:59:22 +02:00
|
|
|
|
,@(cl-loop for name in names for gensym in our-gensyms
|
2022-04-11 09:20:35 -07:00
|
|
|
|
for to-eval = (or (cadr name) (car name))
|
|
|
|
|
collect ``(,,gensym ,,to-eval)))
|
|
|
|
|
;; During macroexpansion, bind each NAME to its gensym.
|
2022-04-12 17:59:22 +02:00
|
|
|
|
,(let ,(cl-loop for name in names for gensym in our-gensyms
|
2022-04-11 09:20:35 -07:00
|
|
|
|
collect `(,(car name) ,gensym))
|
|
|
|
|
,@body)))))
|
|
|
|
|
|
2025-03-12 23:01:49 -04:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-with-accessors (bindings instance &rest body)
|
|
|
|
|
"Use BINDINGS as function calls on INSTANCE inside BODY.
|
|
|
|
|
|
|
|
|
|
This macro helps when writing code that makes repeated use of the
|
|
|
|
|
accessor functions of a structure or object instance, such as those
|
|
|
|
|
created by `cl-defstruct' and `defclass'.
|
|
|
|
|
|
|
|
|
|
BINDINGS is a list of (NAME ACCESSOR) pairs. Inside BODY, NAME is
|
|
|
|
|
treated as the function call (ACCESSOR INSTANCE) using
|
|
|
|
|
`cl-symbol-macrolet'. NAME can be used with `setf' and `setq' as a
|
|
|
|
|
generalized variable. Because of how the accessor is used,
|
|
|
|
|
`cl-with-accessors' can be used with any generalized variable that can
|
|
|
|
|
take a single argument, such as `car' and `cdr'.
|
|
|
|
|
|
|
|
|
|
See also the macro `with-slots' described in the Info
|
|
|
|
|
node `(eieio)Accessing Slots', which is similar, but uses slot names
|
|
|
|
|
instead of accessor functions.
|
|
|
|
|
|
|
|
|
|
\(fn ((NAME ACCESSOR) ...) INSTANCE &rest BODY)"
|
|
|
|
|
(declare (debug [(&rest (symbolp symbolp)) form body])
|
|
|
|
|
(indent 2))
|
|
|
|
|
(cond ((null body)
|
|
|
|
|
(macroexp-warn-and-return "`cl-with-accessors' used with empty body"
|
|
|
|
|
nil 'empty-body))
|
|
|
|
|
((null bindings)
|
|
|
|
|
(macroexp-warn-and-return "`cl-with-accessors' used without accessors"
|
|
|
|
|
(macroexp-progn body)
|
|
|
|
|
'suspicious))
|
|
|
|
|
(t
|
|
|
|
|
(cl-once-only (instance)
|
|
|
|
|
(let ((symbol-macros))
|
|
|
|
|
(dolist (b bindings)
|
|
|
|
|
(pcase b
|
|
|
|
|
(`(,(and (pred symbolp) var)
|
|
|
|
|
,(and (pred symbolp) accessor))
|
|
|
|
|
(push `(,var (,accessor ,instance))
|
|
|
|
|
symbol-macros))
|
|
|
|
|
(_
|
|
|
|
|
(error "Malformed `cl-with-accessors' binding: %S" b))))
|
|
|
|
|
`(cl-symbol-macrolet
|
|
|
|
|
,symbol-macros
|
|
|
|
|
,@body))))))
|
|
|
|
|
|
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
|
2025-02-18 22:29:40 +01:00
|
|
|
|
(define-obsolete-function-alias 'cl-locally #'progn "31.1")
|
|
|
|
|
|
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)))
|
2020-09-01 21:28:22 +02:00
|
|
|
|
;; When native compiling possibly add the appropriate type hint.
|
|
|
|
|
(when (and (boundp 'byte-native-compiling)
|
|
|
|
|
byte-native-compiling)
|
|
|
|
|
(setf form
|
|
|
|
|
(cl-case type
|
|
|
|
|
(fixnum `(comp-hint-fixnum ,form))
|
|
|
|
|
(cons `(comp-hint-cons ,form))
|
|
|
|
|
(otherwise form))))
|
2021-02-24 13:52:45 -05:00
|
|
|
|
(if (not (or (not (macroexp-compiling-p))
|
2014-04-19 19:34:22 -07:00
|
|
|
|
(< 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
|
|
|
|
|
2020-09-14 21:06:54 +02:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(or (assq 'cl-optimize defun-declarations-alist)
|
|
|
|
|
(let ((x (list 'cl-optimize #'cl--optimize)))
|
|
|
|
|
(push x macro-declarations-alist)
|
|
|
|
|
(push x defun-declarations-alist)))
|
|
|
|
|
|
2022-07-31 11:33:47 +02:00
|
|
|
|
;;;###cl-autoload
|
2020-09-14 21:06:54 +02:00
|
|
|
|
(defun cl--optimize (f _args &rest qualities)
|
2022-04-22 16:17:22 +02:00
|
|
|
|
"Serve `cl-optimize' in function declarations.
|
2020-09-14 21:06:54 +02:00
|
|
|
|
Example:
|
2022-08-04 11:02:49 +02:00
|
|
|
|
(defun foo (x)
|
|
|
|
|
(declare (cl-optimize (speed 3) (safety 0)))
|
|
|
|
|
x)"
|
2020-09-26 14:28:36 +02:00
|
|
|
|
;; FIXME this should make use of `cl--declare-stack' but I suspect
|
|
|
|
|
;; this mechanism should be reviewed first.
|
2020-09-14 21:06:54 +02:00
|
|
|
|
(cl-loop for (qly val) in qualities
|
|
|
|
|
do (cl-ecase qly
|
|
|
|
|
(speed
|
|
|
|
|
(setf cl--optimize-speed val)
|
|
|
|
|
(byte-run--set-speed f nil val))
|
|
|
|
|
(safety
|
|
|
|
|
(setf cl--optimize-safety val)))))
|
|
|
|
|
|
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)))
|
2021-03-01 12:18:49 -05:00
|
|
|
|
(put (car spec) 'byte-optimizer #'byte-compile-inline-expand)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
|
|
|
|
|
((eq (car-safe spec) 'notinline)
|
|
|
|
|
(while (setq spec (cdr spec))
|
|
|
|
|
(if (eq (get (car spec) 'byte-optimizer)
|
2021-03-01 12:18:49 -05:00
|
|
|
|
#'byte-compile-inline-expand)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(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)))
|
2025-02-17 15:21:16 +00:00
|
|
|
|
'((0 t) (1 nil) (2 nil) (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))
|
2022-08-03 01:40:32 +02:00
|
|
|
|
(if (eq (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."
|
2025-02-24 22:21:46 +01:00
|
|
|
|
(declare (obsolete defvar "31.1"))
|
2021-02-24 13:52:45 -05:00
|
|
|
|
(if (macroexp-compiling-p)
|
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)))
|
2020-03-10 18:23:41 -04:00
|
|
|
|
(if (not (memq nil (mapcar #'symbolp args)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(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)
|
2023-03-29 17:03:31 +02:00
|
|
|
|
(let ((body-form
|
|
|
|
|
(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))))
|
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* (,@(mapcar (lambda (x)
|
|
|
|
|
(pcase-let ((`(,vold ,getter ,_setter ,_vnew) x))
|
|
|
|
|
(list vold getter)))
|
|
|
|
|
binds)
|
|
|
|
|
,@simplebinds)
|
2023-03-29 17:03:31 +02:00
|
|
|
|
,(if binds
|
|
|
|
|
`(unwind-protect ,body-form
|
|
|
|
|
,@(mapcar (lambda (x)
|
|
|
|
|
(pcase-let ((`(,vold ,_getter ,setter ,_vnew) x))
|
|
|
|
|
(funcall setter vold)))
|
|
|
|
|
binds))
|
|
|
|
|
body-form))))
|
2017-11-27 15:33:30 -05:00
|
|
|
|
(let* ((binding (car bindings))
|
2022-09-03 22:38:28 -04:00
|
|
|
|
(place (car binding)))
|
2017-11-27 15:33:30 -05:00
|
|
|
|
(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)
|
2022-09-06 00:08:35 -04:00
|
|
|
|
(if (and (symbolp place)
|
|
|
|
|
;; `place' could be some symbol-macro.
|
|
|
|
|
(eq place getter))
|
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.
|
2022-09-06 00:08:35 -04:00
|
|
|
|
;; FIXME: We currently only use this special case when `place'
|
|
|
|
|
;; is a simple var. Should we also use it when the
|
|
|
|
|
;; macroexpansion of `place' is a simple var (i.e. when
|
|
|
|
|
;; getter+setter is the same as that of a simple var)?
|
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
|
|
|
|
(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.
|
|
|
|
|
|
2023-01-18 14:28:59 +02:00
|
|
|
|
See info node `(cl) Modify Macros' for details.
|
2019-10-12 22:21:11 +02: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
|
|
|
|
\(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))
|
2023-09-12 08:28:37 +02:00
|
|
|
|
;; NB. This will produce incorrect results in some
|
|
|
|
|
;; cases, as our coding conventions says that the first
|
|
|
|
|
;; line must be a full sentence. However, if we don't
|
|
|
|
|
;; word wrap we will have byte-compiler warnings about
|
|
|
|
|
;; overly long docstrings. So we can't have a perfect
|
|
|
|
|
;; result here, and choose to avoid the byte-compiler
|
|
|
|
|
;; warnings.
|
|
|
|
|
,(internal--format-docstring-line "compiler-macro for `%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
|
|
|
|
nil
|
|
|
|
|
,(and (memq '&key args) 'cl-whole) nil ,@argns)))
|
|
|
|
|
(cl-defun ,name ,args ,@body))))
|
|
|
|
|
|
2023-04-13 20:21:11 +02:00
|
|
|
|
(defun cl--defsubst-expand (argns body _simple whole _unsafe &rest argvs)
|
2023-06-23 11:37:12 -04:00
|
|
|
|
(if (and whole (not (cl--safe-expr-p (macroexp-progn argvs))))
|
2023-04-13 20:21:11 +02:00
|
|
|
|
whole
|
2023-06-23 11:37:12 -04:00
|
|
|
|
;; Function arguments are unconditionally statically scoped (bug#47552).
|
2023-06-25 11:38:40 -04:00
|
|
|
|
(cl--slet (cl-mapcar #'list argns argvs) body 'nowarn)))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
|
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
|
|
|
|
|
2021-08-21 16:50:16 +02:00
|
|
|
|
NAME is usually a symbol, but may instead take the form (NAME
|
|
|
|
|
OPTIONS...), where each OPTION is either a single keyword
|
|
|
|
|
or (KEYWORD VALUE) where KEYWORD can be one of `:conc-name',
|
|
|
|
|
`:constructor', `:copier', `:predicate', `:type', `:named',
|
|
|
|
|
`:initial-offset', `:print-function', `:noinline', or `:include'.
|
|
|
|
|
See Info node `(cl)Structures' for the description of the
|
|
|
|
|
options.
|
|
|
|
|
|
|
|
|
|
The first element in SLOTS can be a doc string.
|
|
|
|
|
|
|
|
|
|
The rest of the elements in SLOTS is a list of SLOT elements,
|
|
|
|
|
each of which should either be a symbol, or take the form (SNAME
|
|
|
|
|
SDEFAULT SOPTIONS...), where SDEFAULT is the default value of
|
|
|
|
|
that slot and SOPTIONS are keyword-value pairs for that slot.
|
|
|
|
|
|
2019-07-29 11:56:11 -04:00
|
|
|
|
Supported keywords for slots are:
|
2020-12-30 12:38:20 +01:00
|
|
|
|
- `:read-only': If this has a non-nil value, that slot cannot be set via `setf'.
|
2019-07-29 11:56:11 -04:00
|
|
|
|
- `:documentation': this is a docstring describing the slot.
|
2020-03-01 18:50:14 +01:00
|
|
|
|
- `:type': the type of the field; currently only used for documentation.
|
2010-01-16 15:04:29 -05:00
|
|
|
|
|
2021-09-28 18:08:47 +02:00
|
|
|
|
To see the documentation for a defined struct type, use
|
2021-09-28 18:38:10 +02:00
|
|
|
|
\\[describe-symbol] or \\[cl-describe-type].
|
2021-09-28 18:08:47 +02:00
|
|
|
|
|
2019-07-13 05:05:03 +02:00
|
|
|
|
\(fn NAME &optional DOCSTRING &rest 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
|
2022-03-14 09:28:18 -04:00
|
|
|
|
(gate ;; FIXME: Why?
|
2012-05-17 17:39:36 -04:00
|
|
|
|
symbolp &rest
|
2022-03-14 09:28:18 -04:00
|
|
|
|
[&or (":constructor" &define name &optional cl-lambda-list)
|
|
|
|
|
sexp])]
|
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))
|
2024-04-16 21:17:47 -04:00
|
|
|
|
(warning nil)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(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)
|
2021-02-24 13:52:45 -05:00
|
|
|
|
(safety (if (macroexp-compiling-p) 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)))
|
2023-06-25 11:38:40 -04:00
|
|
|
|
(dynbound-slotnames '())
|
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)
|
2020-11-16 17:03:45 +01:00
|
|
|
|
(mapcar (lambda (x) (if (consp x) x (list x)))
|
1993-07-30 20:15:09 +00:00
|
|
|
|
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))
|
2020-11-16 17:03:45 +01:00
|
|
|
|
(setq include-descs (mapcar (lambda (x)
|
|
|
|
|
(if (consp x) x (list x)))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(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
|
2024-04-16 21:17:47 -04:00
|
|
|
|
(setq warning
|
|
|
|
|
(macroexp-warn-and-return
|
|
|
|
|
(format "Structure option %S unrecognized" opt)
|
|
|
|
|
warning nil nil (list opt struct)))))))
|
2023-10-30 00:59:19 -04:00
|
|
|
|
(unless (or include-name type
|
|
|
|
|
;; Don't create a bogus parent to `cl-structure-object'
|
|
|
|
|
;; while compiling the (cl-defstruct cl-structure-object ..)
|
|
|
|
|
;; in `cl-preloaded.el'.
|
|
|
|
|
(eq name cl--struct-default-parent))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
(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)
|
2022-08-03 01:40:32 +02:00
|
|
|
|
(if (and (eq (caadr pred-form) 'vectorp)
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(= safety 1))
|
2022-08-03 01:40:32 +02:00
|
|
|
|
(cons 'and (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
|
2023-05-24 17:05:26 +02:00
|
|
|
|
(push `(eval-and-compile
|
|
|
|
|
;; Define the predicate to be effective at compile time
|
|
|
|
|
;; as native comp relies on `cl-typep' that relies on
|
|
|
|
|
;; predicates to be defined as they are registered in
|
|
|
|
|
;; cl-deftype-satisfies.
|
|
|
|
|
(,defsym ,predicate (cl-x)
|
2021-12-01 11:23:25 +01:00
|
|
|
|
(declare (side-effect-free error-free) (pure t))
|
2016-12-02 00:03:57 -05:00
|
|
|
|
,(if (eq (car pred-form) 'and)
|
|
|
|
|
(append pred-form '(t))
|
|
|
|
|
`(and ,pred-form t)))
|
2022-09-03 10:46:46 -04:00
|
|
|
|
(define-symbol-prop ',name 'cl-deftype-satisfies ',predicate))
|
2020-03-27 17:14:34 -04:00
|
|
|
|
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)))
|
2023-06-25 11:38:40 -04:00
|
|
|
|
(when (macroexp--dynamic-variable-p slot)
|
|
|
|
|
(push slot dynbound-slotnames))
|
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))
|
2019-07-29 11:56:11 -04:00
|
|
|
|
(let ((accessor (intern (format "%s%s" conc-name slot)))
|
|
|
|
|
(default-value (pop desc))
|
2019-09-08 18:41:43 -04:00
|
|
|
|
(doc (plist-get desc :documentation))
|
|
|
|
|
(access-body
|
|
|
|
|
`(progn
|
|
|
|
|
,@(and pred-check
|
|
|
|
|
(list `(or ,pred-check
|
|
|
|
|
(signal 'wrong-type-argument
|
|
|
|
|
(list ',name cl-x)))))
|
|
|
|
|
,(if (memq type '(nil vector)) `(aref cl-x ,pos)
|
|
|
|
|
(if (= pos 0) '(car cl-x)
|
|
|
|
|
`(nth ,pos cl-x))))))
|
2002-09-27 23:16:27 +00:00
|
|
|
|
(push slot slots)
|
2019-07-29 11:56:11 -04:00
|
|
|
|
(push default-value defaults)
|
2021-09-27 11:26:31 +02:00
|
|
|
|
;; The arg "cl-x" is referenced by name in e.g. pred-form
|
2016-05-27 19:22:29 -04:00
|
|
|
|
;; and pred-check, so changing it is not straightforward.
|
2019-04-02 12:24:52 -04:00
|
|
|
|
(push `(,defsym ,accessor (cl-x)
|
2023-09-12 08:28:37 +02:00
|
|
|
|
,(let ((long-docstring
|
2025-03-24 00:33:37 +01:00
|
|
|
|
(format "Access slot \"%s\" of `%s' struct X."
|
|
|
|
|
slot name)))
|
2023-09-12 08:28:37 +02:00
|
|
|
|
(concat
|
|
|
|
|
;; NB. This will produce incorrect results
|
|
|
|
|
;; in some cases, as our coding conventions
|
|
|
|
|
;; says that the first line must be a full
|
|
|
|
|
;; sentence. However, if we don't word
|
|
|
|
|
;; wrap we will have byte-compiler warnings
|
|
|
|
|
;; about overly long docstrings. So we
|
|
|
|
|
;; can't have a perfect result here, and
|
|
|
|
|
;; choose to avoid the byte-compiler
|
|
|
|
|
;; warnings.
|
2023-09-13 18:22:51 +02:00
|
|
|
|
(if (>= (length long-docstring)
|
2023-10-01 18:34:41 +02:00
|
|
|
|
(or (bound-and-true-p
|
|
|
|
|
byte-compile-docstring-max-column)
|
2023-09-13 18:22:51 +02:00
|
|
|
|
80))
|
2023-09-12 08:28:37 +02:00
|
|
|
|
(concat
|
|
|
|
|
(internal--format-docstring-line
|
2025-03-24 00:33:37 +01:00
|
|
|
|
"Access slot \"%s\" of X." slot)
|
2023-09-12 08:28:37 +02:00
|
|
|
|
"\n"
|
|
|
|
|
(internal--format-docstring-line
|
2025-03-24 00:33:37 +01:00
|
|
|
|
"Struct X is a `%s'." name))
|
2023-09-12 08:28:37 +02:00
|
|
|
|
(internal--format-docstring-line long-docstring))
|
2025-03-24 00:33:37 +01:00
|
|
|
|
(if doc (concat "\n" doc) "")
|
|
|
|
|
"\n"
|
|
|
|
|
(format "\n\n(fn %s X)" accessor)))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
(declare (side-effect-free t))
|
2019-09-08 18:41:43 -04:00
|
|
|
|
,access-body)
|
2014-07-20 21:41:59 -04:00
|
|
|
|
forms)
|
2025-03-24 00:33:37 +01:00
|
|
|
|
;; FIXME: This hack is to document this as a generalized
|
|
|
|
|
;; variable, despite it not having the `gv-expander'
|
|
|
|
|
;; property. See `help-fns--generalized-variable'.
|
|
|
|
|
(push `(function-put ',accessor 'document-generalized-variable t)
|
|
|
|
|
forms)
|
Prefer oddp/evenp to cl-oddp/cl-evenp
* lisp/calc/calc-ext.el (math-oddp):
* lisp/calc/calc-misc.el (math-evenp):
* lisp/calendar/todo-mode.el
(todo-adjusted-category-label-length, todo-insert-category-line)
(todo-update-categories-display):
* lisp/emacs-lisp/cl-macs.el (cl-defstruct):
* lisp/net/gnutls.el (open-gnutls-stream):
* lisp/tab-line.el (tab-line-tab-face-inactive-alternating):
* test/lisp/auth-source-tests.el
(auth-source-test-macos-keychain-search):
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-notany)
(cl-extra-test-notevery):
* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-adjoin-test):
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-collect)
(cl-macs-loop-append/nconc, cl-macs-loop-when)
(cl-macs-loop-if):
* test/lisp/emacs-lisp/cl-seq-tests.el (cl-seq-remove-test)
(cl-remove-if-test, cl-remove-if-not-test, cl-seq-delete-test)
(cl-delete-if-test, cl-delete-if-not-test)
(cl-seq-substitute-if-test, cl-seq-substitute-if-not-test)
(cl-find-if-test, cl-find-if-not-test, cl-position-if-test)
(cl-seq-count-test, cl-count-if-test, cl-count-if-not-test)
(cl-member-if-test, cl-member-if-not-test, cl-assoc-if-test)
(cl-assoc-if-not-test, cl-rassoc-if-test)
(cl-rassoc-if-not-test):
* test/src/treesit-tests.el (treesit-search-forward-predicate):
Prefer oddp/evenp to cl-oddp/cl-evenp where possible.
* lisp/calc/calc-ext.el (cl-lib):
* lisp/calc/calc-misc.el (cl-lib): Don't require.
2025-02-17 03:33:54 +01:00
|
|
|
|
(when (oddp (length desc))
|
2017-01-03 16:07:44 -05:00
|
|
|
|
(push
|
2021-02-26 20:24:52 -05:00
|
|
|
|
(macroexp-warn-and-return
|
2023-01-03 15:58:14 +01:00
|
|
|
|
(format-message
|
|
|
|
|
"Missing value for option `%S' of slot `%s' in struct %s!"
|
|
|
|
|
(car (last desc)) slot name)
|
2022-02-19 14:20:02 -05:00
|
|
|
|
nil nil nil (car (last desc)))
|
2017-01-03 16:07:44 -05:00
|
|
|
|
forms)
|
|
|
|
|
(when (and (keywordp (car defaults))
|
|
|
|
|
(not (keywordp (car desc))))
|
|
|
|
|
(let ((kw (car defaults)))
|
|
|
|
|
(push
|
2021-02-26 20:24:52 -05:00
|
|
|
|
(macroexp-warn-and-return
|
2023-01-03 15:58:14 +01:00
|
|
|
|
(format-message
|
|
|
|
|
" I'll take `%s' to be an option rather than a default value."
|
|
|
|
|
kw)
|
2022-02-19 14:20:02 -05:00
|
|
|
|
nil nil nil kw)
|
2017-01-03 16:07:44 -05:00
|
|
|
|
forms)
|
|
|
|
|
(push kw desc)
|
|
|
|
|
(setcar defaults nil))))
|
2019-09-08 18:41:43 -04:00
|
|
|
|
(cond
|
|
|
|
|
((eq defsym 'defun)
|
|
|
|
|
(unless (plist-get desc ':read-only)
|
|
|
|
|
(push `(defun ,(gv-setter accessor) (val cl-x)
|
|
|
|
|
(setf ,access-body val))
|
|
|
|
|
forms)))
|
|
|
|
|
((plist-get desc ':read-only)
|
|
|
|
|
(push `(gv-define-expander ,accessor
|
|
|
|
|
(lambda (_cl-do _cl-x)
|
|
|
|
|
(error "%s is a read-only slot" ',accessor)))
|
|
|
|
|
forms))
|
|
|
|
|
(t
|
2012-10-09 02:01:10 -04:00
|
|
|
|
;; 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)
|
2019-09-08 18:41:43 -04:00
|
|
|
|
))
|
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))
|
2020-09-30 16:18:50 +02:00
|
|
|
|
(make (cl-mapcar (lambda (s d) (if (memq s anames) s d))
|
2020-04-05 09:54:53 -04:00
|
|
|
|
slots defaults))
|
2023-04-13 20:21:11 +02:00
|
|
|
|
(con-fun (or type #'record)))
|
|
|
|
|
(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
|
2023-09-12 08:28:37 +02:00
|
|
|
|
;; NB. This will produce incorrect results in
|
|
|
|
|
;; some cases, as our coding conventions says that
|
|
|
|
|
;; the first line must be a full sentence.
|
|
|
|
|
;; However, if we don't word wrap we will have
|
|
|
|
|
;; byte-compiler warnings about overly long
|
|
|
|
|
;; docstrings. So we can't have a perfect result
|
|
|
|
|
;; here, and choose to avoid the byte-compiler
|
|
|
|
|
;; warnings.
|
|
|
|
|
(internal--format-docstring-line
|
|
|
|
|
"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))))
|
2020-04-05 09:54:53 -04:00
|
|
|
|
(,con-fun ,@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)
|
2023-06-25 11:38:40 -04:00
|
|
|
|
,@(if (null dynbound-slotnames)
|
|
|
|
|
(nreverse forms)
|
|
|
|
|
`((with-suppressed-warnings ((lexical . ,dynbound-slotnames))
|
|
|
|
|
,@(nreverse forms))))
|
2019-09-10 03:36:15 -07:00
|
|
|
|
:autoload-end
|
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))
|
2024-04-16 21:17:47 -04:00
|
|
|
|
,warning
|
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
|
|
|
|
|
|
|
|
|
|
;;;###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])))
|
2024-02-11 22:00:44 -05:00
|
|
|
|
`(and (pred (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))
|
2024-02-11 22:00:44 -05:00
|
|
|
|
`(aref _ ,(cl-struct-slot-offset type name)))
|
2015-03-23 18:24:30 -04:00
|
|
|
|
,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
|
2024-02-11 22:00:44 -05:00
|
|
|
|
(and (eq 'cl-typep (car-safe x1)) (setq x1 (cdr x1))
|
|
|
|
|
(eq '_ (car-safe x1)) (setq x1 (cdr x1))
|
2015-03-23 23:40:06 -04:00
|
|
|
|
(null (cdr-safe x1)) (setq x1 (car x1))
|
|
|
|
|
(eq 'quote (car-safe x1)) (cadr x1)))
|
|
|
|
|
(t2
|
2024-02-11 22:00:44 -05:00
|
|
|
|
(and (eq 'cl-typep (car-safe x2)) (setq x2 (cdr x2))
|
|
|
|
|
(eq '_ (car-safe x2)) (setq x2 (cdr x2))
|
2015-03-23 23:40:06 -04:00
|
|
|
|
(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
|
2023-11-07 18:57:03 -05:00
|
|
|
|
(not (or (memq t1 (cl--class-allparents c2))
|
|
|
|
|
(memq t2 (cl--class-allparents c1)))))))
|
2015-03-23 23:40:06 -04:00
|
|
|
|
(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))))
|
2022-03-17 19:07:59 -04:00
|
|
|
|
(when (fboundp 'advice-add) ;Not available during bootstrap.
|
|
|
|
|
(advice-add 'pcase--mutually-exclusive-p
|
|
|
|
|
:around #'cl--pcase-mutually-exclusive-p))
|
2015-03-23 23:40:06 -04:00
|
|
|
|
|
|
|
|
|
|
2022-07-31 11:33:47 +02:00
|
|
|
|
;;;###cl-autoload
|
2014-04-19 19:34:22 -07:00
|
|
|
|
(defun cl-struct-sequence-type (struct-type)
|
|
|
|
|
"Return the sequence used to build STRUCT-TYPE.
|
2022-06-17 16:48:02 +02:00
|
|
|
|
STRUCT-TYPE is a symbol naming a struct type. Return values are
|
|
|
|
|
either `vector', `list' or nil (and the latter indicates a
|
|
|
|
|
`record' struct type."
|
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
|
|
|
|
|
2021-06-26 12:20:11 -04:00
|
|
|
|
(defun cl--alist-to-plist (alist)
|
|
|
|
|
(let ((res '()))
|
|
|
|
|
(dolist (x alist)
|
|
|
|
|
(push (car x) res)
|
|
|
|
|
(push (cdr x) res))
|
|
|
|
|
(nreverse res)))
|
|
|
|
|
|
2021-09-05 16:52:11 +02:00
|
|
|
|
;;;###autoload
|
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)))
|
2021-06-26 12:20:11 -04:00
|
|
|
|
,@(cl--alist-to-plist (cl--slot-descriptor-props slot)))
|
2015-03-18 10:31:07 -04:00
|
|
|
|
descs)))
|
|
|
|
|
(nreverse descs)))
|
2014-04-19 19:34:22 -07:00
|
|
|
|
|
2020-04-12 15:11:22 +02:00
|
|
|
|
(define-error 'cl-struct-unknown-slot "struct has no slot")
|
2015-07-07 02:14:16 -04:00
|
|
|
|
|
2022-07-31 11:33:47 +02:00
|
|
|
|
;;;###cl-autoload
|
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)
|
|
|
|
|
|
|
|
|
|
(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)
|
2021-02-24 13:52:45 -05:00
|
|
|
|
(and (macroexp-compiling-p)
|
2014-01-23 10:01:41 -05:00
|
|
|
|
(or (cdr (assq sym byte-compile-function-environment))
|
2021-03-01 12:18:49 -05:00
|
|
|
|
(cdr (assq sym macroexpand-all-environment))))))
|
2014-01-23 10:01:41 -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)
|
2024-04-10 15:27:46 +02:00
|
|
|
|
"Return t if VAL is of type TYPE, nil otherwise."
|
2015-02-14 00:46:29 -05:00
|
|
|
|
(inline-letevals (val)
|
|
|
|
|
(pcase (inline-const-val type)
|
2025-05-07 23:17:41 -04:00
|
|
|
|
((and (or (and type (pred symbolp)) `(,type))
|
|
|
|
|
(guard (get type 'cl-deftype-satisfies)))
|
|
|
|
|
(inline-quote (funcall #',(get type 'cl-deftype-satisfies) ,val)))
|
2015-02-14 00:46:29 -05:00
|
|
|
|
((and `(,name . ,args) (guard (get name 'cl-deftype-handler)))
|
|
|
|
|
(inline-quote
|
|
|
|
|
(cl-typep ,val ',(apply (get name 'cl-deftype-handler) args))))
|
2025-05-07 23:17:41 -04:00
|
|
|
|
;; FIXME: Move this to a `cl-deftype'. The problem being that these
|
|
|
|
|
;; types are hybrid "built-in and derived".
|
|
|
|
|
(`(,(and name (or 'integer 'float 'number))
|
2015-02-14 00:46:29 -05:00
|
|
|
|
. ,(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 (or 'nil 't) type) (inline-quote ',type))
|
|
|
|
|
((and (pred symbolp) type)
|
cl-typep: Emit warning when using a type not known to be a type
`cl-typep` has used a heuristic that if there's a `<foo>-p` function,
then <foo> can be used as a type. This made sense in the past where
most types were not officially declared to be (cl-)types, but nowadays
this just encourages abuses such as using `cl-typecase` with
"types" like `fbound`. It's also a problem for EIEIO objects, where
for historical reasons `<foo>-p` tests if the object is of type
exactly `<foo>` whereas (cl-typep OBJ <foo>) should instead test
if OBJ is a *subtype* of `<foo>`.
So we change `cl-typep` to emit a warning whenever this "-p" heuristic
is used, to discourage abuses, encourage the use of explicit
`cl-deftype` declarations, and try and detect some misuses of
`<foo>-p` for EIEIO objects.
* lisp/emacs-lisp/eieio.el (defclass): Define as type not only at
run-time but also for the current compilation unit.
* lisp/emacs-lisp/eieio-core.el (class, eieio-object): Define as types.
* lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Don't abuse the
"-p" heuristic.
* lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies):
Add entries for frames, windows, markers, and overlays.
(cl-typep): Emit a warning when using a predicate that is not known to
correspond to a type.
* lisp/files.el (file-relative-name): Fix error that can trigger if
there's an(other) error between loading `files.el` and loading
`minibuffer.el`.
2022-06-06 00:04:00 -04:00
|
|
|
|
(macroexp-warn-and-return
|
|
|
|
|
(format-message "Unknown type: %S" 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))))
|
|
|
|
|
nil nil type))
|
|
|
|
|
(type (error "Bad type spec: %S" type)))))
|
2015-02-14 00:46:29 -05:00
|
|
|
|
|
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.
|
2025-03-02 04:11:55 +01:00
|
|
|
|
STRING is an optional description of the desired type.
|
|
|
|
|
|
|
|
|
|
Hint: To check the type of an object, use `cl-type-of'.
|
|
|
|
|
To define new types, see `cl-deftype'."
|
2012-05-17 17:39:36 -04:00
|
|
|
|
(declare (debug (place cl-type-spec &optional stringp)))
|
2021-02-24 13:52:45 -05:00
|
|
|
|
(and (or (not (macroexp-compiling-p))
|
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
|
2020-03-10 18:23:41 -04:00
|
|
|
|
(list ,(or string `',(if (eq 'satisfies
|
|
|
|
|
(car-safe type))
|
|
|
|
|
(cadr type) type))
|
|
|
|
|
,temp ',form)))
|
2015-01-27 22:41:31 -05:00
|
|
|
|
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)))
|
2021-02-24 13:52:45 -05:00
|
|
|
|
(and (or (not (macroexp-compiling-p))
|
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."
|
2022-03-03 19:56:09 +01:00
|
|
|
|
;; Like `cl-defmacro', but with the `&whole' special case.
|
2023-09-03 16:55:12 +02:00
|
|
|
|
(declare (debug (&define [&name symbolp "@cl-compiler-macro"]
|
|
|
|
|
cl-macro-list
|
2022-03-03 19:56:09 +01:00
|
|
|
|
cl-declarations-or-string def-body))
|
|
|
|
|
(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)
|
2022-01-14 19:06:04 +00:00
|
|
|
|
(cons '_cl-whole-arg args))
|
|
|
|
|
,@body)
|
2022-09-03 10:46:46 -04:00
|
|
|
|
(define-symbol-prop ',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
|
|
|
|
|
2025-01-16 17:48:21 -05:00
|
|
|
|
(cl-define-compiler-macro cl--block-wrapper (form)
|
|
|
|
|
(pcase form
|
|
|
|
|
(`(let ((,var . ,val)) (catch ,var . ,body))
|
|
|
|
|
(let* ((cl-entry (cons var nil))
|
|
|
|
|
(cl--active-block-names (cons cl-entry cl--active-block-names))
|
|
|
|
|
(cl-body (macroexpand-all ;Performs compiler-macro expansions.
|
|
|
|
|
(macroexp-progn body)
|
|
|
|
|
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)
|
|
|
|
|
`(let ((,var . ,val)) (catch ,var ,@(macroexp-unprogn cl-body)))
|
|
|
|
|
cl-body)))
|
|
|
|
|
;; `form' was somehow mangled, god knows what happened, let's not touch it.
|
|
|
|
|
(_ form)))
|
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-throw (cl-tag cl-value)
|
2025-01-16 17:48:21 -05:00
|
|
|
|
(let ((cl-found (and (symbolp cl-tag) (assq 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
|
|
|
|
|
2014-04-20 07:46:13 -07:00
|
|
|
|
;;; Types and assertions.
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defmacro cl-deftype (name arglist &rest body)
|
2025-05-07 13:24:07 -04:00
|
|
|
|
"Define NAME as a new, so-called derived type.
|
2025-05-05 23:18:56 -04:00
|
|
|
|
The type NAME can then be used in `cl-typecase', `cl-check-type',
|
|
|
|
|
etc., and to some extent, as method specializer.
|
|
|
|
|
|
|
|
|
|
ARGLIST is a Common Lisp argument list of the sort accepted by
|
|
|
|
|
`cl-defmacro'. BODY forms should return a type specifier that is equivalent
|
|
|
|
|
to the type (see the Info node `(cl)Type Predicates').
|
2014-04-20 07:46:13 -07:00
|
|
|
|
|
2025-05-05 23:18:56 -04:00
|
|
|
|
If there is a `declare' form in BODY, the spec (parents . PARENTS)
|
|
|
|
|
can specify a list of types NAME is a subtype of.
|
|
|
|
|
The list of PARENTS types determines the order of methods invocation,
|
|
|
|
|
and missing PARENTS may cause incorrect ordering of methods, while
|
|
|
|
|
extraneous PARENTS may cause use of extraneous methods.
|
|
|
|
|
|
|
|
|
|
If PARENTS is non-nil, ARGLIST must be nil."
|
|
|
|
|
(declare (debug cl-defmacro) (doc-string 3) (indent 2))
|
|
|
|
|
(pcase-let*
|
|
|
|
|
((`(,decls . ,forms) (macroexp-parse-body body))
|
|
|
|
|
(declares (assq 'declare decls))
|
|
|
|
|
(parent-decl (assq 'parents (cdr declares)))
|
|
|
|
|
(parents (cdr parent-decl)))
|
|
|
|
|
(when parent-decl
|
|
|
|
|
;; "Consume" the `parents' declaration.
|
|
|
|
|
(cl-callf (lambda (x) (delq parent-decl x)) (cdr declares))
|
|
|
|
|
(when (equal declares '(declare))
|
|
|
|
|
(cl-callf (lambda (x) (delq declares x)) decls)))
|
|
|
|
|
(and parents arglist
|
|
|
|
|
(error "Parents specified, but arglist not empty"))
|
2025-05-07 23:17:41 -04:00
|
|
|
|
(let* ((expander
|
|
|
|
|
`(cl-function (lambda (&cl-defs ('*) ,@arglist) ,@decls ,@forms)))
|
|
|
|
|
;; FIXME: Pass a better lexical context.
|
|
|
|
|
(specifier (ignore-errors (funcall (eval expander t))))
|
|
|
|
|
(predicate
|
|
|
|
|
(pcase specifier
|
|
|
|
|
(`(satisfies ,f) `#',f)
|
|
|
|
|
('nil nil)
|
|
|
|
|
(type `(lambda (x) (cl-typep x ',type))))))
|
|
|
|
|
`(eval-and-compile
|
|
|
|
|
(cl--define-derived-type
|
|
|
|
|
',name ,expander ,predicate ',parents)))))
|
2025-05-05 23:18:56 -04:00
|
|
|
|
|
2025-05-07 23:26:40 -04:00
|
|
|
|
;; This one is redundant, but we keep it to silence a
|
|
|
|
|
;; warning during the early bootstrap when `cl-seq.el' gets
|
|
|
|
|
;; loaded before `cl-preloaded.el' is defined.
|
|
|
|
|
(put 'list 'cl-deftype-satisfies #'listp)
|
|
|
|
|
|
2025-05-11 01:30:01 -04:00
|
|
|
|
;; Thanks to `eval-and-compile', `cl--define-derived-type' is needed
|
|
|
|
|
;; both at compile-time and at runtime, so we need to double-check.
|
|
|
|
|
(static-if (not (fboundp 'cl--define-derived-type)) nil
|
2025-05-13 22:32:55 -04:00
|
|
|
|
(when (fboundp 'cl--define-derived-type)
|
2025-05-11 01:30:01 -04:00
|
|
|
|
(cl-deftype natnum () (declare (parents integer)) '(satisfies natnump))
|
|
|
|
|
(cl-deftype character () (declare (parents fixnum natnum))
|
|
|
|
|
'(and fixnum natnum))
|
|
|
|
|
(cl-deftype base-char () (declare (parents character))
|
|
|
|
|
'(satisfies characterp))
|
|
|
|
|
(cl-deftype extended-char () (declare (parents character))
|
|
|
|
|
'(and character (not base-char)))
|
|
|
|
|
(cl-deftype keyword () (declare (parents symbol)) '(satisfies keywordp))
|
|
|
|
|
(cl-deftype command ()
|
|
|
|
|
;; FIXME: Can't use `function' as parent because of arrays as
|
|
|
|
|
;; keyboard macros, which are redundant since `kmacro.el'!!
|
|
|
|
|
;;(declare (parents function))
|
|
|
|
|
'(satisfies commandp))
|
|
|
|
|
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(defmacro cl--defnumtype (type base)
|
|
|
|
|
`(cl-deftype ,type (&optional min max)
|
|
|
|
|
(list 'and ',base
|
|
|
|
|
(if (memq min '(* nil)) t
|
|
|
|
|
(if (consp min)
|
|
|
|
|
`(satisfies . ,(lambda (val) (> val (car min))))
|
|
|
|
|
`(satisfies . ,(lambda (val) (>= val min)))))
|
|
|
|
|
(if (memq max '(* nil)) t
|
|
|
|
|
(if (consp max)
|
|
|
|
|
`(satisfies . ,(lambda (val) (< val (car max))))
|
|
|
|
|
`(satisfies . ,(lambda (val) (<= val max)))))))))
|
|
|
|
|
;;(cl--defnumtype integer ??)
|
|
|
|
|
;;(cl--defnumtype float ??)
|
|
|
|
|
;;(cl--defnumtype number ??)
|
|
|
|
|
(cl--defnumtype real number)))
|
2025-05-07 23:17:41 -04:00
|
|
|
|
|
|
|
|
|
;; Additional functions that we can now define because we've defined
|
|
|
|
|
;; `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.
|
2022-04-03 17:51:04 +02:00
|
|
|
|
STRUCT-TYPE 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
|
|
|
|
|
2020-10-20 19:10:51 +02:00
|
|
|
|
(make-obsolete-variable 'cl-macs-load-hook
|
|
|
|
|
"use `with-eval-after-load' instead." "28.1")
|
1993-07-30 20:15:09 +00:00
|
|
|
|
(run-hooks 'cl-macs-load-hook)
|
|
|
|
|
|
2020-03-09 13:01:32 -05:00
|
|
|
|
;;; Pcase type pattern.
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(pcase-defmacro cl-type (type)
|
|
|
|
|
"Pcase pattern that matches objects of TYPE.
|
|
|
|
|
TYPE is a type descriptor as accepted by `cl-typep', which see."
|
2024-02-11 22:00:44 -05:00
|
|
|
|
`(pred (cl-typep _ ',type)))
|
|
|
|
|
|
2020-03-09 13:01:32 -05:00
|
|
|
|
|
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
|