aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1996-01-09 23:19:05 +0000
committerKarl Heuer1996-01-09 23:19:05 +0000
commit767a11517eddccf7125e1e4a89c1cec187300db8 (patch)
tree0278eeea24d9f0d831af5062c970afe951eb8a83
parent9a71dcfd6de8329e96fa0c756f0f3a632286f9f1 (diff)
downloademacs-767a11517eddccf7125e1e4a89c1cec187300db8.tar.gz
emacs-767a11517eddccf7125e1e4a89c1cec187300db8.zip
(emacs-lisp-byte-compile): Fix error message.
(emacs-lisp-compile-and-load): New function. (emacs-lisp-mode-map): Add emacs-lisp-compile-and-load to menu bar.
-rw-r--r--lisp/emacs-lisp/lisp-mode.el17
1 files changed, 16 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 29ca7ecc4c3..453ccfcb264 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -149,6 +149,8 @@ All commands in `shared-lisp-mode-map' are inherited by this map.")
149 (define-key map [byte-recompile] 149 (define-key map [byte-recompile]
150 '("Byte-recompile Directory..." . byte-recompile-directory)) 150 '("Byte-recompile Directory..." . byte-recompile-directory))
151 (define-key map [byte-compile] 151 (define-key map [byte-compile]
152 '("Byte-compile And Load" . emacs-lisp-compile-and-load))
153 (define-key map [byte-compile]
152 '("Byte-compile This File" . emacs-lisp-byte-compile)) 154 '("Byte-compile This File" . emacs-lisp-byte-compile))
153 (define-key map [separator-eval] '("--")) 155 (define-key map [separator-eval] '("--"))
154 (define-key map [eval-buffer] '("Evaluate Buffer" . eval-current-buffer)) 156 (define-key map [eval-buffer] '("Evaluate Buffer" . eval-current-buffer))
@@ -167,7 +169,20 @@ All commands in `shared-lisp-mode-map' are inherited by this map.")
167 (interactive) 169 (interactive)
168 (if buffer-file-name 170 (if buffer-file-name
169 (byte-compile-file buffer-file-name) 171 (byte-compile-file buffer-file-name)
170 (error "The buffer must be saved in a file first."))) 172 (error "The buffer must be saved in a file first")))
173
174(defun emacs-lisp-compile-and-load ()
175 "Byte-compile the current file (if it has changed), then load compiled code."
176 (interactive)
177 (or buffer-file-name
178 (error "The buffer must be saved in a file first"))
179 (require 'bytecomp)
180 ;; Recompile if file or buffer has changed since last compilation.
181 (or (buffer-modified-p)
182 (file-newer-than-file-p (byte-compile-dest-file buffer-file-name)
183 buffer-file-name)
184 (byte-compile-file buffer-file-name))
185 (load-file (byte-compile-dest-file buffer-file-name)))
171 186
172(defun emacs-lisp-mode () 187(defun emacs-lisp-mode ()
173 "Major mode for editing Lisp code to run in Emacs. 188 "Major mode for editing Lisp code to run in Emacs.