diff options
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/autoload.el | 44 | ||||
-rw-r--r-- | lisp/emacs-lisp/edebug.el | 32 | ||||
-rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 20 |
3 files changed, 73 insertions, 23 deletions
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index b399a29bfa0..767621adbd2 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -59,14 +59,29 @@ the section of autoloads for a file.") (defconst generate-autoload-section-trailer "\n;;;***\n" "String which indicates the end of the section of autoloads for a file.") -;; Forms which have doc-strings which should be printed specially. -;; A doc-string-elt property of ELT says that (nth ELT FORM) is -;; the doc-string in FORM. -;; Note: defconst and defvar should NOT be marked in this way. -;; We don't want to produce defconsts and defvars that make-docfile can -;; grok, because then it would grok them twice, once in foo.el (where they -;; are given with ;;;###autoload) and once in loaddefs.el. +;;; Forms which have doc-strings which should be printed specially. +;;; A doc-string-elt property of ELT says that (nth ELT FORM) is +;;; the doc-string in FORM. +;;; +;;; There used to be the following note here: +;;; ;;; Note: defconst and defvar should NOT be marked in this way. +;;; ;;; We don't want to produce defconsts and defvars that +;;; ;;; make-docfile can grok, because then it would grok them twice, +;;; ;;; once in foo.el (where they are given with ;;;###autoload) and +;;; ;;; once in loaddefs.el. +;;; +;;; Counter-note: Yes, they should be marked in this way. +;;; make-docfile only processes those files that are loaded into the +;;; dumped Emacs, and those files should never have anything +;;; autoloaded here. The above-feared problem only occurs with files +;;; which have autoloaded entries *and* are processed by make-docfile; +;;; there should be no such files. + (put 'autoload 'doc-string-elt 3) +(put 'defun 'doc-string-elt 3) +(put 'defvar 'doc-string-elt 3) +(put 'defconst 'doc-string-elt 3) +(put 'defmacro 'doc-string-elt 3) (defun generate-file-autoloads (file) "Insert at point a loaddefs autoload section for FILE. @@ -86,6 +101,21 @@ are used." (floating-output-format "%20e") (done-any nil) output-end) + + ;; If the autoload section we create here uses an absolute + ;; pathname for FILE in its header, and then Emacs is installed + ;; under a different path on another system, + ;; `update-autoloads-here' won't be able to find the files to be + ;; autoloaded. So, if FILE is in the same directory or a + ;; subdirectory of the current buffer's file, we'll make it + ;; relative to the current buffer's directory. + (setq file (expand-file-name file)) + (if (and (< (length default-directory) (length file)) + (string= default-directory + (substring file 0 (length default-directory)))) + (progn + (setq file (substring file (length default-directory))))) + (message "Generating autoloads for %s..." file) (save-excursion (set-buffer inbuf) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index d586367933b..2302f1704f8 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -175,7 +175,6 @@ ;; Put edebug.el in some directory in your load-path and byte-compile it. ;; Put the following forms in your .emacs file. -;; (setq edebug-global-prefix "...whatever you want") ; default is C-xX ;; (define-key emacs-lisp-mode-map "\^Xx" 'edebug-defun) ;; (autoload 'edebug-defun "edebug") ;; (autoload 'edebug-debug "edebug") @@ -459,17 +458,32 @@ if an error occurs, point is left at the error." )) -;; The standard eval-current-buffer doesn't use eval-region. -(if (not (fboundp 'edebug-emacs-eval-current-buffer)) - (fset 'edebug-emacs-eval-current-buffer - (symbol-function 'eval-current-buffer))) -;; (fset 'eval-current-buffer (symbol-function 'edebug-emacs-eval-current-buffer)) - -(defun eval-current-buffer (&optional edebug-e-c-b-output) +(defun edebug-eval-current-buffer (&optional edebug-e-c-b-output) "Call eval-region on the whole buffer." (interactive) (eval-region (point-min) (point-max) edebug-e-c-b-output)) +(defun edebug-eval-buffer (&optional buffer edebug-e-c-b-output) + "Call eval-region on the whole buffer." + (interactive "bEval buffer: ") + (save-excursion + (set-buffer buffer) + (eval-region (point-min) (point-max) edebug-e-c-b-output))) + +;; The standard eval-current-buffer doesn't use eval-region. +(if (and (fboundp 'eval-current-buffer) + (not (fboundp 'edebug-emacs-eval-current-buffer))) + (progn + (fset 'edebug-emacs-eval-current-buffer + (symbol-function 'eval-current-buffer)) + (fset 'eval-current-buffer 'edebug-eval-current-buffer))) +(if (and (fboundp 'eval-buffer) + (not (fboundp 'edebug-emacs-eval-buffer))) + (progn + (fset 'edebug-emacs-eval-buffer + (symbol-function 'eval-buffer)) + (fset 'eval-buffer 'edebug-eval-buffer))) + ;;;====================================================================== @@ -498,6 +512,7 @@ if an error occurs, point is left at the error." ;;; for more details. +;;;###autoload (defun edebug-defun () "Evaluate defun or defmacro, like eval-defun, but with edebug calls. Print its name in the minibuffer and leave point after any error it finds, @@ -2416,6 +2431,7 @@ Global commands prefixed by global-edbug-prefix: ;; Note that debug and its utilities must be byte-compiled to work, since ;; they depend on the backtrace looking a certain way. +;;;###autoload (defun edebug-debug (&rest debugger-args) "Replacement for debug. If an error or quit occurred and we are running an edebugged function, diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index f6fb07b0d2f..d3c1c519460 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -490,9 +490,11 @@ of the start of the containing expression." If optional arg ENDPOS is given, indent each line, stopping when ENDPOS is encountered." (interactive) - (let ((indent-stack (list nil)) (next-depth 0) last-depth bol - outer-loop-done inner-loop-done state this-indent - (last-point (point))) + (let ((indent-stack (list nil)) + (next-depth 0) + (starting-point (point)) + (last-point (point)) + last-depth bol outer-loop-done inner-loop-done state this-indent) ;; Get error now if we don't have a complete sexp after point. (save-excursion (forward-sexp 1)) (save-excursion @@ -529,10 +531,12 @@ ENDPOS is encountered." (setcar (nthcdr 5 state) nil)) (setq inner-loop-done t))) (and endpos - (while (<= next-depth 0) - (setq indent-stack (append indent-stack (list nil))) - (setq next-depth (1+ next-depth)) - (setq last-depth (1+ last-depth)))) + (<= next-depth 0) + (progn + (setq indent-stack (append indent-stack + (make-list (- next-depth) nil)) + last-depth (- last-depth next-depth) + next-depth 0))) (or outer-loop-done (setq outer-loop-done (<= next-depth 0))) (if outer-loop-done @@ -557,7 +561,7 @@ ENDPOS is encountered." (setq this-indent (car indent-stack)) (let ((val (calculate-lisp-indent (if (car indent-stack) (- (car indent-stack)) - last-point)))) + starting-point)))) (if (integerp val) (setcar indent-stack (setq this-indent val)) |