comparison lisp/emacs-lisp/lisp-mode.el @ 14116:5f985037b64f

(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.
author Karl Heuer <kwzh@gnu.org>
date Tue, 09 Jan 1996 23:19:05 +0000
parents 8107433d6a22
children 83f275dcd93a
comparison
equal deleted inserted replaced
14115:bc30354daf1f 14116:5f985037b64f
147 (define-key map [edebug-defun] 147 (define-key map [edebug-defun]
148 '("Instrument Function for Debugging" . edebug-defun)) 148 '("Instrument Function for Debugging" . edebug-defun))
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))
155 (define-key map [eval-region] '("Evaluate Region" . eval-region)) 157 (define-key map [eval-region] '("Evaluate Region" . eval-region))
156 (define-key map [eval-sexp] '("Evaluate Last S-expression" . eval-last-sexp)) 158 (define-key map [eval-sexp] '("Evaluate Last S-expression" . eval-last-sexp))
165 (defun emacs-lisp-byte-compile () 167 (defun emacs-lisp-byte-compile ()
166 "Byte compile the file containing the current buffer." 168 "Byte compile the file containing the current buffer."
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.
174 Commands: 189 Commands:
175 Delete converts tabs to spaces as it moves back. 190 Delete converts tabs to spaces as it moves back.