comparison lisp/modes/lisp-mode.el @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 15872534500d
children 489f57a838ef
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
59 "---" 59 "---"
60 ["Debug On Error" (setq debug-on-error (not debug-on-error)) 60 ["Debug On Error" (setq debug-on-error (not debug-on-error))
61 :style toggle :selected debug-on-error] 61 :style toggle :selected debug-on-error]
62 ["Debug On Quit" (setq debug-on-quit (not debug-on-quit)) 62 ["Debug On Quit" (setq debug-on-quit (not debug-on-quit))
63 :style toggle :selected debug-on-quit] 63 :style toggle :selected debug-on-quit]
64 ["Debug on Signal" (setq debug-on-signal (not debug-on-signal))
65 :style toggle :selected debug-on-signal]
64 ))) 66 )))
65 67
66 (defvar emacs-lisp-mode-popup-menu nil) 68 (defvar emacs-lisp-mode-popup-menu nil)
67 (defvar emacs-lisp-mode-popup-menu-1 69 (defvar emacs-lisp-mode-popup-menu-1
68 (purecopy 70 (purecopy
374 (terpri) 376 (terpri)
375 (eval-last-sexp t) 377 (eval-last-sexp t)
376 (terpri))) 378 (terpri)))
377 379
378 ;; XEmacs change 380 ;; XEmacs change
381 (defcustom eval-interactive-verbose t
382 "*Non-nil means that interactive evaluation can print messages.
383 The messages are printed when the expression is treated differently
384 using `\\[eval-last-sexp]' and `\\[eval-defun]' than it than it would have been
385 treated noninteractively.
386
387 The printed messages are \"defvar treated as defconst\" and \"defcustom
388 evaluation forced\". See `eval-interactive' for more details."
389 :type 'boolean
390 :group 'lisp)
391
379 (defun eval-interactive (expr) 392 (defun eval-interactive (expr)
380 "Like `eval' except that it transforms defvars to defconsts." 393 "Like `eval' except that it transforms defvars to defconsts.
381 ;; by Stig@hackvan.com 394 The evaluation of defcustom forms is forced."
382 (cond ((and (consp expr) 395 (cond ((and (consp expr)
383 (eq (car expr) 'defvar) 396 (eq (car expr) 'defvar)
384 (> (length expr) 2)) 397 (> (length expr) 2))
385 (eval (cons 'defconst (cdr expr)))) 398 (eval (cons 'defconst (cdr expr)))
399 (and eval-interactive-verbose
400 (message "defvar treated as defconst"))
401 (sit-for 1)
402 (message "")
403 (nth 1 expr))
386 ((and (consp expr) 404 ((and (consp expr)
387 (eq (car expr) 'defcustom) 405 (eq (car expr) 'defcustom)
388 (> (length expr) 2)) 406 (> (length expr) 2)
389 (makunbound (nth 1 expr)) 407 (default-boundp (nth 1 expr)))
390 (eval expr)) 408 ;; Force variable to be bound
409 (set-default (nth 1 expr) (eval (nth 2 expr)))
410 ;; And evaluate the defcustom
411 (eval expr)
412 (and eval-interactive-verbose
413 (message "defcustom evaluation forced"))
414 (sit-for 1)
415 (message "")
416 (nth 1 expr))
391 (t 417 (t
392 (eval expr)))) 418 (eval expr))))
393 419
394 ;; XEmacs change, based on Bob Weiner suggestion 420 ;; XEmacs change, based on Bob Weiner suggestion
395 (defun eval-last-sexp (eval-last-sexp-arg-internal) ;dynamic scoping wonderment 421 (defun eval-last-sexp (eval-last-sexp-arg-internal) ;dynamic scoping wonderment
420 (defun eval-defun (eval-defun-arg-internal) 446 (defun eval-defun (eval-defun-arg-internal)
421 "Evaluate defun that point is in or before. 447 "Evaluate defun that point is in or before.
422 Print value in minibuffer. 448 Print value in minibuffer.
423 With argument, insert value in current buffer after the defun." 449 With argument, insert value in current buffer after the defun."
424 (interactive "P") 450 (interactive "P")
425 ;; XEmacs: FSF version works, so use it 451 (let ((standard-output (if eval-defun-arg-internal (current-buffer) t)))
426 (let ((standard-output (if eval-defun-arg-internal (current-buffer) t)) 452 (prin1 (eval-interactive (save-excursion
427 (form (save-excursion 453 (end-of-defun)
428 (end-of-defun) 454 (beginning-of-defun)
429 (beginning-of-defun) 455 (read (current-buffer)))))))
430 (read (current-buffer))))) 456
431 (cond ((and (eq (car form) 'defvar)
432 (cdr-safe (cdr-safe form)))
433 ;; Force variable to be bound.
434 (setq form (cons 'defconst (cdr form))))
435 ((and (eq (car form) 'defcustom)
436 (default-boundp (nth 1 form)))
437 ;; Force variable to be bound.
438 (set-default (nth 1 form) (eval (nth 2 form)))))
439 (prin1 (eval form))))
440 457
441 (defun lisp-comment-indent () 458 (defun lisp-comment-indent ()
442 (if (looking-at "\\s<\\s<\\s<") 459 (if (looking-at "\\s<\\s<\\s<")
443 (current-column) 460 (current-column)
444 (if (looking-at "\\s<\\s<") 461 (if (looking-at "\\s<\\s<")