diff options
| author | Simon Marshall | 1996-02-29 08:19:46 +0000 |
|---|---|---|
| committer | Simon Marshall | 1996-02-29 08:19:46 +0000 |
| commit | eaec854f6da63816ecb10fe53c2836d7c875d496 (patch) | |
| tree | 1d732c5e45a9966b5cb1e30687ed859a63afcdfc | |
| parent | f47ad16c26389c2f05a19da64478f725957d076e (diff) | |
| download | emacs-eaec854f6da63816ecb10fe53c2836d7c875d496.tar.gz emacs-eaec854f6da63816ecb10fe53c2836d7c875d496.zip | |
Save if reqd in emacs-lisp-byte-compile-and-load.
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index df288f9339f..1970bd588b2 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -155,7 +155,7 @@ All commands in `shared-lisp-mode-map' are inherited by this map.") | |||
| 155 | (define-key map [byte-recompile] | 155 | (define-key map [byte-recompile] |
| 156 | '("Byte-recompile Directory..." . byte-recompile-directory)) | 156 | '("Byte-recompile Directory..." . byte-recompile-directory)) |
| 157 | (define-key map [emacs-byte-compile-and-load] | 157 | (define-key map [emacs-byte-compile-and-load] |
| 158 | '("Byte-compile And Load" . emacs-lisp-compile-and-load)) | 158 | '("Byte-compile And Load" . emacs-lisp-byte-compile-and-load)) |
| 159 | (define-key map [byte-compile] | 159 | (define-key map [byte-compile] |
| 160 | '("Byte-compile This File" . emacs-lisp-byte-compile)) | 160 | '("Byte-compile This File" . emacs-lisp-byte-compile)) |
| 161 | (define-key map [separator-eval] '("--")) | 161 | (define-key map [separator-eval] '("--")) |
| @@ -177,18 +177,20 @@ All commands in `shared-lisp-mode-map' are inherited by this map.") | |||
| 177 | (byte-compile-file buffer-file-name) | 177 | (byte-compile-file buffer-file-name) |
| 178 | (error "The buffer must be saved in a file first"))) | 178 | (error "The buffer must be saved in a file first"))) |
| 179 | 179 | ||
| 180 | (defun emacs-lisp-compile-and-load () | 180 | (defun emacs-lisp-byte-compile-and-load () |
| 181 | "Byte-compile the current file (if it has changed), then load compiled code." | 181 | "Byte-compile the current file (if it has changed), then load compiled code." |
| 182 | (interactive) | 182 | (interactive) |
| 183 | (or buffer-file-name | 183 | (or buffer-file-name |
| 184 | (error "The buffer must be saved in a file first")) | 184 | (error "The buffer must be saved in a file first")) |
| 185 | (require 'bytecomp) | 185 | (require 'bytecomp) |
| 186 | ;; Recompile if file or buffer has changed since last compilation. | 186 | ;; Recompile if file or buffer has changed since last compilation. |
| 187 | (or (buffer-modified-p) | 187 | (if (and (buffer-modified-p) |
| 188 | (file-newer-than-file-p (byte-compile-dest-file buffer-file-name) | 188 | (y-or-n-p (format "save buffer %s first? " (buffer-name)))) |
| 189 | buffer-file-name) | 189 | (save-buffer)) |
| 190 | (byte-compile-file buffer-file-name)) | 190 | (let ((compiled-file-name (byte-compile-dest-file buffer-file-name))) |
| 191 | (load-file (byte-compile-dest-file buffer-file-name))) | 191 | (if (file-newer-than-file-p compiled-file-name buffer-file-name) |
| 192 | (load-file compiled-file-name) | ||
| 193 | (byte-compile-file buffer-file-name t)))) | ||
| 192 | 194 | ||
| 193 | (defun emacs-lisp-mode () | 195 | (defun emacs-lisp-mode () |
| 194 | "Major mode for editing Lisp code to run in Emacs. | 196 | "Major mode for editing Lisp code to run in Emacs. |