From 5410f047b388be86c427ba4c695555791de771e4 Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Thu, 12 Feb 2004 01:50:46 +0000 Subject: (lisp-mode-variables): Adapt outline-regexp to the new conventions for commenting out code. --- lisp/emacs-lisp/lisp-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/lisp-mode.el') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 04d00a2bdb5..c2dc3e6a16c 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -182,7 +182,7 @@ (make-local-variable 'parse-sexp-ignore-comments) (setq parse-sexp-ignore-comments t) (make-local-variable 'outline-regexp) - (setq outline-regexp ";;;;* \\|(") + (setq outline-regexp ";;;;* [^ \t\n]\\|(") (make-local-variable 'outline-level) (setq outline-level 'lisp-outline-level) (make-local-variable 'comment-start) -- cgit v1.2.3 From d8a8cbe26cfb2e0a72c14ad283e074fb723d6c6c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 8 Mar 2004 02:15:05 +0000 Subject: (lisp-mode-variables): Set it. --- lisp/emacs-lisp/lisp-mode.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/lisp-mode.el') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index c2dc3e6a16c..6b50318d3e6 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1,6 +1,6 @@ ;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands -;; Copyright (C) 1985, 1986, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. +;; Copyright (C) 1985,86,1999,2000,01,03,2004 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: lisp, languages @@ -197,6 +197,8 @@ (setq comment-column 40) (make-local-variable 'comment-indent-function) (setq comment-indent-function 'lisp-comment-indent) + ;; Don't get confused by `;' in doc strings when paragraph-filling. + (set (make-local-variable 'comment-use-global-state) t) (make-local-variable 'imenu-generic-expression) (setq imenu-generic-expression lisp-imenu-generic-expression) (make-local-variable 'multibyte-syntax-as-symbol) -- cgit v1.2.3 From 4f9d876485650e75947e8672f3a238df63777ee2 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 22 Mar 2004 15:31:46 +0000 Subject: (lisp-mode-variables): Don't set normal-auto-fill-function and comment-indent-function. The default values now work just as well. Don't set font-lock-beginning-of-syntax-function since we already set syntax-begin-function. (lisp-outline-level): Put ;;;###autoload at same level as (. (prin1-char): Quote special chars. --- lisp/emacs-lisp/lisp-mode.el | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'lisp/emacs-lisp/lisp-mode.el') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 6b50318d3e6..853498b0c8c 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -173,8 +173,6 @@ ;; because lisp-fill-paragraph should do the job. ;; I believe that newcomment's auto-fill code properly deals with it -stef ;;(set (make-local-variable 'adaptive-fill-mode) nil) - (make-local-variable 'normal-auto-fill-function) - (setq normal-auto-fill-function 'lisp-mode-auto-fill) (make-local-variable 'indent-line-function) (setq indent-line-function 'lisp-indent-line) (make-local-variable 'indent-region-function) @@ -195,8 +193,6 @@ (setq comment-add 1) ;default to `;;' in comment-region (make-local-variable 'comment-column) (setq comment-column 40) - (make-local-variable 'comment-indent-function) - (setq comment-indent-function 'lisp-comment-indent) ;; Don't get confused by `;' in doc strings when paragraph-filling. (set (make-local-variable 'comment-use-global-state) t) (make-local-variable 'imenu-generic-expression) @@ -207,14 +203,14 @@ (setq font-lock-defaults '((lisp-font-lock-keywords lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) - nil nil (("+-*/.<>=!?$%_&~^:" . "w")) beginning-of-defun + nil nil (("+-*/.<>=!?$%_&~^:" . "w")) nil (font-lock-mark-block-function . mark-defun) (font-lock-syntactic-face-function . lisp-font-lock-syntactic-face-function)))) (defun lisp-outline-level () "Lisp mode `outline-level' function." - (if (looking-at "(") + (if (looking-at "(\\|;;;###autoload") 1000 (looking-at outline-regexp) (- (match-end 0) (match-beginning 0)))) @@ -453,14 +449,18 @@ alternative printed representations that can be displayed." If CHAR is not a character, return nil." (and (integerp char) (char-valid-p (event-basic-type char)) - (concat - "?" - (mapconcat - (lambda (modif) - (cond ((eq modif 'super) "\\s-") - (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-)))) - (event-modifiers char) "") - (string (event-basic-type char))))) + (let ((c (event-basic-type char))) + (concat + "?" + (mapconcat + (lambda (modif) + (cond ((eq modif 'super) "\\s-") + (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-)))) + (event-modifiers char) "") + (cond + ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) + ((eq c 127) "\\C-?") + (t (string c))))))) (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in minibuffer. @@ -671,8 +671,8 @@ which see." ;; This function just forces a more costly detection of comments (using ;; parse-partial-sexp from beginning-of-defun). I.e. It avoids the problem of ;; taking a `;' inside a string started on another line for a comment starter. -;; Note: `newcomment' gets it right in 99% of the cases if you're using -;; font-lock, anyway, so we could get rid of it. -stef +;; Note: `newcomment' gets it right now since we set comment-use-global-state +;; so we could get rid of it. -stef (defun lisp-mode-auto-fill () (if (> (current-column) (current-fill-column)) (if (save-excursion -- cgit v1.2.3 From 7a439904ec5545434105348abfb1fc686c34c691 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 11 May 2004 03:17:59 +0000 Subject: (prin1-char): Use eventp. --- lisp/emacs-lisp/lisp-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/lisp-mode.el') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 853498b0c8c..4057fe2968e 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -448,7 +448,7 @@ alternative printed representations that can be displayed." "Return a string representing CHAR as a character rather than as an integer. If CHAR is not a character, return nil." (and (integerp char) - (char-valid-p (event-basic-type char)) + (eventp char) (let ((c (event-basic-type char))) (concat "?" -- cgit v1.2.3 From 59de4ad0fcace2f33f2fb5101f84bce6ea29aab2 Mon Sep 17 00:00:00 2001 From: Sam Steingold Date: Tue, 25 May 2004 20:51:06 +0000 Subject: (lisp-find-tag-default): Strip the package prefix from the symbol name, if any. Make it the `find-tag-default-function' for `lisp-mode'. --- lisp/ChangeLog | 8 +++++++- lisp/emacs-lisp/lisp-mode.el | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/lisp-mode.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b319197bac8..f264c04fca3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2004-05-25 Sam Steingold + + * emacs-lisp/lisp-mode.el (lisp-find-tag-default): New function: + strip the package prefix from the symbol name, if any. + Make it the `find-tag-default-function' for `lisp-mode'. + 2004-05-25 John Paul Wallington * gs.el (gs-load-image): Use `set-process-query-on-exit-flag' @@ -2515,7 +2521,7 @@ 2004-03-28 Stefan Monnier * vc-hooks.el (vc-file-not-found-hook): Fix typo. - From lorentey@elte.hu (L,Bu(Brentey K,Ba(Broly). + From lorentey@elte.hu (L$,1 q(Brentey K,Aa(Broly). 2004-03-27 Luc Teirlinck diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 4057fe2968e..fcc6517b747 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -355,6 +355,14 @@ if that value is non-nil." (setq imenu-case-fold-search t) (set-syntax-table lisp-mode-syntax-table) (run-mode-hooks 'lisp-mode-hook)) +(put 'lisp-mode 'find-tag-default-function 'lisp-find-tag-default) + +(defun lisp-find-tag-default () + (let ((default (find-tag-default))) + (when (stringp default) + (if (string-match ":+" default) + (substring default (match-end 0)) + default)))) ;; Used in old LispM code. (defalias 'common-lisp-mode 'lisp-mode) -- cgit v1.2.3 From 889bfc7d448e69692bc42a42a4a591b11059129d Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 28 May 2004 21:09:05 +0000 Subject: * emacs-lisp/lisp-mode.el (indent-pp-sexp): New fun. (emacs-lisp-mode-map, lisp-interaction-mode-map): Bind C-M-q to `indent-pp-sexp'. (eval-last-sexp-print-value): Print additionally the value returned by `eval-expression-print-format'. --- lisp/emacs-lisp/lisp-mode.el | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp/lisp-mode.el') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index fcc6517b747..1f53d9e630f 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -239,6 +239,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map.") (set-keymap-parent emacs-lisp-mode-map lisp-mode-shared-map) (define-key emacs-lisp-mode-map "\e\t" 'lisp-complete-symbol) (define-key emacs-lisp-mode-map "\e\C-x" 'eval-defun) + (define-key emacs-lisp-mode-map "\e\C-q" 'indent-pp-sexp) (define-key emacs-lisp-mode-map [menu-bar] (make-sparse-keymap)) (define-key emacs-lisp-mode-map [menu-bar emacs-lisp] (cons "Emacs-Lisp" map)) @@ -377,6 +378,7 @@ if that value is non-nil." (let ((map (make-sparse-keymap))) (set-keymap-parent map lisp-mode-shared-map) (define-key map "\e\C-x" 'eval-defun) + (define-key map "\e\C-q" 'indent-pp-sexp) (define-key map "\e\t" 'lisp-complete-symbol) (define-key map "\n" 'eval-print-last-sexp) map) @@ -532,13 +534,13 @@ With argument, print output into current buffer." (prin1-to-string value))) (print-length eval-expression-print-length) (print-level eval-expression-print-level) - (char-string (prin1-char value)) (beg (point)) end) (prog1 (prin1 value) - (if (and (eq standard-output t) char-string) - (princ (concat " = " char-string))) + (if (eq standard-output t) + (let ((str (eval-expression-print-format value))) + (if str (princ str)))) (setq end (point)) (when (and (bufferp standard-output) (or (not (null print-length)) @@ -1092,6 +1094,19 @@ ENDPOS is encountered." (indent-sexp endmark) (set-marker endmark nil)))) +(defun indent-pp-sexp (&optional arg) + "Indent each line of the list or, with prefix ARG, pretty-printify the list." + (interactive "P") + (if arg + (save-excursion + (save-restriction + (narrow-to-region (point) (progn (forward-sexp 1) (point))) + (pp-buffer) + (goto-char (point-max)) + (if (eq (char-before) ?\n) + (delete-char -1))))) + (indent-sexp)) + ;;;; Lisp paragraph filling commands. (defcustom emacs-lisp-docstring-fill-column 65 -- cgit v1.2.3 From 152472ba196b8c415045b3eecf8488c56b90d5da Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 29 May 2004 15:33:30 +0000 Subject: (prin1-char): Catch errors from `string'. (eval-last-sexp-print-value): Print char equivalent regardless of standard-output value. --- lisp/emacs-lisp/lisp-mode.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp/lisp-mode.el') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 1f53d9e630f..d6ac05642ba 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -470,7 +470,10 @@ If CHAR is not a character, return nil." (cond ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) ((eq c 127) "\\C-?") - (t (string c))))))) + (t + (condition-case nil + (string c) + (error nil)))))))) (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in minibuffer. @@ -538,9 +541,8 @@ With argument, print output into current buffer." end) (prog1 (prin1 value) - (if (eq standard-output t) - (let ((str (eval-expression-print-format value))) - (if str (princ str)))) + (let ((str (eval-expression-print-format value))) + (if str (princ str))) (setq end (point)) (when (and (bufferp standard-output) (or (not (null print-length)) -- cgit v1.2.3 From 217297f8ec4a85588fa65eea23c29e8ae9187ac4 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 10 Jun 2004 04:16:05 +0000 Subject: (eval-defun-1): Add `defface'. Fix docstring. --- lisp/emacs-lisp/lisp-mode.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp/lisp-mode.el') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index d6ac05642ba..d471ad79538 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -570,8 +570,9 @@ Interactively, with prefix argument, print output into current buffer." value))) (defun eval-defun-1 (form) - "Change defvar into defconst within FORM. -Likewise for other constructs as necessary." + "Treat some expressions specially. +Reset the `defvar' and `defcustom' variables to the initial value. +Reinitialize the face according to the `defface' specification." ;; The code in edebug-defun should be consistent with this, but not ;; the same, since this gets a macroexpended form. (cond ((not (listp form)) @@ -589,6 +590,13 @@ Likewise for other constructs as necessary." ;; Force variable to be bound. (set-default (eval (nth 1 form)) (eval (nth 1 (nth 2 form)))) form) + ;; `defface' is macroexpanded to `custom-declare-face'. + ((eq (car form) 'custom-declare-face) + ;; Reset the face. + (put (eval (nth 1 form)) 'face-defface-spec nil) + (setq face-new-frame-defaults + (assq-delete-all (eval (nth 1 form)) face-new-frame-defaults)) + form) ((eq (car form) 'progn) (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) (t form))) @@ -624,7 +632,7 @@ Return the result of evaluation." (setq beg (point)) (setq form (read (current-buffer))) (setq end (point))) - ;; Alter the form if necessary, changing defvar into defconst, etc. + ;; Alter the form if necessary. (setq form (eval-defun-1 (macroexpand form))) (list beg end standard-output `(lambda (ignore) -- cgit v1.2.3