2011-03-10 09:52:33 -05:00
|
|
|
|
;;; byte-opt.el --- the optimization passes of the emacs-lisp byte compiler -*- lexical-binding: t -*-
|
1992-07-22 16:55:01 +00:00
|
|
|
|
|
2016-01-01 01:16:19 -08:00
|
|
|
|
;; Copyright (C) 1991, 1994, 2000-2016 Free Software Foundation, Inc.
|
1992-07-22 16:55:01 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Jamie Zawinski <jwz@lucid.com>
|
|
|
|
|
;; Hallvard Furuseth <hbf@ulrik.uio.no>
|
2014-02-09 17:34:22 -08:00
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
1992-07-22 16:55:01 +00:00
|
|
|
|
;; Keywords: internal
|
2010-08-29 12:17:13 -04:00
|
|
|
|
;; Package: emacs
|
1992-07-10 22:06:47 +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
|
1992-07-10 22:06:47 +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.
|
1992-07-10 22:06:47 +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
|
2008-05-06 03:21:21 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
1992-07-22 16:55:01 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; ========================================================================
|
|
|
|
|
;; "No matter how hard you try, you can't make a racehorse out of a pig.
|
|
|
|
|
;; You can, however, make a faster pig."
|
|
|
|
|
;;
|
2007-08-23 19:56:16 +00:00
|
|
|
|
;; Or, to put it another way, the Emacs byte compiler is a VW Bug. This code
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; makes it be a VW Bug with fuel injection and a turbocharger... You're
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; still not going to make it go faster than 70 mph, but it might be easier
|
|
|
|
|
;; to get it there.
|
|
|
|
|
;;
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; TO DO:
|
|
|
|
|
;;
|
2000-06-12 05:06:37 +00:00
|
|
|
|
;; (apply (lambda (x &rest y) ...) 1 (foo))
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;
|
|
|
|
|
;; maintain a list of functions known not to access any global variables
|
|
|
|
|
;; (actually, give them a 'dynamically-safe property) and then
|
|
|
|
|
;; (let ( v1 v2 ... vM vN ) <...dynamically-safe...> ) ==>
|
|
|
|
|
;; (let ( v1 v2 ... vM ) vN <...dynamically-safe...> )
|
|
|
|
|
;; by recursing on this, we might be able to eliminate the entire let.
|
|
|
|
|
;; However certain variables should never have their bindings optimized
|
|
|
|
|
;; away, because they affect everything.
|
|
|
|
|
;; (put 'debug-on-error 'binding-is-magic t)
|
|
|
|
|
;; (put 'debug-on-abort 'binding-is-magic t)
|
|
|
|
|
;; (put 'debug-on-next-call 'binding-is-magic t)
|
|
|
|
|
;; (put 'inhibit-quit 'binding-is-magic t)
|
|
|
|
|
;; (put 'quit-flag 'binding-is-magic t)
|
|
|
|
|
;; (put 't 'binding-is-magic t)
|
|
|
|
|
;; (put 'nil 'binding-is-magic t)
|
|
|
|
|
;; possibly also
|
|
|
|
|
;; (put 'gc-cons-threshold 'binding-is-magic t)
|
|
|
|
|
;; (put 'track-mouse 'binding-is-magic t)
|
|
|
|
|
;; others?
|
|
|
|
|
;;
|
|
|
|
|
;; Simple defsubsts often produce forms like
|
|
|
|
|
;; (let ((v1 (f1)) (v2 (f2)) ...)
|
|
|
|
|
;; (FN v1 v2 ...))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; It would be nice if we could optimize this to
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; (FN (f1) (f2) ...)
|
|
|
|
|
;; but we can't unless FN is dynamically-safe (it might be dynamically
|
|
|
|
|
;; referring to the bindings that the lambda arglist established.)
|
|
|
|
|
;; One of the uncountable lossages introduced by dynamic scope...
|
|
|
|
|
;;
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; Maybe there should be a control-structure that says "turn on
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; fast-and-loose type-assumptive optimizations here." Then when
|
|
|
|
|
;; we see a form like (car foo) we can from then on assume that
|
|
|
|
|
;; the variable foo is of type cons, and optimize based on that.
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; But, this won't win much because of (you guessed it) dynamic
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; scope. Anything down the stack could change the value.
|
|
|
|
|
;; (Another reason it doesn't work is that it is perfectly valid
|
|
|
|
|
;; to call car with a null argument.) A better approach might
|
|
|
|
|
;; be to allow type-specification of the form
|
|
|
|
|
;; (put 'foo 'arg-types '(float (list integer) dynamic))
|
|
|
|
|
;; (put 'foo 'result-type 'bool)
|
|
|
|
|
;; It should be possible to have these types checked to a certain
|
|
|
|
|
;; degree.
|
|
|
|
|
;;
|
|
|
|
|
;; collapse common subexpressions
|
|
|
|
|
;;
|
|
|
|
|
;; It would be nice if redundant sequences could be factored out as well,
|
|
|
|
|
;; when they are known to have no side-effects:
|
|
|
|
|
;; (list (+ a b c) (+ a b c)) --> a b add c add dup list-2
|
|
|
|
|
;; but beware of traps like
|
|
|
|
|
;; (cons (list x y) (list x y))
|
|
|
|
|
;;
|
|
|
|
|
;; Tail-recursion elimination is not really possible in Emacs Lisp.
|
|
|
|
|
;; Tail-recursion elimination is almost always impossible when all variables
|
|
|
|
|
;; have dynamic scope, but given that the "return" byteop requires the
|
|
|
|
|
;; binding stack to be empty (rather than emptying it itself), there can be
|
|
|
|
|
;; no truly tail-recursive Emacs Lisp functions that take any arguments or
|
|
|
|
|
;; make any bindings.
|
|
|
|
|
;;
|
|
|
|
|
;; Here is an example of an Emacs Lisp function which could safely be
|
|
|
|
|
;; byte-compiled tail-recursively:
|
|
|
|
|
;;
|
|
|
|
|
;; (defun tail-map (fn list)
|
|
|
|
|
;; (cond (list
|
|
|
|
|
;; (funcall fn (car list))
|
|
|
|
|
;; (tail-map fn (cdr list)))))
|
|
|
|
|
;;
|
|
|
|
|
;; However, if there was even a single let-binding around the COND,
|
|
|
|
|
;; it could not be byte-compiled, because there would be an "unbind"
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; byte-op between the final "call" and "return." Adding a
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; Bunbind_all byteop would fix this.
|
|
|
|
|
;;
|
|
|
|
|
;; (defun foo (x y z) ... (foo a b c))
|
|
|
|
|
;; ... (const foo) (varref a) (varref b) (varref c) (call 3) END: (return)
|
|
|
|
|
;; ... (varref a) (varbind x) (varref b) (varbind y) (varref c) (varbind z) (goto 0) END: (unbind-all) (return)
|
|
|
|
|
;; ... (varref a) (varset x) (varref b) (varset y) (varref c) (varset z) (goto 0) END: (return)
|
|
|
|
|
;;
|
|
|
|
|
;; this also can be considered tail recursion:
|
|
|
|
|
;;
|
|
|
|
|
;; ... (const foo) (varref a) (call 1) (goto X) ... X: (return)
|
|
|
|
|
;; could generalize this by doing the optimization
|
|
|
|
|
;; (goto X) ... X: (return) --> (return)
|
|
|
|
|
;;
|
|
|
|
|
;; But this doesn't solve all of the problems: although by doing tail-
|
|
|
|
|
;; recursion elimination in this way, the call-stack does not grow, the
|
|
|
|
|
;; binding-stack would grow with each recursive step, and would eventually
|
|
|
|
|
;; overflow. I don't believe there is any way around this without lexical
|
|
|
|
|
;; scope.
|
|
|
|
|
;;
|
|
|
|
|
;; Wouldn't it be nice if Emacs Lisp had lexical scope.
|
|
|
|
|
;;
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; Idea: the form (lexical-scope) in a file means that the file may be
|
|
|
|
|
;; compiled lexically. This proclamation is file-local. Then, within
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; that file, "let" would establish lexical bindings, and "let-dynamic"
|
|
|
|
|
;; would do things the old way. (Or we could use CL "declare" forms.)
|
|
|
|
|
;; We'd have to notice defvars and defconsts, since those variables should
|
|
|
|
|
;; always be dynamic, and attempting to do a lexical binding of them
|
|
|
|
|
;; should simply do a dynamic binding instead.
|
2011-11-26 20:43:11 -08:00
|
|
|
|
;; But! We need to know about variables that were not necessarily defvared
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; in the file being compiled (doing a boundp check isn't good enough.)
|
|
|
|
|
;; Fdefvar() would have to be modified to add something to the plist.
|
|
|
|
|
;;
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; A major disadvantage of this scheme is that the interpreter and compiler
|
|
|
|
|
;; would have different semantics for files compiled with (dynamic-scope).
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; Since this would be a file-local optimization, there would be no way to
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; modify the interpreter to obey this (unless the loader was hacked
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; in some grody way, but that's a really bad idea.)
|
1995-07-17 22:44:06 +00:00
|
|
|
|
|
|
|
|
|
;; Other things to consider:
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; ;; Associative math should recognize subcalls to identical function:
|
|
|
|
|
;; (disassemble (lambda (x) (+ (+ (foo) 1) (+ (bar) 2))))
|
|
|
|
|
;; ;; This should generate the same as (1+ x) and (1- x)
|
2005-06-21 13:45:12 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; (disassemble (lambda (x) (cons (+ x 1) (- x 1))))
|
|
|
|
|
;; ;; An awful lot of functions always return a non-nil value. If they're
|
|
|
|
|
;; ;; error free also they may act as true-constants.
|
2005-06-21 13:45:12 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; (disassemble (lambda (x) (and (point) (foo))))
|
|
|
|
|
;; ;; When
|
|
|
|
|
;; ;; - all but one arguments to a function are constant
|
|
|
|
|
;; ;; - the non-constant argument is an if-expression (cond-expression?)
|
|
|
|
|
;; ;; then the outer function can be distributed. If the guarding
|
|
|
|
|
;; ;; condition is side-effect-free [assignment-free] then the other
|
|
|
|
|
;; ;; arguments may be any expressions. Since, however, the code size
|
|
|
|
|
;; ;; can increase this way they should be "simple". Compare:
|
2005-06-21 13:45:12 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; (disassemble (lambda (x) (eq (if (point) 'a 'b) 'c)))
|
|
|
|
|
;; (disassemble (lambda (x) (if (point) (eq 'a 'c) (eq 'b 'c))))
|
2005-06-21 13:45:12 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; ;; (car (cons A B)) -> (prog1 A B)
|
|
|
|
|
;; (disassemble (lambda (x) (car (cons (foo) 42))))
|
2005-06-21 13:45:12 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; ;; (cdr (cons A B)) -> (progn A B)
|
|
|
|
|
;; (disassemble (lambda (x) (cdr (cons 42 (foo)))))
|
2005-06-21 13:45:12 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; ;; (car (list A B ...)) -> (prog1 A B ...)
|
|
|
|
|
;; (disassemble (lambda (x) (car (list (foo) 42 (bar)))))
|
2005-06-21 13:45:12 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; ;; (cdr (list A B ...)) -> (progn A (list B ...))
|
|
|
|
|
;; (disassemble (lambda (x) (cdr (list 42 (foo) (bar)))))
|
1995-07-17 22:44:06 +00:00
|
|
|
|
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
1992-07-22 16:55:01 +00:00
|
|
|
|
;;; Code:
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
1998-12-05 18:18:50 +00:00
|
|
|
|
(require 'bytecomp)
|
2012-06-10 09:28:26 -04:00
|
|
|
|
(eval-when-compile (require 'cl-lib))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(require 'macroexp)
|
1998-12-05 18:18:50 +00:00
|
|
|
|
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(defun byte-compile-log-lap-1 (format &rest args)
|
2011-02-21 15:31:07 -05:00
|
|
|
|
;; Newer byte codes for stack-ref make the slot 0 non-nil again.
|
|
|
|
|
;; But the "old disassembler" is *really* ancient by now.
|
|
|
|
|
;; (if (aref byte-code-vector 0)
|
|
|
|
|
;; (error "The old version of the disassembler is loaded. Reload new-bytecomp as well"))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-log-1
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* 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):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
(apply #'format-message format
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(let (c a)
|
2000-06-12 05:06:37 +00:00
|
|
|
|
(mapcar (lambda (arg)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(if (not (consp arg))
|
|
|
|
|
(if (and (symbolp arg)
|
|
|
|
|
(string-match "^byte-" (symbol-name arg)))
|
|
|
|
|
(intern (substring (symbol-name arg) 5))
|
|
|
|
|
arg)
|
|
|
|
|
(if (integerp (setq c (car arg)))
|
|
|
|
|
(error "non-symbolic byte-op %s" c))
|
|
|
|
|
(if (eq c 'TAG)
|
|
|
|
|
(setq c arg)
|
|
|
|
|
(setq a (cond ((memq c byte-goto-ops)
|
|
|
|
|
(car (cdr (cdr arg))))
|
|
|
|
|
((memq c byte-constref-ops)
|
|
|
|
|
(car (cdr arg)))
|
|
|
|
|
(t (cdr arg))))
|
|
|
|
|
(setq c (symbol-name c))
|
|
|
|
|
(if (string-match "^byte-." c)
|
|
|
|
|
(setq c (intern (substring c 5)))))
|
|
|
|
|
(if (eq c 'constant) (setq c 'const))
|
|
|
|
|
(if (and (eq (cdr arg) 0)
|
|
|
|
|
(not (memq c '(unbind call const))))
|
|
|
|
|
c
|
|
|
|
|
(format "(%s %s)" c a))))
|
|
|
|
|
args)))))
|
|
|
|
|
|
|
|
|
|
(defmacro byte-compile-log-lap (format-string &rest args)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
`(and (memq byte-optimize-log '(t byte))
|
|
|
|
|
(byte-compile-log-lap-1 ,format-string ,@args)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; byte-compile optimizers to support inlining
|
|
|
|
|
|
|
|
|
|
(put 'inline 'byte-optimizer 'byte-optimize-inline-handler)
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-inline-handler (form)
|
|
|
|
|
"byte-optimize-handler for the `inline' special-form."
|
|
|
|
|
(cons 'progn
|
|
|
|
|
(mapcar
|
2000-06-12 05:06:37 +00:00
|
|
|
|
(lambda (sexp)
|
2004-11-14 06:19:52 +00:00
|
|
|
|
(let ((f (car-safe sexp)))
|
|
|
|
|
(if (and (symbolp f)
|
|
|
|
|
(or (cdr (assq f byte-compile-function-environment))
|
|
|
|
|
(not (or (not (fboundp f))
|
|
|
|
|
(cdr (assq f byte-compile-macro-environment))
|
|
|
|
|
(and (consp (setq f (symbol-function f)))
|
|
|
|
|
(eq (car f) 'macro))
|
|
|
|
|
(subrp f)))))
|
|
|
|
|
(byte-compile-inline-expand sexp)
|
|
|
|
|
sexp)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(cdr form))))
|
|
|
|
|
|
|
|
|
|
(defun byte-compile-inline-expand (form)
|
|
|
|
|
(let* ((name (car form))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(localfn (cdr (assq name byte-compile-function-environment)))
|
2014-01-06 18:34:05 -05:00
|
|
|
|
(fn (or localfn (symbol-function name))))
|
2012-07-25 21:27:33 -04:00
|
|
|
|
(when (autoloadp fn)
|
|
|
|
|
(autoload-do-load fn)
|
2014-01-06 18:34:05 -05:00
|
|
|
|
(setq fn (or (symbol-function name)
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(cdr (assq name byte-compile-function-environment)))))
|
|
|
|
|
(pcase fn
|
|
|
|
|
(`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
|
|
|
|
(byte-compile-warn "attempt to inline `%s' before it was defined"
|
2011-03-16 16:08:39 -04:00
|
|
|
|
name)
|
|
|
|
|
form)
|
|
|
|
|
(`(autoload . ,_)
|
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 "File `%s' didn't define `%s'" (nth 1 fn) name))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
((and (pred symbolp) (guard (not (eq fn t)))) ;A function alias.
|
|
|
|
|
(byte-compile-inline-expand (cons fn (cdr form))))
|
2011-03-22 20:53:36 -04:00
|
|
|
|
((pred byte-code-function-p)
|
|
|
|
|
;; (message "Inlining byte-code for %S!" name)
|
|
|
|
|
;; The byte-code will be really inlined in byte-compile-unfold-bcf.
|
|
|
|
|
`(,fn ,@(cdr form)))
|
2012-06-27 23:31:27 -04:00
|
|
|
|
((or `(lambda . ,_) `(closure . ,_))
|
2011-03-22 20:53:36 -04:00
|
|
|
|
(if (not (or (eq fn localfn) ;From the same file => same mode.
|
2012-06-27 23:31:27 -04:00
|
|
|
|
(eq (car fn) ;Same mode.
|
|
|
|
|
(if lexical-binding 'closure 'lambda))))
|
2011-03-22 20:53:36 -04:00
|
|
|
|
;; While byte-compile-unfold-bcf can inline dynbind byte-code into
|
|
|
|
|
;; letbind byte-code (or any other combination for that matter), we
|
|
|
|
|
;; can only inline dynbind source into dynbind source or letbind
|
|
|
|
|
;; source into letbind source.
|
2012-06-27 23:31:27 -04:00
|
|
|
|
(progn
|
|
|
|
|
;; We can of course byte-compile the inlined function
|
|
|
|
|
;; first, and then inline its byte-code.
|
|
|
|
|
(byte-compile name)
|
|
|
|
|
`(,(symbol-function name) ,@(cdr form)))
|
|
|
|
|
(let ((newfn (if (eq fn localfn)
|
|
|
|
|
;; If `fn' is from the same file, it has already
|
|
|
|
|
;; been preprocessed!
|
|
|
|
|
`(function ,fn)
|
|
|
|
|
(byte-compile-preprocess
|
2012-07-02 01:00:05 -07:00
|
|
|
|
(byte-compile--reify-function fn)))))
|
2012-06-27 23:31:27 -04:00
|
|
|
|
(if (eq (car-safe newfn) 'function)
|
|
|
|
|
(byte-compile-unfold-lambda `(,(cadr newfn) ,@(cdr form)))
|
2013-06-13 22:31:28 -04:00
|
|
|
|
;; This can happen because of macroexp-warn-and-return &co.
|
2012-06-27 23:31:27 -04:00
|
|
|
|
(byte-compile-log-warning
|
|
|
|
|
(format "Inlining closure %S failed" name))
|
|
|
|
|
form))))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
|
2015-06-16 20:04:35 -04:00
|
|
|
|
(_ ;; Give up on inlining.
|
2011-03-16 16:08:39 -04:00
|
|
|
|
form))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; ((lambda ...) ...)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(defun byte-compile-unfold-lambda (form &optional name)
|
2011-03-01 00:03:24 -05:00
|
|
|
|
;; In lexical-binding mode, let and functions don't bind vars in the same way
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
;; (let obey special-variable-p, but functions don't). But luckily, this
|
|
|
|
|
;; doesn't matter here, because function's behavior is underspecified so it
|
|
|
|
|
;; can safely be turned into a `let', even though the reverse is not true.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(or name (setq name "anonymous lambda"))
|
2015-03-06 23:35:04 -05:00
|
|
|
|
(let* ((lambda (car form))
|
|
|
|
|
(values (cdr form))
|
|
|
|
|
(arglist (nth 1 lambda))
|
|
|
|
|
(body (cdr (cdr lambda)))
|
|
|
|
|
optionalp restp
|
|
|
|
|
bindings)
|
|
|
|
|
(if (and (stringp (car body)) (cdr body))
|
|
|
|
|
(setq body (cdr body)))
|
|
|
|
|
(if (and (consp (car body)) (eq 'interactive (car (car body))))
|
|
|
|
|
(setq body (cdr body)))
|
|
|
|
|
;; FIXME: The checks below do not belong in an optimization phase.
|
|
|
|
|
(while arglist
|
|
|
|
|
(cond ((eq (car arglist) '&optional)
|
|
|
|
|
;; ok, I'll let this slide because funcall_lambda() does...
|
|
|
|
|
;; (if optionalp (error "multiple &optional keywords in %s" name))
|
|
|
|
|
(if restp (error "&optional found after &rest in %s" name))
|
|
|
|
|
(if (null (cdr arglist))
|
|
|
|
|
(error "nothing after &optional in %s" name))
|
|
|
|
|
(setq optionalp t))
|
|
|
|
|
((eq (car arglist) '&rest)
|
|
|
|
|
;; ...but it is by no stretch of the imagination a reasonable
|
|
|
|
|
;; thing that funcall_lambda() allows (&rest x y) and
|
|
|
|
|
;; (&rest x &optional y) in arglists.
|
|
|
|
|
(if (null (cdr arglist))
|
|
|
|
|
(error "nothing after &rest in %s" name))
|
|
|
|
|
(if (cdr (cdr arglist))
|
|
|
|
|
(error "multiple vars after &rest in %s" name))
|
|
|
|
|
(setq restp t))
|
|
|
|
|
(restp
|
|
|
|
|
(setq bindings (cons (list (car arglist)
|
|
|
|
|
(and values (cons 'list values)))
|
|
|
|
|
bindings)
|
|
|
|
|
values nil))
|
|
|
|
|
((and (not optionalp) (null values))
|
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
|
|
|
|
(byte-compile-warn "attempt to open-code `%s' with too few arguments" name)
|
2015-03-06 23:35:04 -05:00
|
|
|
|
(setq arglist nil values 'too-few))
|
|
|
|
|
(t
|
|
|
|
|
(setq bindings (cons (list (car arglist) (car values))
|
|
|
|
|
bindings)
|
|
|
|
|
values (cdr values))))
|
|
|
|
|
(setq arglist (cdr arglist)))
|
|
|
|
|
(if values
|
|
|
|
|
(progn
|
|
|
|
|
(or (eq values 'too-few)
|
|
|
|
|
(byte-compile-warn
|
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
|
|
|
|
"attempt to open-code `%s' with too many arguments" name))
|
2015-03-06 23:35:04 -05:00
|
|
|
|
form)
|
|
|
|
|
|
|
|
|
|
;; The following leads to infinite recursion when loading a
|
|
|
|
|
;; file containing `(defsubst f () (f))', and then trying to
|
|
|
|
|
;; byte-compile that file.
|
|
|
|
|
;(setq body (mapcar 'byte-optimize-form body)))
|
|
|
|
|
|
|
|
|
|
(let ((newform
|
|
|
|
|
(if bindings
|
|
|
|
|
(cons 'let (cons (nreverse bindings) body))
|
|
|
|
|
(cons 'progn body))))
|
|
|
|
|
(byte-compile-log " %s\t==>\t%s" form newform)
|
|
|
|
|
newform))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; implementing source-level optimizers
|
|
|
|
|
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
(defun byte-optimize-form-code-walker (form for-effect)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
|
|
|
|
;; For normal function calls, We can just mapcar the optimizer the cdr. But
|
|
|
|
|
;; we need to have special knowledge of the syntax of the special forms
|
|
|
|
|
;; like let and defun (that's why they're special forms :-). (Actually,
|
|
|
|
|
;; the important aspect is that they are subrs that don't evaluate all of
|
|
|
|
|
;; their args.)
|
|
|
|
|
;;
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
(let ((fn (car-safe form))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
tmp)
|
|
|
|
|
(cond ((not (consp form))
|
|
|
|
|
(if (not (and for-effect
|
|
|
|
|
(or byte-compile-delete-errors
|
|
|
|
|
(not (symbolp form))
|
|
|
|
|
(eq form t))))
|
|
|
|
|
form))
|
|
|
|
|
((eq fn 'quote)
|
|
|
|
|
(if (cdr (cdr form))
|
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
|
|
|
|
(byte-compile-warn "malformed quote form: `%s'"
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(prin1-to-string form)))
|
|
|
|
|
;; map (quote nil) to nil to simplify optimizer logic.
|
|
|
|
|
;; map quoted constants to nil if for-effect (just because).
|
|
|
|
|
(and (nth 1 form)
|
|
|
|
|
(not for-effect)
|
|
|
|
|
form))
|
2015-03-06 23:35:04 -05:00
|
|
|
|
((eq (car-safe fn) 'lambda)
|
2010-09-27 19:14:58 +02:00
|
|
|
|
(let ((newform (byte-compile-unfold-lambda form)))
|
|
|
|
|
(if (eq newform form)
|
2010-10-13 01:25:19 +02:00
|
|
|
|
;; Some error occurred, avoid infinite recursion
|
2010-09-27 19:14:58 +02:00
|
|
|
|
form
|
|
|
|
|
(byte-optimize-form-code-walker newform for-effect))))
|
2015-03-06 23:35:04 -05:00
|
|
|
|
((eq (car-safe fn) 'closure) form)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
((memq fn '(let let*))
|
|
|
|
|
;; recursively enter the optimizer for the bindings and body
|
|
|
|
|
;; of a let or let*. This for depth-firstness: forms that
|
|
|
|
|
;; are more deeply nested are optimized first.
|
|
|
|
|
(cons fn
|
|
|
|
|
(cons
|
2000-06-12 05:06:37 +00:00
|
|
|
|
(mapcar (lambda (binding)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(if (symbolp binding)
|
|
|
|
|
binding
|
|
|
|
|
(if (cdr (cdr binding))
|
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
|
|
|
|
(byte-compile-warn "malformed let binding: `%s'"
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(prin1-to-string binding)))
|
|
|
|
|
(list (car binding)
|
|
|
|
|
(byte-optimize-form (nth 1 binding) nil))))
|
|
|
|
|
(nth 1 form))
|
|
|
|
|
(byte-optimize-body (cdr (cdr form)) for-effect))))
|
|
|
|
|
((eq fn 'cond)
|
|
|
|
|
(cons fn
|
2000-06-12 05:06:37 +00:00
|
|
|
|
(mapcar (lambda (clause)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(if (consp clause)
|
|
|
|
|
(cons
|
|
|
|
|
(byte-optimize-form (car clause) nil)
|
|
|
|
|
(byte-optimize-body (cdr clause) for-effect))
|
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
|
|
|
|
(byte-compile-warn "malformed cond form: `%s'"
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(prin1-to-string clause))
|
|
|
|
|
clause))
|
|
|
|
|
(cdr form))))
|
|
|
|
|
((eq fn 'progn)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
;; As an extra added bonus, this simplifies (progn <x>) --> <x>.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(if (cdr (cdr form))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(macroexp-progn (byte-optimize-body (cdr form) for-effect))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-optimize-form (nth 1 form) for-effect)))
|
|
|
|
|
((eq fn 'prog1)
|
|
|
|
|
(if (cdr (cdr form))
|
|
|
|
|
(cons 'prog1
|
|
|
|
|
(cons (byte-optimize-form (nth 1 form) for-effect)
|
|
|
|
|
(byte-optimize-body (cdr (cdr form)) t)))
|
|
|
|
|
(byte-optimize-form (nth 1 form) for-effect)))
|
|
|
|
|
((eq fn 'prog2)
|
|
|
|
|
(cons 'prog2
|
|
|
|
|
(cons (byte-optimize-form (nth 1 form) t)
|
|
|
|
|
(cons (byte-optimize-form (nth 2 form) for-effect)
|
|
|
|
|
(byte-optimize-body (cdr (cdr (cdr form))) t)))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1996-09-22 04:38:36 +00:00
|
|
|
|
((memq fn '(save-excursion save-restriction save-current-buffer))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;; those subrs which have an implicit progn; it's not quite good
|
|
|
|
|
;; enough to treat these like normal function calls.
|
|
|
|
|
;; This can turn (save-excursion ...) into (save-excursion) which
|
|
|
|
|
;; will be optimized away in the lap-optimize pass.
|
|
|
|
|
(cons fn (byte-optimize-body (cdr form) for-effect)))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1992-07-10 22:06:47 +00:00
|
|
|
|
((eq fn 'with-output-to-temp-buffer)
|
|
|
|
|
;; this is just like the above, except for the first argument.
|
|
|
|
|
(cons fn
|
|
|
|
|
(cons
|
|
|
|
|
(byte-optimize-form (nth 1 form) nil)
|
|
|
|
|
(byte-optimize-body (cdr (cdr form)) for-effect))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1992-07-10 22:06:47 +00:00
|
|
|
|
((eq fn 'if)
|
2001-03-26 13:04:11 +00:00
|
|
|
|
(when (< (length form) 3)
|
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
|
|
|
|
(byte-compile-warn "too few arguments for `if'"))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(cons fn
|
|
|
|
|
(cons (byte-optimize-form (nth 1 form) nil)
|
|
|
|
|
(cons
|
|
|
|
|
(byte-optimize-form (nth 2 form) for-effect)
|
|
|
|
|
(byte-optimize-body (nthcdr 3 form) for-effect)))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
((memq fn '(and or)) ; Remember, and/or are control structures.
|
|
|
|
|
;; Take forms off the back until we can't any more.
|
1993-06-09 11:59:12 +00:00
|
|
|
|
;; In the future it could conceivably be a problem that the
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;; subexpressions of these forms are optimized in the reverse
|
|
|
|
|
;; order, but it's ok for now.
|
|
|
|
|
(if for-effect
|
|
|
|
|
(let ((backwards (reverse (cdr form))))
|
|
|
|
|
(while (and backwards
|
|
|
|
|
(null (setcar backwards
|
|
|
|
|
(byte-optimize-form (car backwards)
|
|
|
|
|
for-effect))))
|
|
|
|
|
(setq backwards (cdr backwards)))
|
|
|
|
|
(if (and (cdr form) (null backwards))
|
|
|
|
|
(byte-compile-log
|
|
|
|
|
" all subforms of %s called for effect; deleted" form))
|
|
|
|
|
(and backwards
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
(cons fn (nreverse (mapcar 'byte-optimize-form
|
|
|
|
|
backwards)))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(cons fn (mapcar 'byte-optimize-form (cdr form)))))
|
|
|
|
|
|
|
|
|
|
((eq fn 'interactive)
|
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
|
|
|
|
(byte-compile-warn "misplaced interactive spec: `%s'"
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(prin1-to-string form))
|
|
|
|
|
nil)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
Introduce new bytecodes for efficient catch/condition-case in lexbind.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Optimize under `condition-case' and `catch' if
byte-compile--use-old-handlers is nil.
(disassemble-offset): Handle new bytecodes.
* lisp/emacs-lisp/bytecomp.el (byte-pushcatch, byte-pushconditioncase)
(byte-pophandler): New byte codes.
(byte-goto-ops): Adjust accordingly.
(byte-compile--use-old-handlers): New var.
(byte-compile-catch): Use new byte codes depending on
byte-compile--use-old-handlers.
(byte-compile-condition-case--old): Rename from
byte-compile-condition-case.
(byte-compile-condition-case--new): New function.
(byte-compile-condition-case): New function that dispatches depending
on byte-compile--use-old-handlers.
(byte-compile-unwind-protect): Pass a function to byte-unwind-protect
when we can.
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form): Adjust for
the new compilation scheme using the new byte-codes.
* src/alloc.c (Fgarbage_collect): Merge scans of handlerlist and catchlist,
and make them unconditional now that they're heap-allocated.
* src/bytecode.c (BYTE_CODES): Add Bpushcatch, Bpushconditioncase
and Bpophandler.
(bcall0): New function.
(exec_byte_code): Add corresponding cases. Improve error message when
encountering an invalid byte-code. Let Bunwind_protect accept
a function (rather than a list of expressions) as argument.
* src/eval.c (catchlist): Remove (merge with handlerlist).
(handlerlist, lisp_eval_depth): Not static any more.
(internal_catch, internal_condition_case, internal_condition_case_1)
(internal_condition_case_2, internal_condition_case_n):
Use PUSH_HANDLER.
(unwind_to_catch, Fthrow, Fsignal): Adjust to merged
handlerlist/catchlist.
(internal_lisp_condition_case): Use PUSH_HANDLER. Adjust to new
handlerlist which can only handle a single condition-case handler at
a time.
(find_handler_clause): Simplify since we only a single branch here
any more.
* src/lisp.h (struct handler): Merge struct handler and struct catchtag.
(PUSH_HANDLER): New macro.
(catchlist): Remove.
(handlerlist): Always declare.
2013-10-03 00:58:56 -04:00
|
|
|
|
((eq fn 'function)
|
|
|
|
|
;; This forms is compiled as constant or by breaking out
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;; all the subexpressions and compiling them separately.
|
|
|
|
|
form)
|
|
|
|
|
|
Introduce new bytecodes for efficient catch/condition-case in lexbind.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Optimize under `condition-case' and `catch' if
byte-compile--use-old-handlers is nil.
(disassemble-offset): Handle new bytecodes.
* lisp/emacs-lisp/bytecomp.el (byte-pushcatch, byte-pushconditioncase)
(byte-pophandler): New byte codes.
(byte-goto-ops): Adjust accordingly.
(byte-compile--use-old-handlers): New var.
(byte-compile-catch): Use new byte codes depending on
byte-compile--use-old-handlers.
(byte-compile-condition-case--old): Rename from
byte-compile-condition-case.
(byte-compile-condition-case--new): New function.
(byte-compile-condition-case): New function that dispatches depending
on byte-compile--use-old-handlers.
(byte-compile-unwind-protect): Pass a function to byte-unwind-protect
when we can.
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form): Adjust for
the new compilation scheme using the new byte-codes.
* src/alloc.c (Fgarbage_collect): Merge scans of handlerlist and catchlist,
and make them unconditional now that they're heap-allocated.
* src/bytecode.c (BYTE_CODES): Add Bpushcatch, Bpushconditioncase
and Bpophandler.
(bcall0): New function.
(exec_byte_code): Add corresponding cases. Improve error message when
encountering an invalid byte-code. Let Bunwind_protect accept
a function (rather than a list of expressions) as argument.
* src/eval.c (catchlist): Remove (merge with handlerlist).
(handlerlist, lisp_eval_depth): Not static any more.
(internal_catch, internal_condition_case, internal_condition_case_1)
(internal_condition_case_2, internal_condition_case_n):
Use PUSH_HANDLER.
(unwind_to_catch, Fthrow, Fsignal): Adjust to merged
handlerlist/catchlist.
(internal_lisp_condition_case): Use PUSH_HANDLER. Adjust to new
handlerlist which can only handle a single condition-case handler at
a time.
(find_handler_clause): Simplify since we only a single branch here
any more.
* src/lisp.h (struct handler): Merge struct handler and struct catchtag.
(PUSH_HANDLER): New macro.
(catchlist): Remove.
(handlerlist): Always declare.
2013-10-03 00:58:56 -04:00
|
|
|
|
((eq fn 'condition-case)
|
|
|
|
|
(if byte-compile--use-old-handlers
|
|
|
|
|
;; Will be optimized later.
|
|
|
|
|
form
|
|
|
|
|
`(condition-case ,(nth 1 form) ;Not evaluated.
|
|
|
|
|
,(byte-optimize-form (nth 2 form) for-effect)
|
|
|
|
|
,@(mapcar (lambda (clause)
|
|
|
|
|
`(,(car clause)
|
|
|
|
|
,@(byte-optimize-body (cdr clause) for-effect)))
|
|
|
|
|
(nthcdr 3 form)))))
|
|
|
|
|
|
1992-07-10 22:06:47 +00:00
|
|
|
|
((eq fn 'unwind-protect)
|
|
|
|
|
;; the "protected" part of an unwind-protect is compiled (and thus
|
|
|
|
|
;; optimized) as a top-level form, so don't do it here. But the
|
|
|
|
|
;; non-protected part has the same for-effect status as the
|
|
|
|
|
;; unwind-protect itself. (The protected part is always for effect,
|
|
|
|
|
;; but that isn't handled properly yet.)
|
|
|
|
|
(cons fn
|
|
|
|
|
(cons (byte-optimize-form (nth 1 form) for-effect)
|
|
|
|
|
(cdr (cdr form)))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1992-07-10 22:06:47 +00:00
|
|
|
|
((eq fn 'catch)
|
|
|
|
|
(cons fn
|
|
|
|
|
(cons (byte-optimize-form (nth 1 form) nil)
|
Introduce new bytecodes for efficient catch/condition-case in lexbind.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Optimize under `condition-case' and `catch' if
byte-compile--use-old-handlers is nil.
(disassemble-offset): Handle new bytecodes.
* lisp/emacs-lisp/bytecomp.el (byte-pushcatch, byte-pushconditioncase)
(byte-pophandler): New byte codes.
(byte-goto-ops): Adjust accordingly.
(byte-compile--use-old-handlers): New var.
(byte-compile-catch): Use new byte codes depending on
byte-compile--use-old-handlers.
(byte-compile-condition-case--old): Rename from
byte-compile-condition-case.
(byte-compile-condition-case--new): New function.
(byte-compile-condition-case): New function that dispatches depending
on byte-compile--use-old-handlers.
(byte-compile-unwind-protect): Pass a function to byte-unwind-protect
when we can.
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form): Adjust for
the new compilation scheme using the new byte-codes.
* src/alloc.c (Fgarbage_collect): Merge scans of handlerlist and catchlist,
and make them unconditional now that they're heap-allocated.
* src/bytecode.c (BYTE_CODES): Add Bpushcatch, Bpushconditioncase
and Bpophandler.
(bcall0): New function.
(exec_byte_code): Add corresponding cases. Improve error message when
encountering an invalid byte-code. Let Bunwind_protect accept
a function (rather than a list of expressions) as argument.
* src/eval.c (catchlist): Remove (merge with handlerlist).
(handlerlist, lisp_eval_depth): Not static any more.
(internal_catch, internal_condition_case, internal_condition_case_1)
(internal_condition_case_2, internal_condition_case_n):
Use PUSH_HANDLER.
(unwind_to_catch, Fthrow, Fsignal): Adjust to merged
handlerlist/catchlist.
(internal_lisp_condition_case): Use PUSH_HANDLER. Adjust to new
handlerlist which can only handle a single condition-case handler at
a time.
(find_handler_clause): Simplify since we only a single branch here
any more.
* src/lisp.h (struct handler): Merge struct handler and struct catchtag.
(PUSH_HANDLER): New macro.
(catchlist): Remove.
(handlerlist): Always declare.
2013-10-03 00:58:56 -04:00
|
|
|
|
(if byte-compile--use-old-handlers
|
|
|
|
|
;; The body of a catch is compiled (and thus
|
|
|
|
|
;; optimized) as a top-level form, so don't do it
|
|
|
|
|
;; here.
|
|
|
|
|
(cdr (cdr form))
|
|
|
|
|
(byte-optimize-body (cdr form) for-effect)))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
2002-10-14 01:33:40 +00:00
|
|
|
|
((eq fn 'ignore)
|
|
|
|
|
;; Don't treat the args to `ignore' as being
|
|
|
|
|
;; computed for effect. We want to avoid the warnings
|
|
|
|
|
;; that might occur if they were treated that way.
|
|
|
|
|
;; However, don't actually bother calling `ignore'.
|
|
|
|
|
`(prog1 nil . ,(mapcar 'byte-optimize-form (cdr form))))
|
|
|
|
|
|
2011-11-13 22:27:12 -08:00
|
|
|
|
;; Needed as long as we run byte-optimize-form after cconv.
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
((eq fn 'internal-make-closure) form)
|
2011-03-22 20:53:36 -04:00
|
|
|
|
|
|
|
|
|
((byte-code-function-p fn)
|
|
|
|
|
(cons fn (mapcar #'byte-optimize-form (cdr form))))
|
|
|
|
|
|
1992-07-10 22:06:47 +00:00
|
|
|
|
((not (symbolp fn))
|
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
|
|
|
|
(byte-compile-warn "`%s' is a malformed function"
|
2001-12-22 13:36:59 +00:00
|
|
|
|
(prin1-to-string fn))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
form)
|
|
|
|
|
|
|
|
|
|
((and for-effect (setq tmp (get fn 'side-effect-free))
|
|
|
|
|
(or byte-compile-delete-errors
|
|
|
|
|
(eq tmp 'error-free)
|
|
|
|
|
(progn
|
2007-04-05 17:57:05 +00:00
|
|
|
|
(byte-compile-warn "value returned from %s is unused"
|
|
|
|
|
(prin1-to-string form))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
nil)))
|
|
|
|
|
(byte-compile-log " %s called for effect; deleted" fn)
|
|
|
|
|
;; appending a nil here might not be necessary, but it can't hurt.
|
|
|
|
|
(byte-optimize-form
|
|
|
|
|
(cons 'progn (append (cdr form) '(nil))) t))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(t
|
|
|
|
|
;; Otherwise, no args can be considered to be for-effect,
|
|
|
|
|
;; even if the called function is for-effect, because we
|
|
|
|
|
;; don't know anything about that function.
|
2007-04-11 17:10:42 +00:00
|
|
|
|
(let ((args (mapcar #'byte-optimize-form (cdr form))))
|
|
|
|
|
(if (and (get fn 'pure)
|
|
|
|
|
(byte-optimize-all-constp args))
|
|
|
|
|
(list 'quote (apply fn (mapcar #'eval args)))
|
|
|
|
|
(cons fn args)))))))
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-all-constp (list)
|
Fix minor quoting problems in doc strings
These were glitches regardless of how or whether we tackle the
problem of grave accent in doc strings.
* lisp/calc/calc-aent.el (math-restore-placeholders):
* lisp/ido.el (ido-ignore-buffers, ido-ignore-files):
* lisp/leim/quail/cyrillic.el ("bulgarian-alt-phonetic"):
* lisp/leim/quail/hebrew.el ("hebrew-new")
("hebrew-biblical-sil"):
* lisp/leim/quail/thai.el ("thai-kesmanee"):
* lisp/progmodes/idlw-shell.el (idlwave-shell-file-name-chars):
Used curved quotes to avoid ambiguities like ‘`''’ in doc strings.
* lisp/calendar/calendar.el (calendar-month-abbrev-array):
* lisp/cedet/semantic/mru-bookmark.el (semantic-mrub-cache-flush-fcn):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-copy)
(semantic-tag-components):
* lisp/cedet/srecode/cpp.el (srecode-semantic-handle-:cpp):
* lisp/cedet/srecode/texi.el (srecode-texi-texify-docstring):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-all-constp):
* lisp/emacs-lisp/checkdoc.el (checkdoc-message-text-engine):
* lisp/emacs-lisp/generator.el (iter-next):
* lisp/gnus/gnus-art.el (gnus-treat-strip-list-identifiers)
(gnus-article-mode-syntax-table):
* lisp/net/rlogin.el (rlogin-directory-tracking-mode):
* lisp/net/soap-client.el (soap-wsdl-get):
* lisp/net/telnet.el (telnet-mode):
* lisp/org/org-compat.el (org-number-sequence):
* lisp/org/org.el (org-remove-highlights-with-change)
(org-structure-template-alist):
* lisp/org/ox-html.el (org-html-link-org-files-as-html):
* lisp/play/handwrite.el (handwrite-10pt, handwrite-11pt)
(handwrite-12pt, handwrite-13pt):
* lisp/progmodes/f90.el (f90-mode, f90-abbrev-start):
* lisp/progmodes/idlwave.el (idlwave-mode, idlwave-check-abbrev):
* lisp/progmodes/verilog-mode.el (verilog-tool)
(verilog-string-replace-matches, verilog-preprocess)
(verilog-auto-insert-lisp, verilog-auto-insert-last):
* lisp/textmodes/makeinfo.el (makeinfo-options):
* src/font.c (Ffont_spec):
Fix minor quoting problems in doc strings, e.g., missing quote,
``x'' where `x' was meant, etc.
* lisp/erc/erc-backend.el (erc-process-sentinel-2):
Fix minor quoting problem in other string.
* lisp/leim/quail/ethiopic.el ("ethiopic"):
* lisp/term/tvi970.el (tvi970-set-keypad-mode):
Omit unnecessary quotes.
* lisp/faces.el (set-face-attribute, set-face-underline)
(set-face-inverse-video, x-create-frame-with-faces):
* lisp/gnus/gnus-group.el (gnus-group-nnimap-edit-acl):
* lisp/mail/supercite.el (sc-attribs-%@-addresses)
(sc-attribs-!-addresses, sc-attribs-<>-addresses):
* lisp/net/tramp.el (tramp-methods):
* lisp/recentf.el (recentf-show-file-shortcuts-flag):
* lisp/textmodes/artist.el (artist-ellipse-right-char)
(artist-ellipse-left-char, artist-vaporize-fuzziness)
(artist-spray-chars, artist-mode, artist-replace-string)
(artist-put-pixel, artist-text-see-thru):
* lisp/vc/ediff-util.el (ediff-submit-report):
* lisp/vc/log-edit.el (log-edit-changelog-full-paragraphs):
Use double-quotes rather than TeX markup in doc strings.
* lisp/skeleton.el (skeleton-pair-insert-maybe):
Reword to avoid the need for grave accent and apostrophe.
* lisp/xt-mouse.el (xterm-mouse-tracking-enable-sequence):
Don't use grave and acute accents to quote.
2015-05-19 14:59:15 -07:00
|
|
|
|
"Non-nil if all elements of LIST satisfy `macroexp-const-p'."
|
2007-04-11 17:10:42 +00:00
|
|
|
|
(let ((constant t))
|
|
|
|
|
(while (and list constant)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(unless (macroexp-const-p (car list))
|
2007-04-11 17:10:42 +00:00
|
|
|
|
(setq constant nil))
|
|
|
|
|
(setq list (cdr list)))
|
|
|
|
|
constant))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
(defun byte-optimize-form (form &optional for-effect)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
"The source-level pass of the optimizer."
|
|
|
|
|
;;
|
|
|
|
|
;; First, optimize all sub-forms of this one.
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
(setq form (byte-optimize-form-code-walker form for-effect))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
|
|
|
|
;; after optimizing all subforms, optimize this form until it doesn't
|
|
|
|
|
;; optimize any further. This means that some forms will be passed through
|
|
|
|
|
;; the optimizer many times, but that's necessary to make the for-effect
|
|
|
|
|
;; processing do as much as possible.
|
|
|
|
|
;;
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
(let (opt new)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(if (and (consp form)
|
|
|
|
|
(symbolp (car form))
|
2012-07-25 21:27:33 -04:00
|
|
|
|
(or ;; (and for-effect
|
|
|
|
|
;; ;; We don't have any of these yet, but we might.
|
|
|
|
|
;; (setq opt (get (car form)
|
|
|
|
|
;; 'byte-for-effect-optimizer)))
|
|
|
|
|
(setq opt (function-get (car form) 'byte-optimizer)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(not (eq form (setq new (funcall opt form)))))
|
|
|
|
|
(progn
|
|
|
|
|
;; (if (equal form new) (error "bogus optimizer -- %s" opt))
|
|
|
|
|
(byte-compile-log " %s\t==>\t%s" form new)
|
|
|
|
|
(setq new (byte-optimize-form new for-effect))
|
|
|
|
|
new)
|
|
|
|
|
form)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-body (forms all-for-effect)
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
;; Optimize the cdr of a progn or implicit progn; all forms is a list of
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;; forms, all but the last of which are optimized with the assumption that
|
|
|
|
|
;; they are being called for effect. the last is for-effect as well if
|
|
|
|
|
;; all-for-effect is true. returns a new list of forms.
|
|
|
|
|
(let ((rest forms)
|
|
|
|
|
(result nil)
|
|
|
|
|
fe new)
|
|
|
|
|
(while rest
|
|
|
|
|
(setq fe (or all-for-effect (cdr rest)))
|
|
|
|
|
(setq new (and (car rest) (byte-optimize-form (car rest) fe)))
|
|
|
|
|
(if (or new (not fe))
|
|
|
|
|
(setq result (cons new result)))
|
|
|
|
|
(setq rest (cdr rest)))
|
|
|
|
|
(nreverse result)))
|
|
|
|
|
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; some source-level optimizers
|
|
|
|
|
;;
|
|
|
|
|
;; when writing optimizers, be VERY careful that the optimizer returns
|
|
|
|
|
;; something not EQ to its argument if and ONLY if it has made a change.
|
|
|
|
|
;; This implies that you cannot simply destructively modify the list;
|
|
|
|
|
;; you must return something not EQ to it if you make an optimization.
|
|
|
|
|
;;
|
|
|
|
|
;; It is now safe to optimize code such that it introduces new bindings.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
2007-11-13 16:10:14 +00:00
|
|
|
|
(defsubst byte-compile-trueconstp (form)
|
|
|
|
|
"Return non-nil if FORM always evaluates to a non-nil value."
|
2008-03-03 21:07:12 +00:00
|
|
|
|
(while (eq (car-safe form) 'progn)
|
|
|
|
|
(setq form (car (last (cdr form)))))
|
2007-11-13 16:10:14 +00:00
|
|
|
|
(cond ((consp form)
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 07:51:54 -04:00
|
|
|
|
(pcase (car form)
|
|
|
|
|
(`quote (cadr form))
|
2008-03-03 21:07:12 +00:00
|
|
|
|
;; Can't use recursion in a defsubst.
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 07:51:54 -04:00
|
|
|
|
;; (`progn (byte-compile-trueconstp (car (last (cdr form)))))
|
2008-03-03 21:07:12 +00:00
|
|
|
|
))
|
2007-11-13 16:10:14 +00:00
|
|
|
|
((not (symbolp form)))
|
|
|
|
|
((eq form t))
|
|
|
|
|
((keywordp form))))
|
|
|
|
|
|
|
|
|
|
(defsubst byte-compile-nilconstp (form)
|
|
|
|
|
"Return non-nil if FORM always evaluates to a nil value."
|
2008-03-03 21:07:12 +00:00
|
|
|
|
(while (eq (car-safe form) 'progn)
|
|
|
|
|
(setq form (car (last (cdr form)))))
|
2007-11-13 16:10:14 +00:00
|
|
|
|
(cond ((consp form)
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 07:51:54 -04:00
|
|
|
|
(pcase (car form)
|
|
|
|
|
(`quote (null (cadr form)))
|
2008-03-03 21:07:12 +00:00
|
|
|
|
;; Can't use recursion in a defsubst.
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 07:51:54 -04:00
|
|
|
|
;; (`progn (byte-compile-nilconstp (car (last (cdr form)))))
|
2008-03-03 21:07:12 +00:00
|
|
|
|
))
|
2007-11-13 16:10:14 +00:00
|
|
|
|
((not (symbolp form)) nil)
|
|
|
|
|
((null form))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
1992-07-14 02:11:50 +00:00
|
|
|
|
;; If the function is being called with constant numeric args,
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; evaluate as much as possible at compile-time. This optimizer
|
1992-07-14 02:11:50 +00:00
|
|
|
|
;; assumes that the function is associative, like + or *.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(defun byte-optimize-associative-math (form)
|
|
|
|
|
(let ((args nil)
|
|
|
|
|
(constants nil)
|
|
|
|
|
(rest (cdr form)))
|
|
|
|
|
(while rest
|
|
|
|
|
(if (numberp (car rest))
|
|
|
|
|
(setq constants (cons (car rest) constants))
|
|
|
|
|
(setq args (cons (car rest) args)))
|
|
|
|
|
(setq rest (cdr rest)))
|
|
|
|
|
(if (cdr constants)
|
|
|
|
|
(if args
|
|
|
|
|
(list (car form)
|
|
|
|
|
(apply (car form) constants)
|
|
|
|
|
(if (cdr args)
|
|
|
|
|
(cons (car form) (nreverse args))
|
|
|
|
|
(car args)))
|
|
|
|
|
(apply (car form) constants))
|
|
|
|
|
form)))
|
|
|
|
|
|
1992-07-14 02:11:50 +00:00
|
|
|
|
;; If the function is being called with constant numeric args,
|
1995-07-17 22:44:06 +00:00
|
|
|
|
;; evaluate as much as possible at compile-time. This optimizer
|
|
|
|
|
;; assumes that the function satisfies
|
|
|
|
|
;; (op x1 x2 ... xn) == (op ...(op (op x1 x2) x3) ...xn)
|
|
|
|
|
;; like - and /.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(defun byte-optimize-nonassociative-math (form)
|
|
|
|
|
(if (or (not (numberp (car (cdr form))))
|
|
|
|
|
(not (numberp (car (cdr (cdr form))))))
|
|
|
|
|
form
|
|
|
|
|
(let ((constant (car (cdr form)))
|
|
|
|
|
(rest (cdr (cdr form))))
|
|
|
|
|
(while (numberp (car rest))
|
|
|
|
|
(setq constant (funcall (car form) constant (car rest))
|
|
|
|
|
rest (cdr rest)))
|
|
|
|
|
(if rest
|
|
|
|
|
(cons (car form) (cons constant rest))
|
|
|
|
|
constant))))
|
|
|
|
|
|
|
|
|
|
;;(defun byte-optimize-associative-two-args-math (form)
|
|
|
|
|
;; (setq form (byte-optimize-associative-math form))
|
|
|
|
|
;; (if (consp form)
|
|
|
|
|
;; (byte-optimize-two-args-left form)
|
|
|
|
|
;; form))
|
|
|
|
|
|
|
|
|
|
;;(defun byte-optimize-nonassociative-two-args-math (form)
|
|
|
|
|
;; (setq form (byte-optimize-nonassociative-math form))
|
|
|
|
|
;; (if (consp form)
|
|
|
|
|
;; (byte-optimize-two-args-right form)
|
|
|
|
|
;; form))
|
|
|
|
|
|
1995-07-17 22:44:06 +00:00
|
|
|
|
(defun byte-optimize-approx-equal (x y)
|
1997-05-06 03:53:10 +00:00
|
|
|
|
(<= (* (abs (- x y)) 100) (abs (+ x y))))
|
1995-07-17 22:44:06 +00:00
|
|
|
|
|
|
|
|
|
;; Collect all the constants from FORM, after the STARTth arg,
|
|
|
|
|
;; and apply FUN to them to make one argument at the end.
|
|
|
|
|
;; For functions that can handle floats, that optimization
|
|
|
|
|
;; can be incorrect because reordering can cause an overflow
|
|
|
|
|
;; that would otherwise be avoided by encountering an arg that is a float.
|
|
|
|
|
;; We avoid this problem by (1) not moving float constants and
|
|
|
|
|
;; (2) not moving anything if it would cause an overflow.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(defun byte-optimize-delay-constants-math (form start fun)
|
|
|
|
|
;; Merge all FORM's constants from number START, call FUN on them
|
|
|
|
|
;; and put the result at the end.
|
1995-07-17 22:44:06 +00:00
|
|
|
|
(let ((rest (nthcdr (1- start) form))
|
|
|
|
|
(orig form)
|
|
|
|
|
;; t means we must check for overflow.
|
|
|
|
|
(overflow (memq fun '(+ *))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(while (cdr (setq rest (cdr rest)))
|
1995-07-17 22:44:06 +00:00
|
|
|
|
(if (integerp (car rest))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(let (constants)
|
|
|
|
|
(setq form (copy-sequence form)
|
|
|
|
|
rest (nthcdr (1- start) form))
|
|
|
|
|
(while (setq rest (cdr rest))
|
1995-07-17 22:44:06 +00:00
|
|
|
|
(cond ((integerp (car rest))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(setq constants (cons (car rest) constants))
|
|
|
|
|
(setcar rest nil))))
|
1995-07-17 22:44:06 +00:00
|
|
|
|
;; If necessary, check now for overflow
|
|
|
|
|
;; that might be caused by reordering.
|
|
|
|
|
(if (and overflow
|
|
|
|
|
;; We have overflow if the result of doing the arithmetic
|
|
|
|
|
;; on floats is not even close to the result
|
|
|
|
|
;; of doing it on integers.
|
|
|
|
|
(not (byte-optimize-approx-equal
|
|
|
|
|
(apply fun (mapcar 'float constants))
|
|
|
|
|
(float (apply fun constants)))))
|
|
|
|
|
(setq form orig)
|
|
|
|
|
(setq form (nconc (delq nil form)
|
|
|
|
|
(list (apply fun (nreverse constants)))))))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
form))
|
|
|
|
|
|
2008-11-21 18:51:48 +00:00
|
|
|
|
(defsubst byte-compile-butlast (form)
|
|
|
|
|
(nreverse (cdr (reverse form))))
|
|
|
|
|
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(defun byte-optimize-plus (form)
|
2008-11-21 18:51:48 +00:00
|
|
|
|
;; Don't call `byte-optimize-delay-constants-math' (bug#1334).
|
|
|
|
|
;;(setq form (byte-optimize-delay-constants-math form 1 '+))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(if (memq 0 form) (setq form (delq 0 (copy-sequence form))))
|
2008-11-21 18:51:48 +00:00
|
|
|
|
;; For (+ constants...), byte-optimize-predicate does the work.
|
|
|
|
|
(when (memq nil (mapcar 'numberp (cdr form)))
|
|
|
|
|
(cond
|
|
|
|
|
;; (+ x 1) --> (1+ x) and (+ x -1) --> (1- x).
|
|
|
|
|
((and (= (length form) 3)
|
|
|
|
|
(or (memq (nth 1 form) '(1 -1))
|
|
|
|
|
(memq (nth 2 form) '(1 -1))))
|
|
|
|
|
(let (integer other)
|
|
|
|
|
(if (memq (nth 1 form) '(1 -1))
|
|
|
|
|
(setq integer (nth 1 form) other (nth 2 form))
|
|
|
|
|
(setq integer (nth 2 form) other (nth 1 form)))
|
|
|
|
|
(setq form
|
|
|
|
|
(list (if (eq integer 1) '1+ '1-) other))))
|
|
|
|
|
;; Here, we could also do
|
|
|
|
|
;; (+ x y ... 1) --> (1+ (+ x y ...))
|
|
|
|
|
;; (+ x y ... -1) --> (1- (+ x y ...))
|
|
|
|
|
;; The resulting bytecode is smaller, but is it faster? -- cyd
|
|
|
|
|
))
|
|
|
|
|
(byte-optimize-predicate form))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
(defun byte-optimize-minus (form)
|
2008-11-21 18:51:48 +00:00
|
|
|
|
;; Don't call `byte-optimize-delay-constants-math' (bug#1334).
|
|
|
|
|
;;(setq form (byte-optimize-delay-constants-math form 2 '+))
|
|
|
|
|
;; Remove zeros.
|
|
|
|
|
(when (and (nthcdr 3 form)
|
|
|
|
|
(memq 0 (cddr form)))
|
|
|
|
|
(setq form (nconc (list (car form) (cadr form))
|
|
|
|
|
(delq 0 (copy-sequence (cddr form)))))
|
|
|
|
|
;; After the above, we must turn (- x) back into (- x 0)
|
|
|
|
|
(or (cddr form)
|
|
|
|
|
(setq form (nconc form (list 0)))))
|
|
|
|
|
;; For (- constants..), byte-optimize-predicate does the work.
|
|
|
|
|
(when (memq nil (mapcar 'numberp (cdr form)))
|
|
|
|
|
(cond
|
|
|
|
|
;; (- x 1) --> (1- x)
|
|
|
|
|
((equal (nthcdr 2 form) '(1))
|
|
|
|
|
(setq form (list '1- (nth 1 form))))
|
|
|
|
|
;; (- x -1) --> (1+ x)
|
|
|
|
|
((equal (nthcdr 2 form) '(-1))
|
|
|
|
|
(setq form (list '1+ (nth 1 form))))
|
|
|
|
|
;; (- 0 x) --> (- x)
|
|
|
|
|
((and (eq (nth 1 form) 0)
|
|
|
|
|
(= (length form) 3))
|
|
|
|
|
(setq form (list '- (nth 2 form))))
|
|
|
|
|
;; Here, we could also do
|
|
|
|
|
;; (- x y ... 1) --> (1- (- x y ...))
|
|
|
|
|
;; (- x y ... -1) --> (1+ (- x y ...))
|
|
|
|
|
;; The resulting bytecode is smaller, but is it faster? -- cyd
|
|
|
|
|
))
|
|
|
|
|
(byte-optimize-predicate form))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
(defun byte-optimize-multiply (form)
|
|
|
|
|
(setq form (byte-optimize-delay-constants-math form 1 '*))
|
2008-11-21 18:51:48 +00:00
|
|
|
|
;; For (* constants..), byte-optimize-predicate does the work.
|
|
|
|
|
(when (memq nil (mapcar 'numberp (cdr form)))
|
|
|
|
|
;; After `byte-optimize-predicate', if there is a INTEGER constant
|
|
|
|
|
;; in FORM, it is in the last element.
|
|
|
|
|
(let ((last (car (reverse (cdr form)))))
|
|
|
|
|
(cond
|
|
|
|
|
;; Would handling (* ... 0) here cause floating point errors?
|
|
|
|
|
;; See bug#1334.
|
|
|
|
|
((eq 1 last) (setq form (byte-compile-butlast form)))
|
|
|
|
|
((eq -1 last)
|
|
|
|
|
(setq form (list '- (if (nthcdr 3 form)
|
|
|
|
|
(byte-compile-butlast form)
|
|
|
|
|
(nth 1 form))))))))
|
|
|
|
|
(byte-optimize-predicate form))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
(defun byte-optimize-divide (form)
|
|
|
|
|
(setq form (byte-optimize-delay-constants-math form 2 '*))
|
2008-11-21 18:51:48 +00:00
|
|
|
|
;; After `byte-optimize-predicate', if there is a INTEGER constant
|
|
|
|
|
;; in FORM, it is in the last element.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(let ((last (car (reverse (cdr (cdr form))))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(cond
|
2008-11-21 18:51:48 +00:00
|
|
|
|
;; Runtime error (leave it intact).
|
|
|
|
|
((or (null last)
|
|
|
|
|
(eq last 0)
|
|
|
|
|
(memql 0.0 (cddr form))))
|
|
|
|
|
;; No constants in expression
|
|
|
|
|
((not (numberp last)))
|
|
|
|
|
;; For (* constants..), byte-optimize-predicate does the work.
|
|
|
|
|
((null (memq nil (mapcar 'numberp (cdr form)))))
|
|
|
|
|
;; (/ x y.. 1) --> (/ x y..)
|
|
|
|
|
((and (eq last 1) (nthcdr 3 form))
|
|
|
|
|
(setq form (byte-compile-butlast form)))
|
|
|
|
|
;; (/ x -1), (/ x .. -1) --> (- x), (- (/ x ..))
|
|
|
|
|
((eq last -1)
|
|
|
|
|
(setq form (list '- (if (nthcdr 3 form)
|
|
|
|
|
(byte-compile-butlast form)
|
|
|
|
|
(nth 1 form)))))))
|
|
|
|
|
(byte-optimize-predicate form))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
(defun byte-optimize-logmumble (form)
|
|
|
|
|
(setq form (byte-optimize-delay-constants-math form 1 (car form)))
|
|
|
|
|
(byte-optimize-predicate
|
|
|
|
|
(cond ((memq 0 form)
|
|
|
|
|
(setq form (if (eq (car form) 'logand)
|
|
|
|
|
(cons 'progn (cdr form))
|
|
|
|
|
(delq 0 (copy-sequence form)))))
|
|
|
|
|
((and (eq (car-safe form) 'logior)
|
|
|
|
|
(memq -1 form))
|
1995-07-17 22:44:06 +00:00
|
|
|
|
(cons 'progn (cdr form)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(form))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-binary-predicate (form)
|
2014-05-27 10:56:03 -04:00
|
|
|
|
(cond
|
|
|
|
|
((or (not (macroexp-const-p (nth 1 form)))
|
|
|
|
|
(nthcdr 3 form)) ;; In case there are more than 2 args.
|
|
|
|
|
form)
|
|
|
|
|
((macroexp-const-p (nth 2 form))
|
|
|
|
|
(condition-case ()
|
|
|
|
|
(list 'quote (eval form))
|
|
|
|
|
(error form)))
|
|
|
|
|
(t ;; This can enable some lapcode optimizations.
|
|
|
|
|
(list (car form) (nth 2 form) (nth 1 form)))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
(defun byte-optimize-predicate (form)
|
|
|
|
|
(let ((ok t)
|
|
|
|
|
(rest (cdr form)))
|
|
|
|
|
(while (and rest ok)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(setq ok (macroexp-const-p (car rest))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
rest (cdr rest)))
|
|
|
|
|
(if ok
|
|
|
|
|
(condition-case ()
|
|
|
|
|
(list 'quote (eval form))
|
|
|
|
|
(error form))
|
|
|
|
|
form)))
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-identity (form)
|
|
|
|
|
(if (and (cdr form) (null (cdr (cdr form))))
|
|
|
|
|
(nth 1 form)
|
2001-10-11 12:57:53 +00:00
|
|
|
|
(byte-compile-warn "identity called with %d arg%s, but requires 1"
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(length (cdr form))
|
|
|
|
|
(if (= 1 (length (cdr form))) "" "s"))
|
|
|
|
|
form))
|
|
|
|
|
|
|
|
|
|
(put 'identity 'byte-optimizer 'byte-optimize-identity)
|
|
|
|
|
|
|
|
|
|
(put '+ 'byte-optimizer 'byte-optimize-plus)
|
|
|
|
|
(put '* 'byte-optimizer 'byte-optimize-multiply)
|
|
|
|
|
(put '- 'byte-optimizer 'byte-optimize-minus)
|
|
|
|
|
(put '/ 'byte-optimizer 'byte-optimize-divide)
|
|
|
|
|
(put 'max 'byte-optimizer 'byte-optimize-associative-math)
|
|
|
|
|
(put 'min 'byte-optimizer 'byte-optimize-associative-math)
|
|
|
|
|
|
|
|
|
|
(put '= 'byte-optimizer 'byte-optimize-binary-predicate)
|
|
|
|
|
(put 'eq 'byte-optimizer 'byte-optimize-binary-predicate)
|
|
|
|
|
(put 'equal 'byte-optimizer 'byte-optimize-binary-predicate)
|
|
|
|
|
(put 'string= 'byte-optimizer 'byte-optimize-binary-predicate)
|
|
|
|
|
(put 'string-equal 'byte-optimizer 'byte-optimize-binary-predicate)
|
|
|
|
|
|
|
|
|
|
(put '< 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put '> 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put '<= 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put '>= 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put '1+ 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put '1- 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'not 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'null 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'memq 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'consp 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'listp 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'symbolp 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'stringp 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'string< 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'string-lessp 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
|
|
|
|
|
(put 'logand 'byte-optimizer 'byte-optimize-logmumble)
|
|
|
|
|
(put 'logior 'byte-optimizer 'byte-optimize-logmumble)
|
|
|
|
|
(put 'logxor 'byte-optimizer 'byte-optimize-logmumble)
|
|
|
|
|
(put 'lognot 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
|
|
|
|
|
(put 'car 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'cdr 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'car-safe 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
(put 'cdr-safe 'byte-optimizer 'byte-optimize-predicate)
|
|
|
|
|
|
|
|
|
|
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; I'm not convinced that this is necessary. Doesn't the optimizer loop
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;; take care of this? - Jamie
|
|
|
|
|
;; I think this may some times be necessary to reduce ie (quote 5) to 5,
|
1993-06-09 11:59:12 +00:00
|
|
|
|
;; so arithmetic optimizers recognize the numeric constant. - Hallvard
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(put 'quote 'byte-optimizer 'byte-optimize-quote)
|
|
|
|
|
(defun byte-optimize-quote (form)
|
|
|
|
|
(if (or (consp (nth 1 form))
|
|
|
|
|
(and (symbolp (nth 1 form))
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(not (macroexp--const-symbol-p form))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
form
|
|
|
|
|
(nth 1 form)))
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-and (form)
|
|
|
|
|
;; Simplify if less than 2 args.
|
|
|
|
|
;; if there is a literal nil in the args to `and', throw it and following
|
|
|
|
|
;; forms away, and surround the `and' with (progn ... nil).
|
|
|
|
|
(cond ((null (cdr form)))
|
|
|
|
|
((memq nil form)
|
|
|
|
|
(list 'progn
|
|
|
|
|
(byte-optimize-and
|
|
|
|
|
(prog1 (setq form (copy-sequence form))
|
|
|
|
|
(while (nth 1 form)
|
|
|
|
|
(setq form (cdr form)))
|
|
|
|
|
(setcdr form nil)))
|
|
|
|
|
nil))
|
|
|
|
|
((null (cdr (cdr form)))
|
|
|
|
|
(nth 1 form))
|
|
|
|
|
((byte-optimize-predicate form))))
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-or (form)
|
|
|
|
|
;; Throw away nil's, and simplify if less than 2 args.
|
|
|
|
|
;; If there is a literal non-nil constant in the args to `or', throw away all
|
|
|
|
|
;; following forms.
|
|
|
|
|
(if (memq nil form)
|
|
|
|
|
(setq form (delq nil (copy-sequence form))))
|
|
|
|
|
(let ((rest form))
|
|
|
|
|
(while (cdr (setq rest (cdr rest)))
|
|
|
|
|
(if (byte-compile-trueconstp (car rest))
|
|
|
|
|
(setq form (copy-sequence form)
|
|
|
|
|
rest (setcdr (memq (car rest) form) nil))))
|
|
|
|
|
(if (cdr (cdr form))
|
|
|
|
|
(byte-optimize-predicate form)
|
|
|
|
|
(nth 1 form))))
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-cond (form)
|
|
|
|
|
;; if any clauses have a literal nil as their test, throw them away.
|
|
|
|
|
;; if any clause has a literal non-nil constant as its test, throw
|
|
|
|
|
;; away all following clauses.
|
|
|
|
|
(let (rest)
|
|
|
|
|
;; This must be first, to reduce (cond (t ...) (nil)) to (progn t ...)
|
|
|
|
|
(while (setq rest (assq nil (cdr form)))
|
|
|
|
|
(setq form (delq rest (copy-sequence form))))
|
|
|
|
|
(if (memq nil (cdr form))
|
|
|
|
|
(setq form (delq nil (copy-sequence form))))
|
|
|
|
|
(setq rest form)
|
|
|
|
|
(while (setq rest (cdr rest))
|
|
|
|
|
(cond ((byte-compile-trueconstp (car-safe (car rest)))
|
2007-11-13 16:10:14 +00:00
|
|
|
|
;; This branch will always be taken: kill the subsequent ones.
|
|
|
|
|
(cond ((eq rest (cdr form)) ;First branch of `cond'.
|
|
|
|
|
(setq form `(progn ,@(car rest))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
((cdr rest)
|
|
|
|
|
(setq form (copy-sequence form))
|
|
|
|
|
(setcdr (memq (car rest) form) nil)))
|
2007-11-13 16:10:14 +00:00
|
|
|
|
(setq rest nil))
|
|
|
|
|
((and (consp (car rest))
|
|
|
|
|
(byte-compile-nilconstp (caar rest)))
|
|
|
|
|
;; This branch will never be taken: kill its body.
|
|
|
|
|
(setcdr (car rest) nil)))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Turn (cond (( <x> )) ... ) into (or <x> (cond ... ))
|
|
|
|
|
(if (eq 'cond (car-safe form))
|
|
|
|
|
(let ((clauses (cdr form)))
|
|
|
|
|
(if (and (consp (car clauses))
|
|
|
|
|
(null (cdr (car clauses))))
|
|
|
|
|
(list 'or (car (car clauses))
|
|
|
|
|
(byte-optimize-cond
|
|
|
|
|
(cons (car form) (cdr (cdr form)))))
|
|
|
|
|
form))
|
|
|
|
|
form))
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-if (form)
|
2007-08-23 19:56:16 +00:00
|
|
|
|
;; (if (progn <insts> <test>) <rest>) ==> (progn <insts> (if <test> <rest>))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;; (if <true-constant> <then> <else...>) ==> <then>
|
|
|
|
|
;; (if <false-constant> <then> <else...>) ==> (progn <else...>)
|
|
|
|
|
;; (if <test> nil <else...>) ==> (if (not <test>) (progn <else...>))
|
|
|
|
|
;; (if <test> <then> nil) ==> (if <test> <then>)
|
|
|
|
|
(let ((clause (nth 1 form)))
|
2007-08-24 14:39:25 +00:00
|
|
|
|
(cond ((and (eq (car-safe clause) 'progn)
|
|
|
|
|
;; `clause' is a proper list.
|
|
|
|
|
(null (cdr (last clause))))
|
2007-08-23 19:56:16 +00:00
|
|
|
|
(if (null (cddr clause))
|
|
|
|
|
;; A trivial `progn'.
|
|
|
|
|
(byte-optimize-if `(if ,(cadr clause) ,@(nthcdr 2 form)))
|
|
|
|
|
(nconc (butlast clause)
|
|
|
|
|
(list
|
|
|
|
|
(byte-optimize-if
|
|
|
|
|
`(if ,(car (last clause)) ,@(nthcdr 2 form)))))))
|
|
|
|
|
((byte-compile-trueconstp clause)
|
2007-11-13 16:10:14 +00:00
|
|
|
|
`(progn ,clause ,(nth 2 form)))
|
|
|
|
|
((byte-compile-nilconstp clause)
|
|
|
|
|
`(progn ,clause ,@(nthcdr 3 form)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
((nth 2 form)
|
|
|
|
|
(if (equal '(nil) (nthcdr 3 form))
|
|
|
|
|
(list 'if clause (nth 2 form))
|
|
|
|
|
form))
|
|
|
|
|
((or (nth 3 form) (nthcdr 4 form))
|
1995-07-17 22:44:06 +00:00
|
|
|
|
(list 'if
|
|
|
|
|
;; Don't make a double negative;
|
|
|
|
|
;; instead, take away the one that is there.
|
|
|
|
|
(if (and (consp clause) (memq (car clause) '(not null))
|
|
|
|
|
(= (length clause) 2)) ; (not xxxx) or (not (xxxx))
|
|
|
|
|
(nth 1 clause)
|
|
|
|
|
(list 'not clause))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(if (nthcdr 4 form)
|
|
|
|
|
(cons 'progn (nthcdr 3 form))
|
|
|
|
|
(nth 3 form))))
|
|
|
|
|
(t
|
|
|
|
|
(list 'progn clause nil)))))
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-while (form)
|
2001-03-26 13:04:11 +00:00
|
|
|
|
(when (< (length form) 2)
|
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
|
|
|
|
(byte-compile-warn "too few arguments for `while'"))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(if (nth 1 form)
|
|
|
|
|
form))
|
|
|
|
|
|
|
|
|
|
(put 'and 'byte-optimizer 'byte-optimize-and)
|
|
|
|
|
(put 'or 'byte-optimizer 'byte-optimize-or)
|
|
|
|
|
(put 'cond 'byte-optimizer 'byte-optimize-cond)
|
|
|
|
|
(put 'if 'byte-optimizer 'byte-optimize-if)
|
|
|
|
|
(put 'while 'byte-optimizer 'byte-optimize-while)
|
|
|
|
|
|
|
|
|
|
;; byte-compile-negation-optimizer lives in bytecomp.el
|
|
|
|
|
(put '/= 'byte-optimizer 'byte-compile-negation-optimizer)
|
|
|
|
|
(put 'atom 'byte-optimizer 'byte-compile-negation-optimizer)
|
|
|
|
|
(put 'nlistp 'byte-optimizer 'byte-compile-negation-optimizer)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun byte-optimize-funcall (form)
|
2000-06-12 05:06:37 +00:00
|
|
|
|
;; (funcall (lambda ...) ...) ==> ((lambda ...) ...)
|
|
|
|
|
;; (funcall foo ...) ==> (foo ...)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(let ((fn (nth 1 form)))
|
|
|
|
|
(if (memq (car-safe fn) '(quote function))
|
|
|
|
|
(cons (nth 1 fn) (cdr (cdr form)))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
form)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
(defun byte-optimize-apply (form)
|
|
|
|
|
;; If the last arg is a literal constant, turn this into a funcall.
|
|
|
|
|
;; The funcall optimizer can then transform (funcall 'foo ...) -> (foo ...).
|
|
|
|
|
(let ((fn (nth 1 form))
|
|
|
|
|
(last (nth (1- (length form)) form))) ; I think this really is fastest
|
|
|
|
|
(or (if (or (null last)
|
|
|
|
|
(eq (car-safe last) 'quote))
|
|
|
|
|
(if (listp (nth 1 last))
|
|
|
|
|
(let ((butlast (nreverse (cdr (reverse (cdr (cdr form)))))))
|
1992-08-12 12:50:10 +00:00
|
|
|
|
(nconc (list 'funcall fn) butlast
|
2000-06-12 05:06:37 +00:00
|
|
|
|
(mapcar (lambda (x) (list 'quote x)) (nth 1 last))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-warn
|
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
|
|
|
|
"last arg to apply can't be a literal atom: `%s'"
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(prin1-to-string last))
|
|
|
|
|
nil))
|
|
|
|
|
form)))
|
|
|
|
|
|
|
|
|
|
(put 'funcall 'byte-optimizer 'byte-optimize-funcall)
|
|
|
|
|
(put 'apply 'byte-optimizer 'byte-optimize-apply)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(put 'let 'byte-optimizer 'byte-optimize-letX)
|
|
|
|
|
(put 'let* 'byte-optimizer 'byte-optimize-letX)
|
|
|
|
|
(defun byte-optimize-letX (form)
|
|
|
|
|
(cond ((null (nth 1 form))
|
|
|
|
|
;; No bindings
|
|
|
|
|
(cons 'progn (cdr (cdr form))))
|
|
|
|
|
((or (nth 2 form) (nthcdr 3 form))
|
|
|
|
|
form)
|
|
|
|
|
;; The body is nil
|
|
|
|
|
((eq (car form) 'let)
|
1995-04-24 04:21:21 +00:00
|
|
|
|
(append '(progn) (mapcar 'car-safe (mapcar 'cdr-safe (nth 1 form)))
|
|
|
|
|
'(nil)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(t
|
|
|
|
|
(let ((binds (reverse (nth 1 form))))
|
|
|
|
|
(list 'let* (reverse (cdr binds)) (nth 1 (car binds)) nil)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(put 'nth 'byte-optimizer 'byte-optimize-nth)
|
|
|
|
|
(defun byte-optimize-nth (form)
|
2003-01-05 00:28:18 +00:00
|
|
|
|
(if (= (safe-length form) 3)
|
|
|
|
|
(if (memq (nth 1 form) '(0 1))
|
|
|
|
|
(list 'car (if (zerop (nth 1 form))
|
|
|
|
|
(nth 2 form)
|
|
|
|
|
(list 'cdr (nth 2 form))))
|
|
|
|
|
(byte-optimize-predicate form))
|
|
|
|
|
form))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
(put 'nthcdr 'byte-optimizer 'byte-optimize-nthcdr)
|
|
|
|
|
(defun byte-optimize-nthcdr (form)
|
2003-01-05 00:28:18 +00:00
|
|
|
|
(if (= (safe-length form) 3)
|
|
|
|
|
(if (memq (nth 1 form) '(0 1 2))
|
|
|
|
|
(let ((count (nth 1 form)))
|
|
|
|
|
(setq form (nth 2 form))
|
|
|
|
|
(while (>= (setq count (1- count)) 0)
|
|
|
|
|
(setq form (list 'cdr form)))
|
|
|
|
|
form)
|
|
|
|
|
(byte-optimize-predicate form))
|
|
|
|
|
form))
|
1997-11-03 03:58:23 +00:00
|
|
|
|
|
2002-12-12 20:28:32 +00:00
|
|
|
|
;; Fixme: delete-char -> delete-region (byte-coded)
|
|
|
|
|
;; optimize string-as-unibyte, string-as-multibyte, string-make-unibyte,
|
|
|
|
|
;; string-make-multibyte for constant args.
|
|
|
|
|
|
2003-03-25 16:34:00 +00:00
|
|
|
|
(put 'set 'byte-optimizer 'byte-optimize-set)
|
|
|
|
|
(defun byte-optimize-set (form)
|
|
|
|
|
(let ((var (car-safe (cdr-safe form))))
|
|
|
|
|
(cond
|
|
|
|
|
((and (eq (car-safe var) 'quote) (consp (cdr var)))
|
2003-03-25 16:48:43 +00:00
|
|
|
|
`(setq ,(cadr var) ,@(cddr form)))
|
2003-03-25 16:34:00 +00:00
|
|
|
|
((and (eq (car-safe var) 'make-local-variable)
|
|
|
|
|
(eq (car-safe (setq var (car-safe (cdr var)))) 'quote)
|
|
|
|
|
(consp (cdr var)))
|
|
|
|
|
`(progn ,(cadr form) (setq ,(cadr var) ,@(cddr form))))
|
|
|
|
|
(t form))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; enumerating those functions which need not be called if the returned
|
|
|
|
|
;; value is not used. That is, something like
|
|
|
|
|
;; (progn (list (something-with-side-effects) (yow))
|
|
|
|
|
;; (foo))
|
|
|
|
|
;; may safely be turned into
|
|
|
|
|
;; (progn (progn (something-with-side-effects) (yow))
|
|
|
|
|
;; (foo))
|
|
|
|
|
;; Further optimizations will turn (progn (list 1 2 3) 'foo) into 'foo.
|
|
|
|
|
|
|
|
|
|
;; Some of these functions have the side effect of allocating memory
|
|
|
|
|
;; and it would be incorrect to replace two calls with one.
|
|
|
|
|
;; But we don't try to do those kinds of optimizations,
|
|
|
|
|
;; so it is safe to list such functions here.
|
|
|
|
|
;; Some of these functions return values that depend on environment
|
|
|
|
|
;; state, so that constant folding them would be wrong,
|
|
|
|
|
;; but we don't do constant folding based on this list.
|
|
|
|
|
|
|
|
|
|
;; However, at present the only optimization we normally do
|
|
|
|
|
;; is delete calls that need not occur, and we only do that
|
|
|
|
|
;; with the error-free functions.
|
|
|
|
|
|
|
|
|
|
;; I wonder if I missed any :-\)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(let ((side-effect-free-fns
|
1993-12-23 05:00:49 +00:00
|
|
|
|
'(% * + - / /= 1+ 1- < <= = > >= abs acos append aref ash asin atan
|
|
|
|
|
assoc assq
|
|
|
|
|
boundp buffer-file-name buffer-local-variables buffer-modified-p
|
2002-03-31 16:22:58 +00:00
|
|
|
|
buffer-substring byte-code-function-p
|
2000-05-21 17:24:19 +00:00
|
|
|
|
capitalize car-less-than-car car cdr ceiling char-after char-before
|
* emacs-lisp/byte-opt.el (toplevel): Add compare-window-configurations,
frame-first-window, frame-root-window, frame-selected-window,
minibuffer-selected-window, minibuffer-window,
window-absolute-pixel-edges, window-at, window-body-height,
window-body-width, window-display-table, window-combination-limit,
window-frame, window-fringes, window-inside-absolute-pixel-edges,
window-inside-edges, window-inside-pixel-edges, window-left-child,
window-left-column, window-margins, window-next-buffers,
window-next-sibling, window-new-normal, window-new-total,
window-normal-size, window-parameter, window-parameters, window-parent,
window-pixel-edges, window-point, window-prev-buffers,
window-prev-sibling, window-redisplay-end-trigger, window-scroll-bars,
window-start, window-text-height, window-top-child, window-top-line,
window-total-height, window-total-width and window-use-time to the list
of functions without side-effects.
(toplevel): Add window-valid-p to the list of error-free functions
without side-effects.
2012-11-06 11:37:06 +04:00
|
|
|
|
char-equal char-to-string char-width compare-strings
|
|
|
|
|
compare-window-configurations concat coordinates-in-window-p
|
2002-03-31 16:22:58 +00:00
|
|
|
|
copy-alist copy-sequence copy-marker cos count-lines
|
2008-03-25 23:27:11 +00:00
|
|
|
|
decode-char
|
2002-03-31 16:22:58 +00:00
|
|
|
|
decode-time default-boundp default-value documentation downcase
|
2003-09-08 12:53:41 +00:00
|
|
|
|
elt encode-char exp expt encode-time error-message-string
|
2002-03-31 16:22:58 +00:00
|
|
|
|
fboundp fceiling featurep ffloor
|
1992-07-10 22:06:47 +00:00
|
|
|
|
file-directory-p file-exists-p file-locked-p file-name-absolute-p
|
|
|
|
|
file-newer-than-file-p file-readable-p file-symlink-p file-writable-p
|
* emacs-lisp/byte-opt.el (toplevel): Add compare-window-configurations,
frame-first-window, frame-root-window, frame-selected-window,
minibuffer-selected-window, minibuffer-window,
window-absolute-pixel-edges, window-at, window-body-height,
window-body-width, window-display-table, window-combination-limit,
window-frame, window-fringes, window-inside-absolute-pixel-edges,
window-inside-edges, window-inside-pixel-edges, window-left-child,
window-left-column, window-margins, window-next-buffers,
window-next-sibling, window-new-normal, window-new-total,
window-normal-size, window-parameter, window-parameters, window-parent,
window-pixel-edges, window-point, window-prev-buffers,
window-prev-sibling, window-redisplay-end-trigger, window-scroll-bars,
window-start, window-text-height, window-top-child, window-top-line,
window-total-height, window-total-width and window-use-time to the list
of functions without side-effects.
(toplevel): Add window-valid-p to the list of error-free functions
without side-effects.
2012-11-06 11:37:06 +04:00
|
|
|
|
float float-time floor format format-time-string frame-first-window
|
|
|
|
|
frame-root-window frame-selected-window
|
|
|
|
|
frame-visible-p fround ftruncate
|
1999-12-18 17:28:36 +00:00
|
|
|
|
get gethash get-buffer get-buffer-window getenv get-file-buffer
|
|
|
|
|
hash-table-count
|
2002-03-31 16:22:58 +00:00
|
|
|
|
int-to-string intern-soft
|
1999-09-09 20:04:17 +00:00
|
|
|
|
keymap-parent
|
2000-02-23 12:28:09 +00:00
|
|
|
|
length local-variable-if-set-p local-variable-p log log10 logand
|
2003-01-07 18:06:20 +00:00
|
|
|
|
logb logior lognot logxor lsh langinfo
|
* emacs-lisp/byte-opt.el (toplevel): Add compare-window-configurations,
frame-first-window, frame-root-window, frame-selected-window,
minibuffer-selected-window, minibuffer-window,
window-absolute-pixel-edges, window-at, window-body-height,
window-body-width, window-display-table, window-combination-limit,
window-frame, window-fringes, window-inside-absolute-pixel-edges,
window-inside-edges, window-inside-pixel-edges, window-left-child,
window-left-column, window-margins, window-next-buffers,
window-next-sibling, window-new-normal, window-new-total,
window-normal-size, window-parameter, window-parameters, window-parent,
window-pixel-edges, window-point, window-prev-buffers,
window-prev-sibling, window-redisplay-end-trigger, window-scroll-bars,
window-start, window-text-height, window-top-child, window-top-line,
window-total-height, window-total-width and window-use-time to the list
of functions without side-effects.
(toplevel): Add window-valid-p to the list of error-free functions
without side-effects.
2012-11-06 11:37:06 +04:00
|
|
|
|
make-list make-string make-symbol marker-buffer max member memq min
|
|
|
|
|
minibuffer-selected-window minibuffer-window
|
|
|
|
|
mod multibyte-char-to-unibyte next-window nth nthcdr number-to-string
|
2002-03-31 16:22:58 +00:00
|
|
|
|
parse-colon-path plist-get plist-member
|
|
|
|
|
prefix-numeric-value previous-window prin1-to-string propertize
|
2009-09-10 06:21:48 +00:00
|
|
|
|
degrees-to-radians
|
2002-03-31 16:22:58 +00:00
|
|
|
|
radians-to-degrees rassq rassoc read-from-string regexp-quote
|
|
|
|
|
region-beginning region-end reverse round
|
2000-05-21 17:24:19 +00:00
|
|
|
|
sin sqrt string string< string= string-equal string-lessp string-to-char
|
2002-03-31 16:22:58 +00:00
|
|
|
|
string-to-int string-to-number substring sxhash symbol-function
|
2002-11-19 17:59:30 +00:00
|
|
|
|
symbol-name symbol-plist symbol-value string-make-unibyte
|
|
|
|
|
string-make-multibyte string-as-multibyte string-as-unibyte
|
2003-09-08 12:53:41 +00:00
|
|
|
|
string-to-multibyte
|
2002-03-31 16:22:58 +00:00
|
|
|
|
tan truncate
|
|
|
|
|
unibyte-char-to-multibyte upcase user-full-name
|
2012-04-09 20:36:01 +08:00
|
|
|
|
user-login-name user-original-login-name custom-variable-p
|
2002-03-31 16:22:58 +00:00
|
|
|
|
vconcat
|
* emacs-lisp/byte-opt.el (toplevel): Add compare-window-configurations,
frame-first-window, frame-root-window, frame-selected-window,
minibuffer-selected-window, minibuffer-window,
window-absolute-pixel-edges, window-at, window-body-height,
window-body-width, window-display-table, window-combination-limit,
window-frame, window-fringes, window-inside-absolute-pixel-edges,
window-inside-edges, window-inside-pixel-edges, window-left-child,
window-left-column, window-margins, window-next-buffers,
window-next-sibling, window-new-normal, window-new-total,
window-normal-size, window-parameter, window-parameters, window-parent,
window-pixel-edges, window-point, window-prev-buffers,
window-prev-sibling, window-redisplay-end-trigger, window-scroll-bars,
window-start, window-text-height, window-top-child, window-top-line,
window-total-height, window-total-width and window-use-time to the list
of functions without side-effects.
(toplevel): Add window-valid-p to the list of error-free functions
without side-effects.
2012-11-06 11:37:06 +04:00
|
|
|
|
window-absolute-pixel-edges window-at window-body-height
|
|
|
|
|
window-body-width window-buffer window-dedicated-p window-display-table
|
|
|
|
|
window-combination-limit window-edges window-frame window-fringes
|
|
|
|
|
window-height window-hscroll window-inside-edges
|
|
|
|
|
window-inside-absolute-pixel-edges window-inside-pixel-edges
|
|
|
|
|
window-left-child window-left-column window-margins window-minibuffer-p
|
|
|
|
|
window-next-buffers window-next-sibling window-new-normal
|
|
|
|
|
window-new-total window-normal-size window-parameter window-parameters
|
Fix minor quoting problems in doc strings
These were glitches regardless of how or whether we tackle the
problem of grave accent in doc strings.
* lisp/calc/calc-aent.el (math-restore-placeholders):
* lisp/ido.el (ido-ignore-buffers, ido-ignore-files):
* lisp/leim/quail/cyrillic.el ("bulgarian-alt-phonetic"):
* lisp/leim/quail/hebrew.el ("hebrew-new")
("hebrew-biblical-sil"):
* lisp/leim/quail/thai.el ("thai-kesmanee"):
* lisp/progmodes/idlw-shell.el (idlwave-shell-file-name-chars):
Used curved quotes to avoid ambiguities like ‘`''’ in doc strings.
* lisp/calendar/calendar.el (calendar-month-abbrev-array):
* lisp/cedet/semantic/mru-bookmark.el (semantic-mrub-cache-flush-fcn):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-copy)
(semantic-tag-components):
* lisp/cedet/srecode/cpp.el (srecode-semantic-handle-:cpp):
* lisp/cedet/srecode/texi.el (srecode-texi-texify-docstring):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-all-constp):
* lisp/emacs-lisp/checkdoc.el (checkdoc-message-text-engine):
* lisp/emacs-lisp/generator.el (iter-next):
* lisp/gnus/gnus-art.el (gnus-treat-strip-list-identifiers)
(gnus-article-mode-syntax-table):
* lisp/net/rlogin.el (rlogin-directory-tracking-mode):
* lisp/net/soap-client.el (soap-wsdl-get):
* lisp/net/telnet.el (telnet-mode):
* lisp/org/org-compat.el (org-number-sequence):
* lisp/org/org.el (org-remove-highlights-with-change)
(org-structure-template-alist):
* lisp/org/ox-html.el (org-html-link-org-files-as-html):
* lisp/play/handwrite.el (handwrite-10pt, handwrite-11pt)
(handwrite-12pt, handwrite-13pt):
* lisp/progmodes/f90.el (f90-mode, f90-abbrev-start):
* lisp/progmodes/idlwave.el (idlwave-mode, idlwave-check-abbrev):
* lisp/progmodes/verilog-mode.el (verilog-tool)
(verilog-string-replace-matches, verilog-preprocess)
(verilog-auto-insert-lisp, verilog-auto-insert-last):
* lisp/textmodes/makeinfo.el (makeinfo-options):
* src/font.c (Ffont_spec):
Fix minor quoting problems in doc strings, e.g., missing quote,
``x'' where `x' was meant, etc.
* lisp/erc/erc-backend.el (erc-process-sentinel-2):
Fix minor quoting problem in other string.
* lisp/leim/quail/ethiopic.el ("ethiopic"):
* lisp/term/tvi970.el (tvi970-set-keypad-mode):
Omit unnecessary quotes.
* lisp/faces.el (set-face-attribute, set-face-underline)
(set-face-inverse-video, x-create-frame-with-faces):
* lisp/gnus/gnus-group.el (gnus-group-nnimap-edit-acl):
* lisp/mail/supercite.el (sc-attribs-%@-addresses)
(sc-attribs-!-addresses, sc-attribs-<>-addresses):
* lisp/net/tramp.el (tramp-methods):
* lisp/recentf.el (recentf-show-file-shortcuts-flag):
* lisp/textmodes/artist.el (artist-ellipse-right-char)
(artist-ellipse-left-char, artist-vaporize-fuzziness)
(artist-spray-chars, artist-mode, artist-replace-string)
(artist-put-pixel, artist-text-see-thru):
* lisp/vc/ediff-util.el (ediff-submit-report):
* lisp/vc/log-edit.el (log-edit-changelog-full-paragraphs):
Use double-quotes rather than TeX markup in doc strings.
* lisp/skeleton.el (skeleton-pair-insert-maybe):
Reword to avoid the need for grave accent and apostrophe.
* lisp/xt-mouse.el (xterm-mouse-tracking-enable-sequence):
Don't use grave and acute accents to quote.
2015-05-19 14:59:15 -07:00
|
|
|
|
window-parent window-pixel-edges window-point window-prev-buffers
|
* emacs-lisp/byte-opt.el (toplevel): Add compare-window-configurations,
frame-first-window, frame-root-window, frame-selected-window,
minibuffer-selected-window, minibuffer-window,
window-absolute-pixel-edges, window-at, window-body-height,
window-body-width, window-display-table, window-combination-limit,
window-frame, window-fringes, window-inside-absolute-pixel-edges,
window-inside-edges, window-inside-pixel-edges, window-left-child,
window-left-column, window-margins, window-next-buffers,
window-next-sibling, window-new-normal, window-new-total,
window-normal-size, window-parameter, window-parameters, window-parent,
window-pixel-edges, window-point, window-prev-buffers,
window-prev-sibling, window-redisplay-end-trigger, window-scroll-bars,
window-start, window-text-height, window-top-child, window-top-line,
window-total-height, window-total-width and window-use-time to the list
of functions without side-effects.
(toplevel): Add window-valid-p to the list of error-free functions
without side-effects.
2012-11-06 11:37:06 +04:00
|
|
|
|
window-prev-sibling window-redisplay-end-trigger window-scroll-bars
|
|
|
|
|
window-start window-text-height window-top-child window-top-line
|
|
|
|
|
window-total-height window-total-width window-use-time window-vscroll
|
|
|
|
|
window-width zerop))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(side-effect-and-error-free-fns
|
1993-12-23 05:00:49 +00:00
|
|
|
|
'(arrayp atom
|
2003-02-04 13:24:35 +00:00
|
|
|
|
bobp bolp bool-vector-p
|
2002-03-31 16:22:58 +00:00
|
|
|
|
buffer-end buffer-list buffer-size buffer-string bufferp
|
2002-05-23 18:15:02 +00:00
|
|
|
|
car-safe case-table-p cdr-safe char-or-string-p characterp
|
2002-06-27 21:28:58 +00:00
|
|
|
|
charsetp commandp cons consp
|
1999-09-09 20:04:17 +00:00
|
|
|
|
current-buffer current-global-map current-indentation
|
2002-03-31 16:22:58 +00:00
|
|
|
|
current-local-map current-minor-mode-maps current-time
|
|
|
|
|
current-time-string current-time-zone
|
|
|
|
|
eobp eolp eq equal eventp
|
2000-05-21 17:24:19 +00:00
|
|
|
|
floatp following-char framep
|
1993-12-23 05:00:49 +00:00
|
|
|
|
get-largest-window get-lru-window
|
1999-12-18 17:28:36 +00:00
|
|
|
|
hash-table-p
|
1993-12-23 05:00:49 +00:00
|
|
|
|
identity ignore integerp integer-or-marker-p interactive-p
|
|
|
|
|
invocation-directory invocation-name
|
1999-09-09 20:04:17 +00:00
|
|
|
|
keymapp
|
|
|
|
|
line-beginning-position line-end-position list listp
|
2003-09-08 12:53:41 +00:00
|
|
|
|
make-marker mark mark-marker markerp max-char
|
|
|
|
|
memory-limit minibuffer-window
|
1993-12-23 05:00:49 +00:00
|
|
|
|
mouse-movement-p
|
|
|
|
|
natnump nlistp not null number-or-marker-p numberp
|
|
|
|
|
one-window-p overlayp
|
2002-06-27 21:28:58 +00:00
|
|
|
|
point point-marker point-min point-max preceding-char primary-charset
|
|
|
|
|
processp
|
1999-09-09 20:04:17 +00:00
|
|
|
|
recent-keys recursion-depth
|
2002-03-31 16:22:58 +00:00
|
|
|
|
safe-length selected-frame selected-window sequencep
|
|
|
|
|
standard-case-table standard-syntax-table stringp subrp symbolp
|
|
|
|
|
syntax-table syntax-table-p
|
1999-09-09 20:04:17 +00:00
|
|
|
|
this-command-keys this-command-keys-vector this-single-command-keys
|
|
|
|
|
this-single-command-raw-keys
|
1993-12-23 05:00:49 +00:00
|
|
|
|
user-real-login-name user-real-uid user-uid
|
1999-09-09 20:04:17 +00:00
|
|
|
|
vector vectorp visible-frame-list
|
* emacs-lisp/byte-opt.el (toplevel): Add compare-window-configurations,
frame-first-window, frame-root-window, frame-selected-window,
minibuffer-selected-window, minibuffer-window,
window-absolute-pixel-edges, window-at, window-body-height,
window-body-width, window-display-table, window-combination-limit,
window-frame, window-fringes, window-inside-absolute-pixel-edges,
window-inside-edges, window-inside-pixel-edges, window-left-child,
window-left-column, window-margins, window-next-buffers,
window-next-sibling, window-new-normal, window-new-total,
window-normal-size, window-parameter, window-parameters, window-parent,
window-pixel-edges, window-point, window-prev-buffers,
window-prev-sibling, window-redisplay-end-trigger, window-scroll-bars,
window-start, window-text-height, window-top-child, window-top-line,
window-total-height, window-total-width and window-use-time to the list
of functions without side-effects.
(toplevel): Add window-valid-p to the list of error-free functions
without side-effects.
2012-11-06 11:37:06 +04:00
|
|
|
|
wholenump window-configuration-p window-live-p
|
|
|
|
|
window-valid-p windowp)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(while side-effect-free-fns
|
|
|
|
|
(put (car side-effect-free-fns) 'side-effect-free t)
|
|
|
|
|
(setq side-effect-free-fns (cdr side-effect-free-fns)))
|
|
|
|
|
(while side-effect-and-error-free-fns
|
|
|
|
|
(put (car side-effect-and-error-free-fns) 'side-effect-free 'error-free)
|
|
|
|
|
(setq side-effect-and-error-free-fns (cdr side-effect-and-error-free-fns)))
|
|
|
|
|
nil)
|
|
|
|
|
|
2007-04-11 17:10:42 +00:00
|
|
|
|
|
|
|
|
|
;; pure functions are side-effect free functions whose values depend
|
|
|
|
|
;; only on their arguments. For these functions, calls with constant
|
|
|
|
|
;; arguments can be evaluated at compile time. This may shift run time
|
|
|
|
|
;; errors to compile time.
|
|
|
|
|
|
|
|
|
|
(let ((pure-fns
|
|
|
|
|
'(concat symbol-name regexp-opt regexp-quote string-to-syntax)))
|
|
|
|
|
(while pure-fns
|
|
|
|
|
(put (car pure-fns) 'pure t)
|
|
|
|
|
(setq pure-fns (cdr pure-fns)))
|
|
|
|
|
nil)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
(defconst byte-constref-ops
|
|
|
|
|
'(byte-constant byte-constant2 byte-varref byte-varset byte-varbind))
|
|
|
|
|
|
2011-02-21 17:34:51 -05:00
|
|
|
|
;; Used and set dynamically in byte-decompile-bytecode-1.
|
|
|
|
|
(defvar bytedecomp-op)
|
|
|
|
|
(defvar bytedecomp-ptr)
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; This function extracts the bitfields from variable-length opcodes.
|
|
|
|
|
;; Originally defined in disass.el (which no longer uses it.)
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(defun disassemble-offset (bytes)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
"Don't call this!"
|
2011-03-16 16:08:39 -04:00
|
|
|
|
;; Fetch and return the offset for the current opcode.
|
|
|
|
|
;; Return nil if this opcode has no offset.
|
Introduce new bytecodes for efficient catch/condition-case in lexbind.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Optimize under `condition-case' and `catch' if
byte-compile--use-old-handlers is nil.
(disassemble-offset): Handle new bytecodes.
* lisp/emacs-lisp/bytecomp.el (byte-pushcatch, byte-pushconditioncase)
(byte-pophandler): New byte codes.
(byte-goto-ops): Adjust accordingly.
(byte-compile--use-old-handlers): New var.
(byte-compile-catch): Use new byte codes depending on
byte-compile--use-old-handlers.
(byte-compile-condition-case--old): Rename from
byte-compile-condition-case.
(byte-compile-condition-case--new): New function.
(byte-compile-condition-case): New function that dispatches depending
on byte-compile--use-old-handlers.
(byte-compile-unwind-protect): Pass a function to byte-unwind-protect
when we can.
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form): Adjust for
the new compilation scheme using the new byte-codes.
* src/alloc.c (Fgarbage_collect): Merge scans of handlerlist and catchlist,
and make them unconditional now that they're heap-allocated.
* src/bytecode.c (BYTE_CODES): Add Bpushcatch, Bpushconditioncase
and Bpophandler.
(bcall0): New function.
(exec_byte_code): Add corresponding cases. Improve error message when
encountering an invalid byte-code. Let Bunwind_protect accept
a function (rather than a list of expressions) as argument.
* src/eval.c (catchlist): Remove (merge with handlerlist).
(handlerlist, lisp_eval_depth): Not static any more.
(internal_catch, internal_condition_case, internal_condition_case_1)
(internal_condition_case_2, internal_condition_case_n):
Use PUSH_HANDLER.
(unwind_to_catch, Fthrow, Fsignal): Adjust to merged
handlerlist/catchlist.
(internal_lisp_condition_case): Use PUSH_HANDLER. Adjust to new
handlerlist which can only handle a single condition-case handler at
a time.
(find_handler_clause): Simplify since we only a single branch here
any more.
* src/lisp.h (struct handler): Merge struct handler and struct catchtag.
(PUSH_HANDLER): New macro.
(catchlist): Remove.
(handlerlist): Always declare.
2013-10-03 00:58:56 -04:00
|
|
|
|
(cond ((< bytedecomp-op byte-pophandler)
|
2010-11-05 00:32:16 -07:00
|
|
|
|
(let ((tem (logand bytedecomp-op 7)))
|
|
|
|
|
(setq bytedecomp-op (logand bytedecomp-op 248))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(cond ((eq tem 6)
|
2010-11-05 00:32:16 -07:00
|
|
|
|
;; Offset in next byte.
|
|
|
|
|
(setq bytedecomp-ptr (1+ bytedecomp-ptr))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(aref bytes bytedecomp-ptr))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
((eq tem 7)
|
2010-11-05 00:32:16 -07:00
|
|
|
|
;; Offset in next 2 bytes.
|
|
|
|
|
(setq bytedecomp-ptr (1+ bytedecomp-ptr))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(+ (aref bytes bytedecomp-ptr)
|
2010-11-05 00:32:16 -07:00
|
|
|
|
(progn (setq bytedecomp-ptr (1+ bytedecomp-ptr))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(lsh (aref bytes bytedecomp-ptr) 8))))
|
|
|
|
|
(t tem)))) ;Offset was in opcode.
|
2010-11-05 00:32:16 -07:00
|
|
|
|
((>= bytedecomp-op byte-constant)
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(prog1 (- bytedecomp-op byte-constant) ;Offset in opcode.
|
2010-11-05 00:32:16 -07:00
|
|
|
|
(setq bytedecomp-op byte-constant)))
|
2010-12-10 19:13:08 -05:00
|
|
|
|
((or (and (>= bytedecomp-op byte-constant2)
|
|
|
|
|
(<= bytedecomp-op byte-goto-if-not-nil-else-pop))
|
Introduce new bytecodes for efficient catch/condition-case in lexbind.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Optimize under `condition-case' and `catch' if
byte-compile--use-old-handlers is nil.
(disassemble-offset): Handle new bytecodes.
* lisp/emacs-lisp/bytecomp.el (byte-pushcatch, byte-pushconditioncase)
(byte-pophandler): New byte codes.
(byte-goto-ops): Adjust accordingly.
(byte-compile--use-old-handlers): New var.
(byte-compile-catch): Use new byte codes depending on
byte-compile--use-old-handlers.
(byte-compile-condition-case--old): Rename from
byte-compile-condition-case.
(byte-compile-condition-case--new): New function.
(byte-compile-condition-case): New function that dispatches depending
on byte-compile--use-old-handlers.
(byte-compile-unwind-protect): Pass a function to byte-unwind-protect
when we can.
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form): Adjust for
the new compilation scheme using the new byte-codes.
* src/alloc.c (Fgarbage_collect): Merge scans of handlerlist and catchlist,
and make them unconditional now that they're heap-allocated.
* src/bytecode.c (BYTE_CODES): Add Bpushcatch, Bpushconditioncase
and Bpophandler.
(bcall0): New function.
(exec_byte_code): Add corresponding cases. Improve error message when
encountering an invalid byte-code. Let Bunwind_protect accept
a function (rather than a list of expressions) as argument.
* src/eval.c (catchlist): Remove (merge with handlerlist).
(handlerlist, lisp_eval_depth): Not static any more.
(internal_catch, internal_condition_case, internal_condition_case_1)
(internal_condition_case_2, internal_condition_case_n):
Use PUSH_HANDLER.
(unwind_to_catch, Fthrow, Fsignal): Adjust to merged
handlerlist/catchlist.
(internal_lisp_condition_case): Use PUSH_HANDLER. Adjust to new
handlerlist which can only handle a single condition-case handler at
a time.
(find_handler_clause): Simplify since we only a single branch here
any more.
* src/lisp.h (struct handler): Merge struct handler and struct catchtag.
(PUSH_HANDLER): New macro.
(catchlist): Remove.
(handlerlist): Always declare.
2013-10-03 00:58:56 -04:00
|
|
|
|
(memq bytedecomp-op (eval-when-compile
|
|
|
|
|
(list byte-stack-set2 byte-pushcatch
|
|
|
|
|
byte-pushconditioncase))))
|
2010-11-05 00:32:16 -07:00
|
|
|
|
;; Offset in next 2 bytes.
|
|
|
|
|
(setq bytedecomp-ptr (1+ bytedecomp-ptr))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(+ (aref bytes bytedecomp-ptr)
|
2010-11-05 00:32:16 -07:00
|
|
|
|
(progn (setq bytedecomp-ptr (1+ bytedecomp-ptr))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(lsh (aref bytes bytedecomp-ptr) 8))))
|
2010-11-05 00:32:16 -07:00
|
|
|
|
((and (>= bytedecomp-op byte-listN)
|
2010-12-10 19:13:08 -05:00
|
|
|
|
(<= bytedecomp-op byte-discardN))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(setq bytedecomp-ptr (1+ bytedecomp-ptr)) ;Offset in next byte.
|
|
|
|
|
(aref bytes bytedecomp-ptr))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
2011-03-10 09:52:33 -05:00
|
|
|
|
(defvar byte-compile-tag-number)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; This de-compiler is used for inline expansion of compiled functions,
|
|
|
|
|
;; and by the disassembler.
|
|
|
|
|
;;
|
|
|
|
|
;; This list contains numbers, which are pc values,
|
|
|
|
|
;; before each instruction.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(defun byte-decompile-bytecode (bytes constvec)
|
2007-08-23 19:56:16 +00:00
|
|
|
|
"Turn BYTECODE into lapcode, referring to CONSTVEC."
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(let ((byte-compile-constants nil)
|
|
|
|
|
(byte-compile-variables nil)
|
|
|
|
|
(byte-compile-tag-number 0))
|
|
|
|
|
(byte-decompile-bytecode-1 bytes constvec)))
|
|
|
|
|
|
1992-07-14 02:11:50 +00:00
|
|
|
|
;; As byte-decompile-bytecode, but updates
|
|
|
|
|
;; byte-compile-{constants, variables, tag-number}.
|
1994-07-20 06:04:46 +00:00
|
|
|
|
;; If MAKE-SPLICEABLE is true, then `return' opcodes are replaced
|
1992-07-14 02:11:50 +00:00
|
|
|
|
;; with `goto's destined for the end of the code.
|
1994-07-20 06:04:46 +00:00
|
|
|
|
;; That is for use by the compiler.
|
|
|
|
|
;; If MAKE-SPLICEABLE is nil, we are being called for the disassembler.
|
|
|
|
|
;; In that case, we put a pc value into the list
|
|
|
|
|
;; before each insn (or its label).
|
2011-03-10 09:52:33 -05:00
|
|
|
|
(defun byte-decompile-bytecode-1 (bytes constvec &optional make-spliceable)
|
2011-03-22 20:53:36 -04:00
|
|
|
|
(let ((length (length bytes))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(bytedecomp-ptr 0) optr tags bytedecomp-op offset
|
2011-04-20 14:28:07 -03:00
|
|
|
|
lap tmp)
|
2010-11-05 00:32:16 -07:00
|
|
|
|
(while (not (= bytedecomp-ptr length))
|
1994-07-20 06:04:46 +00:00
|
|
|
|
(or make-spliceable
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(push bytedecomp-ptr lap))
|
2011-03-22 20:53:36 -04:00
|
|
|
|
(setq bytedecomp-op (aref bytes bytedecomp-ptr)
|
2010-11-05 00:32:16 -07:00
|
|
|
|
optr bytedecomp-ptr
|
2011-03-16 16:08:39 -04:00
|
|
|
|
;; This uses dynamic-scope magic.
|
2011-03-22 20:53:36 -04:00
|
|
|
|
offset (disassemble-offset bytes))
|
2011-04-20 14:28:07 -03:00
|
|
|
|
(let ((opcode (aref byte-code-vector bytedecomp-op)))
|
2012-06-10 09:28:26 -04:00
|
|
|
|
(cl-assert opcode)
|
2011-04-20 14:28:07 -03:00
|
|
|
|
(setq bytedecomp-op opcode))
|
2010-11-05 00:32:16 -07:00
|
|
|
|
(cond ((memq bytedecomp-op byte-goto-ops)
|
2011-03-16 16:08:39 -04:00
|
|
|
|
;; It's a pc.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(setq offset
|
|
|
|
|
(cdr (or (assq offset tags)
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(let ((new (cons offset (byte-compile-make-tag))))
|
|
|
|
|
(push new tags)
|
|
|
|
|
new)))))
|
2010-11-05 00:32:16 -07:00
|
|
|
|
((cond ((eq bytedecomp-op 'byte-constant2)
|
|
|
|
|
(setq bytedecomp-op 'byte-constant) t)
|
|
|
|
|
((memq bytedecomp-op byte-constref-ops)))
|
1998-05-15 05:49:05 +00:00
|
|
|
|
(setq tmp (if (>= offset (length constvec))
|
|
|
|
|
(list 'out-of-range offset)
|
|
|
|
|
(aref constvec offset))
|
2010-11-05 00:32:16 -07:00
|
|
|
|
offset (if (eq bytedecomp-op 'byte-constant)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-get-constant tmp)
|
|
|
|
|
(or (assq tmp byte-compile-variables)
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(let ((new (list tmp)))
|
|
|
|
|
(push new byte-compile-variables)
|
|
|
|
|
new)))))
|
2010-12-10 19:13:08 -05:00
|
|
|
|
((eq bytedecomp-op 'byte-stack-set2)
|
|
|
|
|
(setq bytedecomp-op 'byte-stack-set))
|
|
|
|
|
((and (eq bytedecomp-op 'byte-discardN) (>= offset #x80))
|
2010-06-13 16:36:17 -04:00
|
|
|
|
;; The top bit of the operand for byte-discardN is a flag,
|
|
|
|
|
;; saying whether the top-of-stack is preserved. In
|
|
|
|
|
;; lapcode, we represent this by using a different opcode
|
|
|
|
|
;; (with the flag removed from the operand).
|
2010-12-10 19:13:08 -05:00
|
|
|
|
(setq bytedecomp-op 'byte-discardN-preserve-tos)
|
2010-06-13 16:36:17 -04:00
|
|
|
|
(setq offset (- offset #x80))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;; lap = ( [ (pc . (op . arg)) ]* )
|
2011-03-16 16:08:39 -04:00
|
|
|
|
(push (cons optr (cons bytedecomp-op (or offset 0)))
|
|
|
|
|
lap)
|
2010-11-05 00:32:16 -07:00
|
|
|
|
(setq bytedecomp-ptr (1+ bytedecomp-ptr)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(let ((rest lap))
|
|
|
|
|
(while rest
|
1994-07-20 05:31:29 +00:00
|
|
|
|
(cond ((numberp (car rest)))
|
|
|
|
|
((setq tmp (assq (car (car rest)) tags))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
;; This addr is jumped to.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(setcdr rest (cons (cons nil (cdr tmp))
|
|
|
|
|
(cdr rest)))
|
|
|
|
|
(setq tags (delq tmp tags))
|
|
|
|
|
(setq rest (cdr rest))))
|
|
|
|
|
(setq rest (cdr rest))))
|
|
|
|
|
(if tags (error "optimizer error: missed tags %s" tags))
|
2011-03-16 16:08:39 -04:00
|
|
|
|
;; Remove addrs, lap = ( [ (op . arg) | (TAG tagno) ]* )
|
1994-07-20 05:31:29 +00:00
|
|
|
|
(mapcar (function (lambda (elt)
|
|
|
|
|
(if (numberp elt)
|
|
|
|
|
elt
|
|
|
|
|
(cdr elt))))
|
|
|
|
|
(nreverse lap))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; peephole optimizer
|
|
|
|
|
|
|
|
|
|
(defconst byte-tagref-ops (cons 'TAG byte-goto-ops))
|
|
|
|
|
|
|
|
|
|
(defconst byte-conditional-ops
|
|
|
|
|
'(byte-goto-if-nil byte-goto-if-not-nil byte-goto-if-nil-else-pop
|
|
|
|
|
byte-goto-if-not-nil-else-pop))
|
|
|
|
|
|
|
|
|
|
(defconst byte-after-unbind-ops
|
|
|
|
|
'(byte-constant byte-dup
|
|
|
|
|
byte-symbolp byte-consp byte-stringp byte-listp byte-numberp byte-integerp
|
1998-04-17 02:00:04 +00:00
|
|
|
|
byte-eq byte-not
|
1992-07-10 22:06:47 +00:00
|
|
|
|
byte-cons byte-list1 byte-list2 ; byte-list3 byte-list4
|
1994-08-06 19:25:24 +00:00
|
|
|
|
byte-interactive-p)
|
|
|
|
|
;; How about other side-effect-free-ops? Is it safe to move an
|
|
|
|
|
;; error invocation (such as from nth) out of an unwind-protect?
|
1998-04-17 02:00:04 +00:00
|
|
|
|
;; No, it is not, because the unwind-protect forms can alter
|
|
|
|
|
;; the inside of the object to which nth would apply.
|
|
|
|
|
;; For the same reason, byte-equal was deleted from this list.
|
1994-08-06 19:25:24 +00:00
|
|
|
|
"Byte-codes that can be moved past an unbind.")
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
(defconst byte-compile-side-effect-and-error-free-ops
|
|
|
|
|
'(byte-constant byte-dup byte-symbolp byte-consp byte-stringp byte-listp
|
|
|
|
|
byte-integerp byte-numberp byte-eq byte-equal byte-not byte-car-safe
|
|
|
|
|
byte-cdr-safe byte-cons byte-list1 byte-list2 byte-point byte-point-max
|
|
|
|
|
byte-point-min byte-following-char byte-preceding-char
|
|
|
|
|
byte-current-column byte-eolp byte-eobp byte-bolp byte-bobp
|
2011-04-01 11:16:50 -04:00
|
|
|
|
byte-current-buffer byte-stack-ref))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
(defconst byte-compile-side-effect-free-ops
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(nconc
|
1992-07-10 22:06:47 +00:00
|
|
|
|
'(byte-varref byte-nth byte-memq byte-car byte-cdr byte-length byte-aref
|
|
|
|
|
byte-symbol-value byte-get byte-concat2 byte-concat3 byte-sub1 byte-add1
|
|
|
|
|
byte-eqlsign byte-gtr byte-lss byte-leq byte-geq byte-diff byte-negate
|
|
|
|
|
byte-plus byte-max byte-min byte-mult byte-char-after byte-char-syntax
|
|
|
|
|
byte-buffer-substring byte-string= byte-string< byte-nthcdr byte-elt
|
* lisp/emacs-lisp/byte-lexbind.el: Delete.
* lisp/emacs-lisp/bytecomp.el (byte-compile-current-heap-environment)
(byte-compile-current-num-closures): Remove vars.
(byte-vec-ref, byte-vec-set): Remove byte codes.
(byte-compile-arglist-vars, byte-compile-make-lambda-lexenv): Move from
byte-lexbind.el.
(byte-compile-lambda): Never build a closure.
(byte-compile-closure-code-p, byte-compile-make-closure): Remove.
(byte-compile-closure): Simplify.
(byte-compile-top-level): Don't mess with heap environments.
(byte-compile-dynamic-variable-bind): Always maintain
byte-compile-bound-variables.
(byte-compile-variable-ref, byte-compile-variable-set): Always just use
the stack for lexical vars.
(byte-compile-push-binding-init): Simplify.
(byte-compile-not-lexical-var-p): New function, moved from cconv.el.
(byte-compile-bind, byte-compile-unbind): New functions, moved and
simplified from byte-lexbind.el.
(byte-compile-let, byte-compile-let*): Simplify.
(byte-compile-condition-case): Don't add :fun-body to the bound vars.
(byte-compile-defmacro): Simplify.
* lisp/emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops)
(byte-optimize-lapcode): Remove byte-vec-ref and byte-vec-set.
* lisp/emacs-lisp/cconv.el (cconv-not-lexical-var-p): Remove.
(cconv-freevars, cconv-analyse-function, cconv-analyse-form):
Use byte-compile-not-lexical-var-p instead.
* src/bytecode.c (Bvec_ref, Bvec_set): Remove.
(exec_byte_code): Don't handle them.
* lisp/help-fns.el (describe-function-1): Fix paren typo.
2011-02-12 00:53:30 -05:00
|
|
|
|
byte-member byte-assq byte-quo byte-rem)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
byte-compile-side-effect-and-error-free-ops))
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; This crock is because of the way DEFVAR_BOOL variables work.
|
|
|
|
|
;; Consider the code
|
|
|
|
|
;;
|
|
|
|
|
;; (defun foo (flag)
|
|
|
|
|
;; (let ((old-pop-ups pop-up-windows)
|
|
|
|
|
;; (pop-up-windows flag))
|
|
|
|
|
;; (cond ((not (eq pop-up-windows old-pop-ups))
|
|
|
|
|
;; (setq old-pop-ups pop-up-windows)
|
|
|
|
|
;; ...))))
|
|
|
|
|
;;
|
|
|
|
|
;; Uncompiled, old-pop-ups will always be set to nil or t, even if FLAG is
|
|
|
|
|
;; something else. But if we optimize
|
|
|
|
|
;;
|
|
|
|
|
;; varref flag
|
|
|
|
|
;; varbind pop-up-windows
|
|
|
|
|
;; varref pop-up-windows
|
|
|
|
|
;; not
|
|
|
|
|
;; to
|
|
|
|
|
;; varref flag
|
|
|
|
|
;; dup
|
|
|
|
|
;; varbind pop-up-windows
|
|
|
|
|
;; not
|
|
|
|
|
;;
|
|
|
|
|
;; we break the program, because it will appear that pop-up-windows and
|
|
|
|
|
;; old-pop-ups are not EQ when really they are. So we have to know what
|
|
|
|
|
;; the BOOL variables are, and not perform this optimization on them.
|
|
|
|
|
|
|
|
|
|
;; The variable `byte-boolean-vars' is now primitive and updated
|
|
|
|
|
;; automatically by DEFVAR_BOOL.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
2011-03-10 09:52:33 -05:00
|
|
|
|
(defun byte-optimize-lapcode (lap &optional _for-effect)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
"Simple peephole optimizer. LAP is both modified and returned.
|
|
|
|
|
If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
|
2000-10-02 17:44:51 +00:00
|
|
|
|
(let (lap0
|
|
|
|
|
lap1
|
|
|
|
|
lap2
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(keep-going 'first-time)
|
|
|
|
|
(add-depth 0)
|
|
|
|
|
rest tmp tmp2 tmp3
|
|
|
|
|
(side-effect-free (if byte-compile-delete-errors
|
|
|
|
|
byte-compile-side-effect-free-ops
|
|
|
|
|
byte-compile-side-effect-and-error-free-ops)))
|
|
|
|
|
(while keep-going
|
|
|
|
|
(or (eq keep-going 'first-time)
|
|
|
|
|
(byte-compile-log-lap " ---- next pass"))
|
|
|
|
|
(setq rest lap
|
|
|
|
|
keep-going nil)
|
|
|
|
|
(while rest
|
|
|
|
|
(setq lap0 (car rest)
|
|
|
|
|
lap1 (nth 1 rest)
|
|
|
|
|
lap2 (nth 2 rest))
|
|
|
|
|
|
|
|
|
|
;; You may notice that sequences like "dup varset discard" are
|
|
|
|
|
;; optimized but sequences like "dup varset TAG1: discard" are not.
|
|
|
|
|
;; You may be tempted to change this; resist that temptation.
|
|
|
|
|
(cond ;;
|
|
|
|
|
;; <side-effect-free> pop --> <deleted>
|
|
|
|
|
;; ...including:
|
|
|
|
|
;; const-X pop --> <deleted>
|
|
|
|
|
;; varref-X pop --> <deleted>
|
|
|
|
|
;; dup pop --> <deleted>
|
|
|
|
|
;;
|
|
|
|
|
((and (eq 'byte-discard (car lap1))
|
|
|
|
|
(memq (car lap0) side-effect-free))
|
|
|
|
|
(setq keep-going t)
|
2011-02-21 15:31:07 -05:00
|
|
|
|
(setq tmp (aref byte-stack+-info (symbol-value (car lap0))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(setq rest (cdr rest))
|
2011-02-21 15:31:07 -05:00
|
|
|
|
(cond ((= tmp 1)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-log-lap
|
|
|
|
|
" %s discard\t-->\t<deleted>" lap0)
|
|
|
|
|
(setq lap (delq lap0 (delq lap1 lap))))
|
2011-02-21 15:31:07 -05:00
|
|
|
|
((= tmp 0)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-log-lap
|
|
|
|
|
" %s discard\t-->\t<deleted> discard" lap0)
|
|
|
|
|
(setq lap (delq lap0 lap)))
|
2011-02-21 15:31:07 -05:00
|
|
|
|
((= tmp -1)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-log-lap
|
|
|
|
|
" %s discard\t-->\tdiscard discard" lap0)
|
|
|
|
|
(setcar lap0 'byte-discard)
|
|
|
|
|
(setcdr lap0 0))
|
2011-02-21 15:31:07 -05:00
|
|
|
|
((error "Optimizer error: too much on the stack"))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
|
|
|
|
;; goto*-X X: --> X:
|
|
|
|
|
;;
|
|
|
|
|
((and (memq (car lap0) byte-goto-ops)
|
|
|
|
|
(eq (cdr lap0) lap1))
|
|
|
|
|
(cond ((eq (car lap0) 'byte-goto)
|
|
|
|
|
(setq lap (delq lap0 lap))
|
|
|
|
|
(setq tmp "<deleted>"))
|
|
|
|
|
((memq (car lap0) byte-goto-always-pop-ops)
|
|
|
|
|
(setcar lap0 (setq tmp 'byte-discard))
|
|
|
|
|
(setcdr lap0 0))
|
|
|
|
|
((error "Depth conflict at tag %d" (nth 2 lap0))))
|
|
|
|
|
(and (memq byte-optimize-log '(t byte))
|
|
|
|
|
(byte-compile-log " (goto %s) %s:\t-->\t%s %s:"
|
|
|
|
|
(nth 1 lap1) (nth 1 lap1)
|
|
|
|
|
tmp (nth 1 lap1)))
|
|
|
|
|
(setq keep-going t))
|
|
|
|
|
;;
|
|
|
|
|
;; varset-X varref-X --> dup varset-X
|
|
|
|
|
;; varbind-X varref-X --> dup varbind-X
|
|
|
|
|
;; const/dup varset-X varref-X --> const/dup varset-X const/dup
|
|
|
|
|
;; const/dup varbind-X varref-X --> const/dup varbind-X const/dup
|
|
|
|
|
;; The latter two can enable other optimizations.
|
|
|
|
|
;;
|
2011-02-21 15:12:44 -05:00
|
|
|
|
;; For lexical variables, we could do the same
|
|
|
|
|
;; stack-set-X+1 stack-ref-X --> dup stack-set-X+2
|
|
|
|
|
;; but this is a very minor gain, since dup is stack-ref-0,
|
|
|
|
|
;; i.e. it's only better if X>5, and even then it comes
|
2012-01-10 22:53:12 -08:00
|
|
|
|
;; at the cost of an extra stack slot. Let's not bother.
|
2011-02-21 15:12:44 -05:00
|
|
|
|
((and (eq 'byte-varref (car lap2))
|
|
|
|
|
(eq (cdr lap1) (cdr lap2))
|
|
|
|
|
(memq (car lap1) '(byte-varset byte-varbind)))
|
|
|
|
|
(if (and (setq tmp (memq (car (cdr lap2)) byte-boolean-vars))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(not (eq (car lap0) 'byte-constant)))
|
|
|
|
|
nil
|
|
|
|
|
(setq keep-going t)
|
2012-06-07 15:25:48 -04:00
|
|
|
|
(if (memq (car lap0) '(byte-constant byte-dup))
|
|
|
|
|
(progn
|
|
|
|
|
(setq tmp (if (or (not tmp)
|
|
|
|
|
(macroexp--const-symbol-p
|
|
|
|
|
(car (cdr lap0))))
|
|
|
|
|
(cdr lap0)
|
|
|
|
|
(byte-compile-get-constant t)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-log-lap " %s %s %s\t-->\t%s %s %s"
|
|
|
|
|
lap0 lap1 lap2 lap0 lap1
|
|
|
|
|
(cons (car lap0) tmp))
|
|
|
|
|
(setcar lap2 (car lap0))
|
|
|
|
|
(setcdr lap2 tmp))
|
|
|
|
|
(byte-compile-log-lap " %s %s\t-->\tdup %s" lap1 lap2 lap1)
|
|
|
|
|
(setcar lap2 (car lap1))
|
|
|
|
|
(setcar lap1 'byte-dup)
|
|
|
|
|
(setcdr lap1 0)
|
|
|
|
|
;; The stack depth gets locally increased, so we will
|
|
|
|
|
;; increase maxdepth in case depth = maxdepth here.
|
|
|
|
|
;; This can cause the third argument to byte-code to
|
|
|
|
|
;; be larger than necessary.
|
|
|
|
|
(setq add-depth 1))))
|
|
|
|
|
;;
|
|
|
|
|
;; dup varset-X discard --> varset-X
|
|
|
|
|
;; dup varbind-X discard --> varbind-X
|
2011-02-21 15:12:44 -05:00
|
|
|
|
;; dup stack-set-X discard --> stack-set-X-1
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;; (the varbind variant can emerge from other optimizations)
|
|
|
|
|
;;
|
|
|
|
|
((and (eq 'byte-dup (car lap0))
|
|
|
|
|
(eq 'byte-discard (car lap2))
|
2011-02-21 15:12:44 -05:00
|
|
|
|
(memq (car lap1) '(byte-varset byte-varbind
|
|
|
|
|
byte-stack-set)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-log-lap " dup %s discard\t-->\t%s" lap1 lap1)
|
|
|
|
|
(setq keep-going t
|
2011-02-21 15:31:07 -05:00
|
|
|
|
rest (cdr rest))
|
2012-06-10 09:28:26 -04:00
|
|
|
|
(if (eq 'byte-stack-set (car lap1)) (cl-decf (cdr lap1)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(setq lap (delq lap0 (delq lap2 lap))))
|
|
|
|
|
;;
|
|
|
|
|
;; not goto-X-if-nil --> goto-X-if-non-nil
|
|
|
|
|
;; not goto-X-if-non-nil --> goto-X-if-nil
|
|
|
|
|
;;
|
|
|
|
|
;; it is wrong to do the same thing for the -else-pop variants.
|
|
|
|
|
;;
|
|
|
|
|
((and (eq 'byte-not (car lap0))
|
2011-03-11 15:04:22 -05:00
|
|
|
|
(memq (car lap1) '(byte-goto-if-nil byte-goto-if-not-nil)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-log-lap " not %s\t-->\t%s"
|
|
|
|
|
lap1
|
|
|
|
|
(cons
|
|
|
|
|
(if (eq (car lap1) 'byte-goto-if-nil)
|
|
|
|
|
'byte-goto-if-not-nil
|
|
|
|
|
'byte-goto-if-nil)
|
|
|
|
|
(cdr lap1)))
|
|
|
|
|
(setcar lap1 (if (eq (car lap1) 'byte-goto-if-nil)
|
|
|
|
|
'byte-goto-if-not-nil
|
|
|
|
|
'byte-goto-if-nil))
|
|
|
|
|
(setq lap (delq lap0 lap))
|
2011-02-21 15:31:07 -05:00
|
|
|
|
(setq keep-going t))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
|
|
|
|
;; goto-X-if-nil goto-Y X: --> goto-Y-if-non-nil X:
|
|
|
|
|
;; goto-X-if-non-nil goto-Y X: --> goto-Y-if-nil X:
|
|
|
|
|
;;
|
|
|
|
|
;; it is wrong to do the same thing for the -else-pop variants.
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;;
|
2011-03-11 15:04:22 -05:00
|
|
|
|
((and (memq (car lap0)
|
|
|
|
|
'(byte-goto-if-nil byte-goto-if-not-nil)) ; gotoX
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(eq 'byte-goto (car lap1)) ; gotoY
|
|
|
|
|
(eq (cdr lap0) lap2)) ; TAG X
|
|
|
|
|
(let ((inverse (if (eq 'byte-goto-if-nil (car lap0))
|
|
|
|
|
'byte-goto-if-not-nil 'byte-goto-if-nil)))
|
|
|
|
|
(byte-compile-log-lap " %s %s %s:\t-->\t%s %s:"
|
|
|
|
|
lap0 lap1 lap2
|
|
|
|
|
(cons inverse (cdr lap1)) lap2)
|
2011-02-21 15:31:07 -05:00
|
|
|
|
(setq lap (delq lap0 lap))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(setcar lap1 inverse)
|
|
|
|
|
(setq keep-going t)))
|
|
|
|
|
;;
|
|
|
|
|
;; const goto-if-* --> whatever
|
|
|
|
|
;;
|
|
|
|
|
((and (eq 'byte-constant (car lap0))
|
Get rid of funvec.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
`byte-constant'.
(byte-compile-close-variables, displaying-byte-compile-warnings):
Add edebug spec.
(byte-compile-toplevel-file-form): New fun, split out of
byte-compile-file-form.
(byte-compile-from-buffer): Use it to avoid applying cconv
multiple times.
(byte-compile): Only strip `function' if it's present.
(byte-compile-lambda): Add `reserved-csts' argument.
Use new lexenv arg of byte-compile-top-level.
(byte-compile-reserved-constants): New var.
(byte-compile-constants-vector): Obey it.
(byte-compile-constants-vector): Handle new `byte-constant' form.
(byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
(byte-compile-form): Don't check callargs here.
(byte-compile-normal-call): Do it here instead.
(byte-compile-push-unknown-constant)
(byte-compile-resolve-unknown-constant): Remove, unused.
(byte-compile-make-closure): Use `make-byte-code' rather than `curry',
putting the environment into the "constant" pool.
(byte-compile-get-closed-var): Use special byte-constant.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
intermediate special form `internal-make-vector'.
(byte-optimize-lapcode): Handle new form of `byte-constant'.
* lisp/help-fns.el (describe-function-1): Don't handle funvecs.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
function if the content is a lambda expression, not if it's a closure.
* emacs-lisp/eieio-come.el: Remove.
* lisp/emacs-lisp/eieio.el: Don't require eieio-comp.
(defmethod): Do a bit more work to find the body and wrap it into
a function before passing it to eieio-defmethod.
(eieio-defmethod): New arg `code' for it.
* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
debugger backtrace.
* lisp/emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
more careful when quoting a function value.
* lisp/emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
(cconv-closure-convert-rec): Catch stray `internal-make-closure'.
* lisp/Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
* src/eval.c (Qcurry): Remove.
(funcall_funvec): Remove.
(funcall_lambda): Move new byte-code handling to reduce impact.
Treat all args as lexical in the case of lexbind.
(Fcurry): Remove.
* src/data.c (Qfunction_vector): Remove.
(Ffunvecp): Remove.
* src/lread.c (read1): Revert to calling make_byte_code here.
(read_vector): Don't call make_byte_code any more.
* src/lisp.h (enum pvec_type): Rename back to PVEC_COMPILED.
(XSETCOMPILED): Rename back from XSETFUNVEC.
(FUNVEC_SIZE): Remove.
(FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): Remove.
(COMPILEDP): Rename back from FUNVECP.
* src/fns.c (Felt): Remove unexplained FUNVEC check.
* src/doc.c (Fdocumentation): Don't handle funvec.
* src/alloc.c (make_funvec, Ffunvec): Remove.
* doc/lispref/vol2.texi (Top):
* doc/lispref/vol1.texi (Top):
* doc/lispref/objects.texi (Programming Types, Funvec Type, Type Predicates):
* doc/lispref/functions.texi (Functions, What Is a Function, FunctionCurrying):
* doc/lispref/elisp.texi (Top): Remove mentions of funvec and curry.
2011-02-24 22:27:45 -05:00
|
|
|
|
(memq (car lap1) byte-conditional-ops)
|
|
|
|
|
;; If the `byte-constant's cdr is not a cons cell, it has
|
|
|
|
|
;; to be an index into the constant pool); even though
|
|
|
|
|
;; it'll be a constant, that constant is not known yet
|
|
|
|
|
;; (it's typically a free variable of a closure, so will
|
|
|
|
|
;; only be known when the closure will be built at
|
|
|
|
|
;; run-time).
|
|
|
|
|
(consp (cdr lap0)))
|
2011-03-11 15:04:22 -05:00
|
|
|
|
(cond ((if (memq (car lap1) '(byte-goto-if-nil
|
|
|
|
|
byte-goto-if-nil-else-pop))
|
Get rid of funvec.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
`byte-constant'.
(byte-compile-close-variables, displaying-byte-compile-warnings):
Add edebug spec.
(byte-compile-toplevel-file-form): New fun, split out of
byte-compile-file-form.
(byte-compile-from-buffer): Use it to avoid applying cconv
multiple times.
(byte-compile): Only strip `function' if it's present.
(byte-compile-lambda): Add `reserved-csts' argument.
Use new lexenv arg of byte-compile-top-level.
(byte-compile-reserved-constants): New var.
(byte-compile-constants-vector): Obey it.
(byte-compile-constants-vector): Handle new `byte-constant' form.
(byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
(byte-compile-form): Don't check callargs here.
(byte-compile-normal-call): Do it here instead.
(byte-compile-push-unknown-constant)
(byte-compile-resolve-unknown-constant): Remove, unused.
(byte-compile-make-closure): Use `make-byte-code' rather than `curry',
putting the environment into the "constant" pool.
(byte-compile-get-closed-var): Use special byte-constant.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
intermediate special form `internal-make-vector'.
(byte-optimize-lapcode): Handle new form of `byte-constant'.
* lisp/help-fns.el (describe-function-1): Don't handle funvecs.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
function if the content is a lambda expression, not if it's a closure.
* emacs-lisp/eieio-come.el: Remove.
* lisp/emacs-lisp/eieio.el: Don't require eieio-comp.
(defmethod): Do a bit more work to find the body and wrap it into
a function before passing it to eieio-defmethod.
(eieio-defmethod): New arg `code' for it.
* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
debugger backtrace.
* lisp/emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
more careful when quoting a function value.
* lisp/emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
(cconv-closure-convert-rec): Catch stray `internal-make-closure'.
* lisp/Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
* src/eval.c (Qcurry): Remove.
(funcall_funvec): Remove.
(funcall_lambda): Move new byte-code handling to reduce impact.
Treat all args as lexical in the case of lexbind.
(Fcurry): Remove.
* src/data.c (Qfunction_vector): Remove.
(Ffunvecp): Remove.
* src/lread.c (read1): Revert to calling make_byte_code here.
(read_vector): Don't call make_byte_code any more.
* src/lisp.h (enum pvec_type): Rename back to PVEC_COMPILED.
(XSETCOMPILED): Rename back from XSETFUNVEC.
(FUNVEC_SIZE): Remove.
(FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): Remove.
(COMPILEDP): Rename back from FUNVECP.
* src/fns.c (Felt): Remove unexplained FUNVEC check.
* src/doc.c (Fdocumentation): Don't handle funvec.
* src/alloc.c (make_funvec, Ffunvec): Remove.
* doc/lispref/vol2.texi (Top):
* doc/lispref/vol1.texi (Top):
* doc/lispref/objects.texi (Programming Types, Funvec Type, Type Predicates):
* doc/lispref/functions.texi (Functions, What Is a Function, FunctionCurrying):
* doc/lispref/elisp.texi (Top): Remove mentions of funvec and curry.
2011-02-24 22:27:45 -05:00
|
|
|
|
(car (cdr lap0))
|
|
|
|
|
(not (car (cdr lap0))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-log-lap " %s %s\t-->\t<deleted>"
|
|
|
|
|
lap0 lap1)
|
|
|
|
|
(setq rest (cdr rest)
|
|
|
|
|
lap (delq lap0 (delq lap1 lap))))
|
|
|
|
|
(t
|
2010-06-13 16:36:17 -04:00
|
|
|
|
(byte-compile-log-lap " %s %s\t-->\t%s"
|
|
|
|
|
lap0 lap1
|
|
|
|
|
(cons 'byte-goto (cdr lap1)))
|
|
|
|
|
(when (memq (car lap1) byte-goto-always-pop-ops)
|
|
|
|
|
(setq lap (delq lap0 lap)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(setcar lap1 'byte-goto)))
|
Get rid of funvec.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
`byte-constant'.
(byte-compile-close-variables, displaying-byte-compile-warnings):
Add edebug spec.
(byte-compile-toplevel-file-form): New fun, split out of
byte-compile-file-form.
(byte-compile-from-buffer): Use it to avoid applying cconv
multiple times.
(byte-compile): Only strip `function' if it's present.
(byte-compile-lambda): Add `reserved-csts' argument.
Use new lexenv arg of byte-compile-top-level.
(byte-compile-reserved-constants): New var.
(byte-compile-constants-vector): Obey it.
(byte-compile-constants-vector): Handle new `byte-constant' form.
(byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
(byte-compile-form): Don't check callargs here.
(byte-compile-normal-call): Do it here instead.
(byte-compile-push-unknown-constant)
(byte-compile-resolve-unknown-constant): Remove, unused.
(byte-compile-make-closure): Use `make-byte-code' rather than `curry',
putting the environment into the "constant" pool.
(byte-compile-get-closed-var): Use special byte-constant.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
intermediate special form `internal-make-vector'.
(byte-optimize-lapcode): Handle new form of `byte-constant'.
* lisp/help-fns.el (describe-function-1): Don't handle funvecs.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
function if the content is a lambda expression, not if it's a closure.
* emacs-lisp/eieio-come.el: Remove.
* lisp/emacs-lisp/eieio.el: Don't require eieio-comp.
(defmethod): Do a bit more work to find the body and wrap it into
a function before passing it to eieio-defmethod.
(eieio-defmethod): New arg `code' for it.
* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
debugger backtrace.
* lisp/emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
more careful when quoting a function value.
* lisp/emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
(cconv-closure-convert-rec): Catch stray `internal-make-closure'.
* lisp/Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
* src/eval.c (Qcurry): Remove.
(funcall_funvec): Remove.
(funcall_lambda): Move new byte-code handling to reduce impact.
Treat all args as lexical in the case of lexbind.
(Fcurry): Remove.
* src/data.c (Qfunction_vector): Remove.
(Ffunvecp): Remove.
* src/lread.c (read1): Revert to calling make_byte_code here.
(read_vector): Don't call make_byte_code any more.
* src/lisp.h (enum pvec_type): Rename back to PVEC_COMPILED.
(XSETCOMPILED): Rename back from XSETFUNVEC.
(FUNVEC_SIZE): Remove.
(FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): Remove.
(COMPILEDP): Rename back from FUNVECP.
* src/fns.c (Felt): Remove unexplained FUNVEC check.
* src/doc.c (Fdocumentation): Don't handle funvec.
* src/alloc.c (make_funvec, Ffunvec): Remove.
* doc/lispref/vol2.texi (Top):
* doc/lispref/vol1.texi (Top):
* doc/lispref/objects.texi (Programming Types, Funvec Type, Type Predicates):
* doc/lispref/functions.texi (Functions, What Is a Function, FunctionCurrying):
* doc/lispref/elisp.texi (Top): Remove mentions of funvec and curry.
2011-02-24 22:27:45 -05:00
|
|
|
|
(setq keep-going t))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
|
|
|
|
;; varref-X varref-X --> varref-X dup
|
|
|
|
|
;; varref-X [dup ...] varref-X --> varref-X [dup ...] dup
|
Get rid of funvec.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
`byte-constant'.
(byte-compile-close-variables, displaying-byte-compile-warnings):
Add edebug spec.
(byte-compile-toplevel-file-form): New fun, split out of
byte-compile-file-form.
(byte-compile-from-buffer): Use it to avoid applying cconv
multiple times.
(byte-compile): Only strip `function' if it's present.
(byte-compile-lambda): Add `reserved-csts' argument.
Use new lexenv arg of byte-compile-top-level.
(byte-compile-reserved-constants): New var.
(byte-compile-constants-vector): Obey it.
(byte-compile-constants-vector): Handle new `byte-constant' form.
(byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
(byte-compile-form): Don't check callargs here.
(byte-compile-normal-call): Do it here instead.
(byte-compile-push-unknown-constant)
(byte-compile-resolve-unknown-constant): Remove, unused.
(byte-compile-make-closure): Use `make-byte-code' rather than `curry',
putting the environment into the "constant" pool.
(byte-compile-get-closed-var): Use special byte-constant.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
intermediate special form `internal-make-vector'.
(byte-optimize-lapcode): Handle new form of `byte-constant'.
* lisp/help-fns.el (describe-function-1): Don't handle funvecs.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
function if the content is a lambda expression, not if it's a closure.
* emacs-lisp/eieio-come.el: Remove.
* lisp/emacs-lisp/eieio.el: Don't require eieio-comp.
(defmethod): Do a bit more work to find the body and wrap it into
a function before passing it to eieio-defmethod.
(eieio-defmethod): New arg `code' for it.
* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
debugger backtrace.
* lisp/emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
more careful when quoting a function value.
* lisp/emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
(cconv-closure-convert-rec): Catch stray `internal-make-closure'.
* lisp/Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
* src/eval.c (Qcurry): Remove.
(funcall_funvec): Remove.
(funcall_lambda): Move new byte-code handling to reduce impact.
Treat all args as lexical in the case of lexbind.
(Fcurry): Remove.
* src/data.c (Qfunction_vector): Remove.
(Ffunvecp): Remove.
* src/lread.c (read1): Revert to calling make_byte_code here.
(read_vector): Don't call make_byte_code any more.
* src/lisp.h (enum pvec_type): Rename back to PVEC_COMPILED.
(XSETCOMPILED): Rename back from XSETFUNVEC.
(FUNVEC_SIZE): Remove.
(FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): Remove.
(COMPILEDP): Rename back from FUNVECP.
* src/fns.c (Felt): Remove unexplained FUNVEC check.
* src/doc.c (Fdocumentation): Don't handle funvec.
* src/alloc.c (make_funvec, Ffunvec): Remove.
* doc/lispref/vol2.texi (Top):
* doc/lispref/vol1.texi (Top):
* doc/lispref/objects.texi (Programming Types, Funvec Type, Type Predicates):
* doc/lispref/functions.texi (Functions, What Is a Function, FunctionCurrying):
* doc/lispref/elisp.texi (Top): Remove mentions of funvec and curry.
2011-02-24 22:27:45 -05:00
|
|
|
|
;; stackref-X [dup ...] stackref-X+N --> stackref-X [dup ...] dup
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;; We don't optimize the const-X variations on this here,
|
|
|
|
|
;; because that would inhibit some goto optimizations; we
|
|
|
|
|
;; optimize the const-X case after all other optimizations.
|
|
|
|
|
;;
|
2010-06-13 16:36:17 -04:00
|
|
|
|
((and (memq (car lap0) '(byte-varref byte-stack-ref))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(progn
|
2011-02-21 15:12:44 -05:00
|
|
|
|
(setq tmp (cdr rest))
|
|
|
|
|
(setq tmp2 0)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(while (eq (car (car tmp)) 'byte-dup)
|
2011-02-21 15:12:44 -05:00
|
|
|
|
(setq tmp2 (1+ tmp2))
|
|
|
|
|
(setq tmp (cdr tmp)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
t)
|
2011-02-21 15:12:44 -05:00
|
|
|
|
(eq (if (eq 'byte-stack-ref (car lap0))
|
|
|
|
|
(+ tmp2 1 (cdr lap0))
|
|
|
|
|
(cdr lap0))
|
|
|
|
|
(cdr (car tmp)))
|
|
|
|
|
(eq (car lap0) (car (car tmp))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(if (memq byte-optimize-log '(t byte))
|
|
|
|
|
(let ((str ""))
|
|
|
|
|
(setq tmp2 (cdr rest))
|
|
|
|
|
(while (not (eq tmp tmp2))
|
|
|
|
|
(setq tmp2 (cdr tmp2)
|
|
|
|
|
str (concat str " dup")))
|
|
|
|
|
(byte-compile-log-lap " %s%s %s\t-->\t%s%s dup"
|
|
|
|
|
lap0 str lap0 lap0 str)))
|
|
|
|
|
(setq keep-going t)
|
|
|
|
|
(setcar (car tmp) 'byte-dup)
|
|
|
|
|
(setcdr (car tmp) 0)
|
2011-02-21 15:31:07 -05:00
|
|
|
|
(setq rest tmp))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
|
|
|
|
;; TAG1: TAG2: --> TAG1: <deleted>
|
|
|
|
|
;; (and other references to TAG2 are replaced with TAG1)
|
|
|
|
|
;;
|
|
|
|
|
((and (eq (car lap0) 'TAG)
|
|
|
|
|
(eq (car lap1) 'TAG))
|
|
|
|
|
(and (memq byte-optimize-log '(t byte))
|
1993-06-09 11:59:12 +00:00
|
|
|
|
(byte-compile-log " adjacent tags %d and %d merged"
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(nth 1 lap1) (nth 1 lap0)))
|
|
|
|
|
(setq tmp3 lap)
|
|
|
|
|
(while (setq tmp2 (rassq lap0 tmp3))
|
|
|
|
|
(setcdr tmp2 lap1)
|
|
|
|
|
(setq tmp3 (cdr (memq tmp2 tmp3))))
|
|
|
|
|
(setq lap (delq lap0 lap)
|
|
|
|
|
keep-going t))
|
|
|
|
|
;;
|
|
|
|
|
;; unused-TAG: --> <deleted>
|
|
|
|
|
;;
|
|
|
|
|
((and (eq 'TAG (car lap0))
|
|
|
|
|
(not (rassq lap0 lap)))
|
|
|
|
|
(and (memq byte-optimize-log '(t byte))
|
|
|
|
|
(byte-compile-log " unused tag %d removed" (nth 1 lap0)))
|
|
|
|
|
(setq lap (delq lap0 lap)
|
|
|
|
|
keep-going t))
|
|
|
|
|
;;
|
|
|
|
|
;; goto ... --> goto <delete until TAG or end>
|
|
|
|
|
;; return ... --> return <delete until TAG or end>
|
|
|
|
|
;;
|
|
|
|
|
((and (memq (car lap0) '(byte-goto byte-return))
|
|
|
|
|
(not (memq (car lap1) '(TAG nil))))
|
|
|
|
|
(setq tmp rest)
|
|
|
|
|
(let ((i 0)
|
|
|
|
|
(opt-p (memq byte-optimize-log '(t lap)))
|
|
|
|
|
str deleted)
|
|
|
|
|
(while (and (setq tmp (cdr tmp))
|
|
|
|
|
(not (eq 'TAG (car (car tmp)))))
|
|
|
|
|
(if opt-p (setq deleted (cons (car tmp) deleted)
|
|
|
|
|
str (concat str " %s")
|
|
|
|
|
i (1+ i))))
|
|
|
|
|
(if opt-p
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(let ((tagstr
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(if (eq 'TAG (car (car tmp)))
|
1995-07-21 20:57:25 +00:00
|
|
|
|
(format "%d:" (car (cdr (car tmp))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(or (car tmp) ""))))
|
|
|
|
|
(if (< i 6)
|
|
|
|
|
(apply 'byte-compile-log-lap-1
|
|
|
|
|
(concat " %s" str
|
|
|
|
|
" %s\t-->\t%s <deleted> %s")
|
|
|
|
|
lap0
|
|
|
|
|
(nconc (nreverse deleted)
|
|
|
|
|
(list tagstr lap0 tagstr)))
|
|
|
|
|
(byte-compile-log-lap
|
|
|
|
|
" %s <%d unreachable op%s> %s\t-->\t%s <deleted> %s"
|
|
|
|
|
lap0 i (if (= i 1) "" "s")
|
|
|
|
|
tagstr lap0 tagstr))))
|
|
|
|
|
(rplacd rest tmp))
|
|
|
|
|
(setq keep-going t))
|
|
|
|
|
;;
|
|
|
|
|
;; <safe-op> unbind --> unbind <safe-op>
|
|
|
|
|
;; (this may enable other optimizations.)
|
|
|
|
|
;;
|
|
|
|
|
((and (eq 'byte-unbind (car lap1))
|
|
|
|
|
(memq (car lap0) byte-after-unbind-ops))
|
|
|
|
|
(byte-compile-log-lap " %s %s\t-->\t%s %s" lap0 lap1 lap1 lap0)
|
|
|
|
|
(setcar rest lap1)
|
|
|
|
|
(setcar (cdr rest) lap0)
|
2011-02-21 15:31:07 -05:00
|
|
|
|
(setq keep-going t))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
|
|
|
|
;; varbind-X unbind-N --> discard unbind-(N-1)
|
|
|
|
|
;; save-excursion unbind-N --> unbind-(N-1)
|
|
|
|
|
;; save-restriction unbind-N --> unbind-(N-1)
|
|
|
|
|
;;
|
|
|
|
|
((and (eq 'byte-unbind (car lap1))
|
|
|
|
|
(memq (car lap0) '(byte-varbind byte-save-excursion
|
|
|
|
|
byte-save-restriction))
|
|
|
|
|
(< 0 (cdr lap1)))
|
|
|
|
|
(if (zerop (setcdr lap1 (1- (cdr lap1))))
|
|
|
|
|
(delq lap1 rest))
|
|
|
|
|
(if (eq (car lap0) 'byte-varbind)
|
|
|
|
|
(setcar rest (cons 'byte-discard 0))
|
|
|
|
|
(setq lap (delq lap0 lap)))
|
|
|
|
|
(byte-compile-log-lap " %s %s\t-->\t%s %s"
|
|
|
|
|
lap0 (cons (car lap1) (1+ (cdr lap1)))
|
|
|
|
|
(if (eq (car lap0) 'byte-varbind)
|
|
|
|
|
(car rest)
|
|
|
|
|
(car (cdr rest)))
|
|
|
|
|
(if (and (/= 0 (cdr lap1))
|
|
|
|
|
(eq (car lap0) 'byte-varbind))
|
|
|
|
|
(car (cdr rest))
|
|
|
|
|
""))
|
|
|
|
|
(setq keep-going t))
|
|
|
|
|
;;
|
|
|
|
|
;; goto*-X ... X: goto-Y --> goto*-Y
|
|
|
|
|
;; goto-X ... X: return --> return
|
|
|
|
|
;;
|
|
|
|
|
((and (memq (car lap0) byte-goto-ops)
|
|
|
|
|
(memq (car (setq tmp (nth 1 (memq (cdr lap0) lap))))
|
|
|
|
|
'(byte-goto byte-return)))
|
|
|
|
|
(cond ((and (not (eq tmp lap0))
|
|
|
|
|
(or (eq (car lap0) 'byte-goto)
|
|
|
|
|
(eq (car tmp) 'byte-goto)))
|
|
|
|
|
(byte-compile-log-lap " %s [%s]\t-->\t%s"
|
|
|
|
|
(car lap0) tmp tmp)
|
|
|
|
|
(if (eq (car tmp) 'byte-return)
|
|
|
|
|
(setcar lap0 'byte-return))
|
|
|
|
|
(setcdr lap0 (cdr tmp))
|
|
|
|
|
(setq keep-going t))))
|
|
|
|
|
;;
|
|
|
|
|
;; goto-*-else-pop X ... X: goto-if-* --> whatever
|
|
|
|
|
;; goto-*-else-pop X ... X: discard --> whatever
|
|
|
|
|
;;
|
|
|
|
|
((and (memq (car lap0) '(byte-goto-if-nil-else-pop
|
|
|
|
|
byte-goto-if-not-nil-else-pop))
|
|
|
|
|
(memq (car (car (setq tmp (cdr (memq (cdr lap0) lap)))))
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(cons 'byte-discard byte-conditional-ops)))
|
|
|
|
|
(not (eq lap0 (car tmp))))
|
|
|
|
|
(setq tmp2 (car tmp))
|
|
|
|
|
(setq tmp3 (assq (car lap0) '((byte-goto-if-nil-else-pop
|
|
|
|
|
byte-goto-if-nil)
|
|
|
|
|
(byte-goto-if-not-nil-else-pop
|
|
|
|
|
byte-goto-if-not-nil))))
|
|
|
|
|
(if (memq (car tmp2) tmp3)
|
|
|
|
|
(progn (setcar lap0 (car tmp2))
|
|
|
|
|
(setcdr lap0 (cdr tmp2))
|
|
|
|
|
(byte-compile-log-lap " %s-else-pop [%s]\t-->\t%s"
|
|
|
|
|
(car lap0) tmp2 lap0))
|
|
|
|
|
;; Get rid of the -else-pop's and jump one step further.
|
|
|
|
|
(or (eq 'TAG (car (nth 1 tmp)))
|
|
|
|
|
(setcdr tmp (cons (byte-compile-make-tag)
|
|
|
|
|
(cdr tmp))))
|
|
|
|
|
(byte-compile-log-lap " %s [%s]\t-->\t%s <skip>"
|
|
|
|
|
(car lap0) tmp2 (nth 1 tmp3))
|
|
|
|
|
(setcar lap0 (nth 1 tmp3))
|
|
|
|
|
(setcdr lap0 (nth 1 tmp)))
|
|
|
|
|
(setq keep-going t))
|
|
|
|
|
;;
|
|
|
|
|
;; const goto-X ... X: goto-if-* --> whatever
|
|
|
|
|
;; const goto-X ... X: discard --> whatever
|
|
|
|
|
;;
|
|
|
|
|
((and (eq (car lap0) 'byte-constant)
|
|
|
|
|
(eq (car lap1) 'byte-goto)
|
|
|
|
|
(memq (car (car (setq tmp (cdr (memq (cdr lap1) lap)))))
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(cons 'byte-discard byte-conditional-ops)))
|
|
|
|
|
(not (eq lap1 (car tmp))))
|
|
|
|
|
(setq tmp2 (car tmp))
|
Get rid of funvec.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
`byte-constant'.
(byte-compile-close-variables, displaying-byte-compile-warnings):
Add edebug spec.
(byte-compile-toplevel-file-form): New fun, split out of
byte-compile-file-form.
(byte-compile-from-buffer): Use it to avoid applying cconv
multiple times.
(byte-compile): Only strip `function' if it's present.
(byte-compile-lambda): Add `reserved-csts' argument.
Use new lexenv arg of byte-compile-top-level.
(byte-compile-reserved-constants): New var.
(byte-compile-constants-vector): Obey it.
(byte-compile-constants-vector): Handle new `byte-constant' form.
(byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
(byte-compile-form): Don't check callargs here.
(byte-compile-normal-call): Do it here instead.
(byte-compile-push-unknown-constant)
(byte-compile-resolve-unknown-constant): Remove, unused.
(byte-compile-make-closure): Use `make-byte-code' rather than `curry',
putting the environment into the "constant" pool.
(byte-compile-get-closed-var): Use special byte-constant.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
intermediate special form `internal-make-vector'.
(byte-optimize-lapcode): Handle new form of `byte-constant'.
* lisp/help-fns.el (describe-function-1): Don't handle funvecs.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
function if the content is a lambda expression, not if it's a closure.
* emacs-lisp/eieio-come.el: Remove.
* lisp/emacs-lisp/eieio.el: Don't require eieio-comp.
(defmethod): Do a bit more work to find the body and wrap it into
a function before passing it to eieio-defmethod.
(eieio-defmethod): New arg `code' for it.
* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
debugger backtrace.
* lisp/emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
more careful when quoting a function value.
* lisp/emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
(cconv-closure-convert-rec): Catch stray `internal-make-closure'.
* lisp/Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
* src/eval.c (Qcurry): Remove.
(funcall_funvec): Remove.
(funcall_lambda): Move new byte-code handling to reduce impact.
Treat all args as lexical in the case of lexbind.
(Fcurry): Remove.
* src/data.c (Qfunction_vector): Remove.
(Ffunvecp): Remove.
* src/lread.c (read1): Revert to calling make_byte_code here.
(read_vector): Don't call make_byte_code any more.
* src/lisp.h (enum pvec_type): Rename back to PVEC_COMPILED.
(XSETCOMPILED): Rename back from XSETFUNVEC.
(FUNVEC_SIZE): Remove.
(FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): Remove.
(COMPILEDP): Rename back from FUNVECP.
* src/fns.c (Felt): Remove unexplained FUNVEC check.
* src/doc.c (Fdocumentation): Don't handle funvec.
* src/alloc.c (make_funvec, Ffunvec): Remove.
* doc/lispref/vol2.texi (Top):
* doc/lispref/vol1.texi (Top):
* doc/lispref/objects.texi (Programming Types, Funvec Type, Type Predicates):
* doc/lispref/functions.texi (Functions, What Is a Function, FunctionCurrying):
* doc/lispref/elisp.texi (Top): Remove mentions of funvec and curry.
2011-02-24 22:27:45 -05:00
|
|
|
|
(cond ((when (consp (cdr lap0))
|
|
|
|
|
(memq (car tmp2)
|
|
|
|
|
(if (null (car (cdr lap0)))
|
|
|
|
|
'(byte-goto-if-nil byte-goto-if-nil-else-pop)
|
|
|
|
|
'(byte-goto-if-not-nil
|
|
|
|
|
byte-goto-if-not-nil-else-pop))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(byte-compile-log-lap " %s goto [%s]\t-->\t%s %s"
|
|
|
|
|
lap0 tmp2 lap0 tmp2)
|
|
|
|
|
(setcar lap1 (car tmp2))
|
|
|
|
|
(setcdr lap1 (cdr tmp2))
|
|
|
|
|
;; Let next step fix the (const,goto-if*) sequence.
|
Get rid of funvec.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
`byte-constant'.
(byte-compile-close-variables, displaying-byte-compile-warnings):
Add edebug spec.
(byte-compile-toplevel-file-form): New fun, split out of
byte-compile-file-form.
(byte-compile-from-buffer): Use it to avoid applying cconv
multiple times.
(byte-compile): Only strip `function' if it's present.
(byte-compile-lambda): Add `reserved-csts' argument.
Use new lexenv arg of byte-compile-top-level.
(byte-compile-reserved-constants): New var.
(byte-compile-constants-vector): Obey it.
(byte-compile-constants-vector): Handle new `byte-constant' form.
(byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
(byte-compile-form): Don't check callargs here.
(byte-compile-normal-call): Do it here instead.
(byte-compile-push-unknown-constant)
(byte-compile-resolve-unknown-constant): Remove, unused.
(byte-compile-make-closure): Use `make-byte-code' rather than `curry',
putting the environment into the "constant" pool.
(byte-compile-get-closed-var): Use special byte-constant.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
intermediate special form `internal-make-vector'.
(byte-optimize-lapcode): Handle new form of `byte-constant'.
* lisp/help-fns.el (describe-function-1): Don't handle funvecs.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
function if the content is a lambda expression, not if it's a closure.
* emacs-lisp/eieio-come.el: Remove.
* lisp/emacs-lisp/eieio.el: Don't require eieio-comp.
(defmethod): Do a bit more work to find the body and wrap it into
a function before passing it to eieio-defmethod.
(eieio-defmethod): New arg `code' for it.
* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
debugger backtrace.
* lisp/emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
more careful when quoting a function value.
* lisp/emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
(cconv-closure-convert-rec): Catch stray `internal-make-closure'.
* lisp/Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
* src/eval.c (Qcurry): Remove.
(funcall_funvec): Remove.
(funcall_lambda): Move new byte-code handling to reduce impact.
Treat all args as lexical in the case of lexbind.
(Fcurry): Remove.
* src/data.c (Qfunction_vector): Remove.
(Ffunvecp): Remove.
* src/lread.c (read1): Revert to calling make_byte_code here.
(read_vector): Don't call make_byte_code any more.
* src/lisp.h (enum pvec_type): Rename back to PVEC_COMPILED.
(XSETCOMPILED): Rename back from XSETFUNVEC.
(FUNVEC_SIZE): Remove.
(FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): Remove.
(COMPILEDP): Rename back from FUNVECP.
* src/fns.c (Felt): Remove unexplained FUNVEC check.
* src/doc.c (Fdocumentation): Don't handle funvec.
* src/alloc.c (make_funvec, Ffunvec): Remove.
* doc/lispref/vol2.texi (Top):
* doc/lispref/vol1.texi (Top):
* doc/lispref/objects.texi (Programming Types, Funvec Type, Type Predicates):
* doc/lispref/functions.texi (Functions, What Is a Function, FunctionCurrying):
* doc/lispref/elisp.texi (Top): Remove mentions of funvec and curry.
2011-02-24 22:27:45 -05:00
|
|
|
|
(setq rest (cons nil rest))
|
|
|
|
|
(setq keep-going t))
|
|
|
|
|
((or (consp (cdr lap0))
|
|
|
|
|
(eq (car tmp2) 'byte-discard))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;; Jump one step further
|
|
|
|
|
(byte-compile-log-lap
|
|
|
|
|
" %s goto [%s]\t-->\t<deleted> goto <skip>"
|
|
|
|
|
lap0 tmp2)
|
|
|
|
|
(or (eq 'TAG (car (nth 1 tmp)))
|
|
|
|
|
(setcdr tmp (cons (byte-compile-make-tag)
|
|
|
|
|
(cdr tmp))))
|
|
|
|
|
(setcdr lap1 (car (cdr tmp)))
|
Get rid of funvec.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
`byte-constant'.
(byte-compile-close-variables, displaying-byte-compile-warnings):
Add edebug spec.
(byte-compile-toplevel-file-form): New fun, split out of
byte-compile-file-form.
(byte-compile-from-buffer): Use it to avoid applying cconv
multiple times.
(byte-compile): Only strip `function' if it's present.
(byte-compile-lambda): Add `reserved-csts' argument.
Use new lexenv arg of byte-compile-top-level.
(byte-compile-reserved-constants): New var.
(byte-compile-constants-vector): Obey it.
(byte-compile-constants-vector): Handle new `byte-constant' form.
(byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
(byte-compile-form): Don't check callargs here.
(byte-compile-normal-call): Do it here instead.
(byte-compile-push-unknown-constant)
(byte-compile-resolve-unknown-constant): Remove, unused.
(byte-compile-make-closure): Use `make-byte-code' rather than `curry',
putting the environment into the "constant" pool.
(byte-compile-get-closed-var): Use special byte-constant.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
intermediate special form `internal-make-vector'.
(byte-optimize-lapcode): Handle new form of `byte-constant'.
* lisp/help-fns.el (describe-function-1): Don't handle funvecs.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
function if the content is a lambda expression, not if it's a closure.
* emacs-lisp/eieio-come.el: Remove.
* lisp/emacs-lisp/eieio.el: Don't require eieio-comp.
(defmethod): Do a bit more work to find the body and wrap it into
a function before passing it to eieio-defmethod.
(eieio-defmethod): New arg `code' for it.
* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
debugger backtrace.
* lisp/emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
more careful when quoting a function value.
* lisp/emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
(cconv-closure-convert-rec): Catch stray `internal-make-closure'.
* lisp/Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
* src/eval.c (Qcurry): Remove.
(funcall_funvec): Remove.
(funcall_lambda): Move new byte-code handling to reduce impact.
Treat all args as lexical in the case of lexbind.
(Fcurry): Remove.
* src/data.c (Qfunction_vector): Remove.
(Ffunvecp): Remove.
* src/lread.c (read1): Revert to calling make_byte_code here.
(read_vector): Don't call make_byte_code any more.
* src/lisp.h (enum pvec_type): Rename back to PVEC_COMPILED.
(XSETCOMPILED): Rename back from XSETFUNVEC.
(FUNVEC_SIZE): Remove.
(FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): Remove.
(COMPILEDP): Rename back from FUNVECP.
* src/fns.c (Felt): Remove unexplained FUNVEC check.
* src/doc.c (Fdocumentation): Don't handle funvec.
* src/alloc.c (make_funvec, Ffunvec): Remove.
* doc/lispref/vol2.texi (Top):
* doc/lispref/vol1.texi (Top):
* doc/lispref/objects.texi (Programming Types, Funvec Type, Type Predicates):
* doc/lispref/functions.texi (Functions, What Is a Function, FunctionCurrying):
* doc/lispref/elisp.texi (Top): Remove mentions of funvec and curry.
2011-02-24 22:27:45 -05:00
|
|
|
|
(setq lap (delq lap0 lap))
|
|
|
|
|
(setq keep-going t))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
|
|
|
|
;; X: varref-Y ... varset-Y goto-X -->
|
|
|
|
|
;; X: varref-Y Z: ... dup varset-Y goto-Z
|
|
|
|
|
;; (varset-X goto-BACK, BACK: varref-X --> copy the varref down.)
|
|
|
|
|
;; (This is so usual for while loops that it is worth handling).
|
2011-02-21 15:12:44 -05:00
|
|
|
|
;;
|
|
|
|
|
;; Here again, we could do it for stack-ref/stack-set, but
|
|
|
|
|
;; that's replacing a stack-ref-Y with a stack-ref-0, which
|
|
|
|
|
;; is a very minor improvement (if any), at the cost of
|
|
|
|
|
;; more stack use and more byte-code. Let's not do it.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
2011-02-21 15:12:44 -05:00
|
|
|
|
((and (eq (car lap1) 'byte-varset)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(eq (car lap2) 'byte-goto)
|
|
|
|
|
(not (memq (cdr lap2) rest)) ;Backwards jump
|
|
|
|
|
(eq (car (car (setq tmp (cdr (memq (cdr lap2) lap)))))
|
2011-02-21 15:31:07 -05:00
|
|
|
|
'byte-varref)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(eq (cdr (car tmp)) (cdr lap1))
|
2011-02-21 15:31:07 -05:00
|
|
|
|
(not (memq (car (cdr lap1)) byte-boolean-vars)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;(byte-compile-log-lap " Pulled %s to end of loop" (car tmp))
|
|
|
|
|
(let ((newtag (byte-compile-make-tag)))
|
|
|
|
|
(byte-compile-log-lap
|
|
|
|
|
" %s: %s ... %s %s\t-->\t%s: %s %s: ... %s %s %s"
|
|
|
|
|
(nth 1 (cdr lap2)) (car tmp)
|
|
|
|
|
lap1 lap2
|
|
|
|
|
(nth 1 (cdr lap2)) (car tmp)
|
|
|
|
|
(nth 1 newtag) 'byte-dup lap1
|
|
|
|
|
(cons 'byte-goto newtag)
|
|
|
|
|
)
|
|
|
|
|
(setcdr rest (cons (cons 'byte-dup 0) (cdr rest)))
|
|
|
|
|
(setcdr tmp (cons (setcdr lap2 newtag) (cdr tmp))))
|
|
|
|
|
(setq add-depth 1)
|
|
|
|
|
(setq keep-going t))
|
|
|
|
|
;;
|
|
|
|
|
;; goto-X Y: ... X: goto-if*-Y --> goto-if-not-*-X+1 Y:
|
|
|
|
|
;; (This can pull the loop test to the end of the loop)
|
|
|
|
|
;;
|
|
|
|
|
((and (eq (car lap0) 'byte-goto)
|
|
|
|
|
(eq (car lap1) 'TAG)
|
|
|
|
|
(eq lap1
|
|
|
|
|
(cdr (car (setq tmp (cdr (memq (cdr lap0) lap))))))
|
|
|
|
|
(memq (car (car tmp))
|
|
|
|
|
'(byte-goto byte-goto-if-nil byte-goto-if-not-nil
|
|
|
|
|
byte-goto-if-nil-else-pop)))
|
|
|
|
|
;; (byte-compile-log-lap " %s %s, %s %s --> moved conditional"
|
|
|
|
|
;; lap0 lap1 (cdr lap0) (car tmp))
|
|
|
|
|
(let ((newtag (byte-compile-make-tag)))
|
|
|
|
|
(byte-compile-log-lap
|
|
|
|
|
"%s %s: ... %s: %s\t-->\t%s ... %s:"
|
|
|
|
|
lap0 (nth 1 lap1) (nth 1 (cdr lap0)) (car tmp)
|
|
|
|
|
(cons (cdr (assq (car (car tmp))
|
|
|
|
|
'((byte-goto-if-nil . byte-goto-if-not-nil)
|
|
|
|
|
(byte-goto-if-not-nil . byte-goto-if-nil)
|
|
|
|
|
(byte-goto-if-nil-else-pop .
|
|
|
|
|
byte-goto-if-not-nil-else-pop)
|
|
|
|
|
(byte-goto-if-not-nil-else-pop .
|
|
|
|
|
byte-goto-if-nil-else-pop))))
|
|
|
|
|
newtag)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(nth 1 newtag)
|
|
|
|
|
)
|
|
|
|
|
(setcdr tmp (cons (setcdr lap0 newtag) (cdr tmp)))
|
|
|
|
|
(if (eq (car (car tmp)) 'byte-goto-if-nil-else-pop)
|
|
|
|
|
;; We can handle this case but not the -if-not-nil case,
|
|
|
|
|
;; because we won't know which non-nil constant to push.
|
|
|
|
|
(setcdr rest (cons (cons 'byte-constant
|
|
|
|
|
(byte-compile-get-constant nil))
|
|
|
|
|
(cdr rest))))
|
|
|
|
|
(setcar lap0 (nth 1 (memq (car (car tmp))
|
|
|
|
|
'(byte-goto-if-nil-else-pop
|
|
|
|
|
byte-goto-if-not-nil
|
|
|
|
|
byte-goto-if-nil
|
|
|
|
|
byte-goto-if-not-nil
|
|
|
|
|
byte-goto byte-goto))))
|
|
|
|
|
)
|
2011-02-21 15:31:07 -05:00
|
|
|
|
(setq keep-going t))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
)
|
|
|
|
|
(setq rest (cdr rest)))
|
|
|
|
|
)
|
|
|
|
|
;; Cleanup stage:
|
|
|
|
|
;; Rebuild byte-compile-constants / byte-compile-variables.
|
|
|
|
|
;; Simple optimizations that would inhibit other optimizations if they
|
|
|
|
|
;; were done in the optimizing loop, and optimizations which there is no
|
2011-02-21 15:12:44 -05:00
|
|
|
|
;; need to do more than once.
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(setq byte-compile-constants nil
|
|
|
|
|
byte-compile-variables nil)
|
2011-02-21 15:31:07 -05:00
|
|
|
|
(setq rest lap)
|
2010-06-13 16:36:17 -04:00
|
|
|
|
(byte-compile-log-lap " ---- final pass")
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(while rest
|
|
|
|
|
(setq lap0 (car rest)
|
|
|
|
|
lap1 (nth 1 rest))
|
|
|
|
|
(if (memq (car lap0) byte-constref-ops)
|
2011-03-05 23:48:17 -05:00
|
|
|
|
(if (memq (car lap0) '(byte-constant byte-constant2))
|
2001-10-11 17:25:26 +00:00
|
|
|
|
(unless (memq (cdr lap0) byte-compile-constants)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(setq byte-compile-constants (cons (cdr lap0)
|
2001-10-11 17:25:26 +00:00
|
|
|
|
byte-compile-constants)))
|
|
|
|
|
(unless (memq (cdr lap0) byte-compile-variables)
|
|
|
|
|
(setq byte-compile-variables (cons (cdr lap0)
|
|
|
|
|
byte-compile-variables)))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(cond (;;
|
|
|
|
|
;; const-C varset-X const-C --> const-C dup varset-X
|
|
|
|
|
;; const-C varbind-X const-C --> const-C dup varbind-X
|
|
|
|
|
;;
|
|
|
|
|
(and (eq (car lap0) 'byte-constant)
|
|
|
|
|
(eq (car (nth 2 rest)) 'byte-constant)
|
2001-10-11 17:25:26 +00:00
|
|
|
|
(eq (cdr lap0) (cdr (nth 2 rest)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(memq (car lap1) '(byte-varbind byte-varset)))
|
|
|
|
|
(byte-compile-log-lap " %s %s %s\t-->\t%s dup %s"
|
|
|
|
|
lap0 lap1 lap0 lap0 lap1)
|
|
|
|
|
(setcar (cdr (cdr rest)) (cons (car lap1) (cdr lap1)))
|
|
|
|
|
(setcar (cdr rest) (cons 'byte-dup 0))
|
|
|
|
|
(setq add-depth 1))
|
|
|
|
|
;;
|
|
|
|
|
;; const-X [dup/const-X ...] --> const-X [dup ...] dup
|
|
|
|
|
;; varref-X [dup/varref-X ...] --> varref-X [dup ...] dup
|
|
|
|
|
;;
|
|
|
|
|
((memq (car lap0) '(byte-constant byte-varref))
|
|
|
|
|
(setq tmp rest
|
|
|
|
|
tmp2 nil)
|
|
|
|
|
(while (progn
|
|
|
|
|
(while (eq 'byte-dup (car (car (setq tmp (cdr tmp))))))
|
|
|
|
|
(and (eq (cdr lap0) (cdr (car tmp)))
|
|
|
|
|
(eq (car lap0) (car (car tmp)))))
|
|
|
|
|
(setcar tmp (cons 'byte-dup 0))
|
|
|
|
|
(setq tmp2 t))
|
|
|
|
|
(if tmp2
|
|
|
|
|
(byte-compile-log-lap
|
1995-07-21 20:57:25 +00:00
|
|
|
|
" %s [dup/%s]...\t-->\t%s dup..." lap0 lap0 lap0)))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
;;
|
|
|
|
|
;; unbind-N unbind-M --> unbind-(N+M)
|
|
|
|
|
;;
|
|
|
|
|
((and (eq 'byte-unbind (car lap0))
|
|
|
|
|
(eq 'byte-unbind (car lap1)))
|
|
|
|
|
(byte-compile-log-lap " %s %s\t-->\t%s" lap0 lap1
|
|
|
|
|
(cons 'byte-unbind
|
|
|
|
|
(+ (cdr lap0) (cdr lap1))))
|
|
|
|
|
(setq lap (delq lap0 lap))
|
|
|
|
|
(setcdr lap1 (+ (cdr lap1) (cdr lap0))))
|
2011-04-01 11:16:50 -04:00
|
|
|
|
|
2010-06-13 16:36:17 -04:00
|
|
|
|
;;
|
|
|
|
|
;; stack-set-M [discard/discardN ...] --> discardN-preserve-tos
|
|
|
|
|
;; stack-set-M [discard/discardN ...] --> discardN
|
|
|
|
|
;;
|
2011-02-21 15:12:44 -05:00
|
|
|
|
((and (eq (car lap0) 'byte-stack-set)
|
|
|
|
|
(memq (car lap1) '(byte-discard byte-discardN))
|
|
|
|
|
(progn
|
|
|
|
|
;; See if enough discard operations follow to expose or
|
|
|
|
|
;; destroy the value stored by the stack-set.
|
|
|
|
|
(setq tmp (cdr rest))
|
|
|
|
|
(setq tmp2 (1- (cdr lap0)))
|
|
|
|
|
(setq tmp3 0)
|
|
|
|
|
(while (memq (car (car tmp)) '(byte-discard byte-discardN))
|
|
|
|
|
(setq tmp3
|
|
|
|
|
(+ tmp3 (if (eq (car (car tmp)) 'byte-discard)
|
|
|
|
|
1
|
|
|
|
|
(cdr (car tmp)))))
|
|
|
|
|
(setq tmp (cdr tmp)))
|
|
|
|
|
(>= tmp3 tmp2)))
|
|
|
|
|
;; Do the optimization.
|
2010-06-13 16:36:17 -04:00
|
|
|
|
(setq lap (delq lap0 lap))
|
2011-02-21 15:12:44 -05:00
|
|
|
|
(setcar lap1
|
|
|
|
|
(if (= tmp2 tmp3)
|
2011-04-01 11:16:50 -04:00
|
|
|
|
;; The value stored is the new TOS, so pop one more
|
|
|
|
|
;; value (to get rid of the old value) using the
|
|
|
|
|
;; TOS-preserving discard operator.
|
2011-02-21 15:12:44 -05:00
|
|
|
|
'byte-discardN-preserve-tos
|
|
|
|
|
;; Otherwise, the value stored is lost, so just use a
|
|
|
|
|
;; normal discard.
|
|
|
|
|
'byte-discardN))
|
|
|
|
|
(setcdr lap1 (1+ tmp3))
|
2010-06-13 16:36:17 -04:00
|
|
|
|
(setcdr (cdr rest) tmp)
|
|
|
|
|
(byte-compile-log-lap " %s [discard/discardN]...\t-->\t%s"
|
2011-02-21 15:12:44 -05:00
|
|
|
|
lap0 lap1))
|
2010-06-13 16:36:17 -04:00
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;; discard/discardN/discardN-preserve-tos-X discard/discardN-Y -->
|
|
|
|
|
;; discardN-(X+Y)
|
|
|
|
|
;;
|
|
|
|
|
((and (memq (car lap0)
|
2011-04-01 11:16:50 -04:00
|
|
|
|
'(byte-discard byte-discardN
|
2010-06-13 16:36:17 -04:00
|
|
|
|
byte-discardN-preserve-tos))
|
|
|
|
|
(memq (car lap1) '(byte-discard byte-discardN)))
|
|
|
|
|
(setq lap (delq lap0 lap))
|
|
|
|
|
(byte-compile-log-lap
|
|
|
|
|
" %s %s\t-->\t(discardN %s)"
|
|
|
|
|
lap0 lap1
|
|
|
|
|
(+ (if (eq (car lap0) 'byte-discard) 1 (cdr lap0))
|
|
|
|
|
(if (eq (car lap1) 'byte-discard) 1 (cdr lap1))))
|
|
|
|
|
(setcdr lap1 (+ (if (eq (car lap0) 'byte-discard) 1 (cdr lap0))
|
|
|
|
|
(if (eq (car lap1) 'byte-discard) 1 (cdr lap1))))
|
2011-02-21 15:31:07 -05:00
|
|
|
|
(setcar lap1 'byte-discardN))
|
2010-06-13 16:36:17 -04:00
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;; discardN-preserve-tos-X discardN-preserve-tos-Y -->
|
|
|
|
|
;; discardN-preserve-tos-(X+Y)
|
|
|
|
|
;;
|
|
|
|
|
((and (eq (car lap0) 'byte-discardN-preserve-tos)
|
|
|
|
|
(eq (car lap1) 'byte-discardN-preserve-tos))
|
|
|
|
|
(setq lap (delq lap0 lap))
|
|
|
|
|
(setcdr lap1 (+ (cdr lap0) (cdr lap1)))
|
|
|
|
|
(byte-compile-log-lap " %s %s\t-->\t%s" lap0 lap1 (car rest)))
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;; discardN-preserve-tos return --> return
|
|
|
|
|
;; dup return --> return
|
|
|
|
|
;; stack-set-N return --> return ; where N is TOS-1
|
|
|
|
|
;;
|
2011-02-21 15:12:44 -05:00
|
|
|
|
((and (eq (car lap1) 'byte-return)
|
|
|
|
|
(or (memq (car lap0) '(byte-discardN-preserve-tos byte-dup))
|
|
|
|
|
(and (eq (car lap0) 'byte-stack-set)
|
|
|
|
|
(= (cdr lap0) 1))))
|
|
|
|
|
;; The byte-code interpreter will pop the stack for us, so
|
|
|
|
|
;; we can just leave stuff on it.
|
2010-06-13 16:36:17 -04:00
|
|
|
|
(setq lap (delq lap0 lap))
|
|
|
|
|
(byte-compile-log-lap " %s %s\t-->\t%s" lap0 lap1 lap1))
|
2011-02-21 15:12:44 -05:00
|
|
|
|
)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(setq rest (cdr rest)))
|
|
|
|
|
(setq byte-compile-maxdepth (+ byte-compile-maxdepth add-depth)))
|
|
|
|
|
lap)
|
|
|
|
|
|
1999-08-10 17:13:38 +00:00
|
|
|
|
(provide 'byte-opt)
|
1992-07-10 22:06:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; To avoid "lisp nesting exceeds max-lisp-eval-depth" when this file compiles
|
|
|
|
|
;; itself, compile some of its most used recursive functions (at load time).
|
|
|
|
|
;;
|
|
|
|
|
(eval-when-compile
|
1993-01-26 01:29:51 +00:00
|
|
|
|
(or (byte-code-function-p (symbol-function 'byte-optimize-form))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
(assq 'byte-code (symbol-function 'byte-optimize-form))
|
|
|
|
|
(let ((byte-optimize nil)
|
|
|
|
|
(byte-compile-warnings nil))
|
2007-10-12 03:00:05 +00:00
|
|
|
|
(mapc (lambda (x)
|
|
|
|
|
(or noninteractive (message "compiling %s..." x))
|
|
|
|
|
(byte-compile x)
|
|
|
|
|
(or noninteractive (message "compiling %s...done" x)))
|
|
|
|
|
'(byte-optimize-form
|
|
|
|
|
byte-optimize-body
|
|
|
|
|
byte-optimize-predicate
|
|
|
|
|
byte-optimize-binary-predicate
|
|
|
|
|
;; Inserted some more than necessary, to speed it up.
|
|
|
|
|
byte-optimize-form-code-walker
|
|
|
|
|
byte-optimize-lapcode))))
|
1992-07-10 22:06:47 +00:00
|
|
|
|
nil)
|
1992-07-22 16:55:01 +00:00
|
|
|
|
|
|
|
|
|
;;; byte-opt.el ends here
|