From d47f3fc56f94c8e4d118fe4ad8ee7124c8bc7c9b Mon Sep 17 00:00:00 2001 From: Lute Kamstra Date: Thu, 26 May 2005 15:13:09 +0000 Subject: (reb-mode): Use run-mode-hooks. --- lisp/emacs-lisp/re-builder.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el index a2aed39d00a..8a53c202ed8 100644 --- a/lisp/emacs-lisp/re-builder.el +++ b/lisp/emacs-lisp/re-builder.el @@ -254,7 +254,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.") mode-name "RE Builder") (use-local-map reb-mode-map) (reb-mode-common) - (run-hooks 'reb-mode-hook)) + (run-mode-hooks 'reb-mode-hook)) (define-derived-mode reb-lisp-mode emacs-lisp-mode "RE Builder Lisp" -- cgit v1.2.3 From cbd87c94ac75cbc30b069dd56af48b30ab2952b0 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 30 May 2005 06:49:18 +0000 Subject: (byte-compile-nogroup-warn): Warn only when name to be defined is quoted. --- lisp/emacs-lisp/bytecomp.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e5b429604c7..3948dae610b 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1248,15 +1248,15 @@ extra args." (defun byte-compile-nogroup-warn (form) (let ((keyword-args (cdr (cdr (cdr (cdr form))))) (name (cadr form))) - (unless (plist-get keyword-args :group) - (byte-compile-warn - "%s for `%s' fails to specify containing group" - (cdr (assq (car form) - '((custom-declare-group . defgroup) - (custom-declare-face . defface) - (custom-declare-variable . defcustom)))) - (if (and (consp name) (eq (car name) 'quote)) - (cadr name) name))))) + (or (plist-get keyword-args :group) + (not (and (consp name) (eq (car name) 'quote))) + (byte-compile-warn + "%s for `%s' fails to specify containing group" + (cdr (assq (car form) + '((custom-declare-group . defgroup) + (custom-declare-face . defface) + (custom-declare-variable . defcustom)))) + (cadr name))))) ;; Warn if the function or macro is being redefined with a different ;; number of arguments. -- cgit v1.2.3 From 6dfa731f20bc5702c88f99297e60e41f1e27cbea Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Mon, 30 May 2005 18:06:02 +0000 Subject: * emacs-lisp/find-func.el (find-function-noselect): Handle subroutines. * help-fns.el (help-C-file-name): Added autoload mark for `find-function-noselect'. --- lisp/ChangeLog | 8 ++++++++ lisp/emacs-lisp/find-func.el | 4 ++-- lisp/help-fns.el | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1b67921f88b..f09d6f816b2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2005-05-31 Masatake YAMATO + + * emacs-lisp/find-func.el (find-function-noselect): Handle + subroutines. + + * help-fns.el (help-C-file-name): Added autoload mark for + `find-function-noselect'. + 2005-05-30 Glenn Morris * calendar/diary-lib.el (mark-included-diary-files): Only kill diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index eab957e5671..9a0a1606953 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -246,8 +246,6 @@ searched for in `find-function-source-path' if non nil, otherwise in `load-path'." (if (not function) (error "You didn't specify a function")) - (and (subrp (symbol-function function)) - (error "%s is a primitive function" function)) (let ((def (symbol-function function)) aliases) (while (symbolp def) @@ -265,6 +263,8 @@ in `load-path'." (let ((library (cond ((eq (car-safe def) 'autoload) (nth 1 def)) + ((subrp def) + (help-C-file-name def 'subr)) ((symbol-file function 'defun))))) (find-function-search-for-symbol function nil library)))) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index c11aaf6da76..b5e22bf1855 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -224,7 +224,7 @@ ARGLIST can also be t or a string of the form \"(FUN ARG1 ARG2 ...)\"." ;;; (symbol-file (if (symbolp subr-or-var) subr-or-var ;;; (subr-name subr-or-var)) ;;; (if (eq kind 'var) 'defvar 'defun))) - +;;;###autoload (defun help-C-file-name (subr-or-var kind) "Return the name of the C file where SUBR-OR-VAR is defined. KIND should be `var' for a variable or `subr' for a subroutine." -- cgit v1.2.3 From 358e4d6d1db0b101d2862f97475f6e5999f8bfa0 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 1 Jun 2005 15:33:50 +0000 Subject: (defsetf): Improve argument/docstring consistency. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/cl-macs.el | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8312df06d6e..4ea507543e6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2005-06-01 Juanma Barranquero + * emacs-lisp/cl-macs.el (defsetf): + Improve argument/docstring consistency. + * faces.el (list-faces-display): Improve the formatting by computing the maximum length required for any face-name (reworked patch of 1999-01-11, accidentally deleted on 1999-07-21). diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 4a01181e777..0301476afc2 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -1565,14 +1565,21 @@ form. See `defsetf' for a simpler way to define most setf-methods. This macro is an easy-to-use substitute for `define-setf-method' that works well for simple place forms. In the simple `defsetf' form, `setf's of the form (setf (NAME ARGS...) VAL) are transformed to function or macro -calls of the form (FUNC ARGS... VAL). Example: (defsetf aref aset). +calls of the form (FUNC ARGS... VAL). Example: + + (defsetf aref aset) + Alternate form: (defsetf NAME ARGLIST (STORE) BODY...). Here, the above `setf' call is expanded by binding the argument forms ARGS according to ARGLIST, binding the value form VAL to STORE, then executing BODY, which must return a Lisp form that does the necessary `setf' operation. Actually, ARGLIST and STORE may be bound to temporary variables which are introduced automatically to preserve proper execution order of the arguments. -Example: (defsetf nth (n x) (v) (list 'setcar (list 'nthcdr n x) v))." +Example: + + (defsetf nth (n x) (v) (list 'setcar (list 'nthcdr n x) v)) + +\(fn NAME [FUNC | ARGLIST (STORE) BODY...])" (if (listp arg1) (let* ((largs nil) (largsr nil) (temps nil) (tempsr nil) -- cgit v1.2.3 From 6cb9fac363905e93faae5304e1700bc3bfb65534 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 1 Jun 2005 16:22:00 +0000 Subject: (easy-menu-return-item): Find menu items with a nil command binding. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/easymenu.el | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4ea507543e6..264c627ef54 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2005-06-01 Stefan Monnier + + * emacs-lisp/easymenu.el (easy-menu-return-item): Quick fix to find + menu items with a nil command binding. + 2005-06-01 Juanma Barranquero * emacs-lisp/cl-macs.el (defsetf): diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index b3160c9b752..3602e7412f1 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el @@ -1,6 +1,6 @@ ;;; easymenu.el --- support the easymenu interface for defining a menu -;; Copyright (C) 1994,96,98,1999,2000,2004 Free Software Foundation, Inc. +;; Copyright (C) 1994,96,98,1999,2000,2004,2005 Free Software Foundation, Inc. ;; Keywords: emulations ;; Author: Richard Stallman @@ -534,7 +534,7 @@ earlier by `easy-menu-define' or `easy-menu-create-menu'." (easy-menu-do-add-item map item before))) (defun easy-menu-item-present-p (map path name) - "In submenu of MAP with path PATH, return true iff item NAME is present. + "In submenu of MAP with path PATH, return non-nil iff item NAME is present. MAP and PATH are defined as in `easy-menu-add-item'. NAME should be a string, the name of the element to be looked for." (easy-menu-return-item (easy-menu-get-map map path) name)) @@ -552,7 +552,14 @@ NAME should be a string, the name of the element to be removed." "In menu MENU try to look for menu item with name NAME. If a menu item is found, return (NAME . item), otherwise return nil. If item is an old format item, a new format item is returned." - (let ((item (lookup-key menu (vector (easy-menu-intern name)))) + ;; The call to `lookup-key' also calls the C function `get_keyelt' which + ;; looks inside a menu-item to only return the actual command. This is + ;; not what we want here. We should either add an arg to lookup-key to be + ;; able to turn off this "feature", or else we could use map-keymap here. + ;; In the mean time, I just use `assq' which is an OK approximation since + ;; menus are rarely built from vectors or char-tables. + (let ((item (or (cdr (assq name menu)) + (lookup-key menu (vector (easy-menu-intern name))))) ret enable cache label) (cond ((stringp (car-safe item)) -- cgit v1.2.3 From 51a67d35dbbbe75a876ad796859165a4fef90e08 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 1 Jun 2005 16:22:43 +0000 Subject: 4-digit copyright years. --- lisp/emacs-lisp/easymenu.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index 3602e7412f1..982570fb348 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el @@ -1,6 +1,7 @@ ;;; easymenu.el --- support the easymenu interface for defining a menu -;; Copyright (C) 1994,96,98,1999,2000,2004,2005 Free Software Foundation, Inc. +;; Copyright (C) 1994, 1996, 1998, 1999, 2000, 2004, 2005 +;; Free Software Foundation, Inc. ;; Keywords: emulations ;; Author: Richard Stallman -- cgit v1.2.3 From 876daebc85940a3c6ff11c7077e1d74c87d87705 Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Sat, 4 Jun 2005 22:13:57 +0000 Subject: (define-global-minor-mode): Make it keep track of which major mode it enabled the minor mode for. Use find-file-hook again. Update docstring. --- lisp/emacs-lisp/easy-mmode.el | 66 ++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 19 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 188dc172e07..bb0fa666217 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -271,14 +271,26 @@ With zero or negative ARG turn mode off. TURN-ON is a function that will be called with no args in every buffer and that should try to turn MODE on if applicable for that buffer. KEYS is a list of CL-style keyword arguments: -:group to specify the custom group." +:group to specify the custom group. + +If MODE's set-up depends on the major mode in effect when it was +enabled, then disabling and reenabling MODE should make MODE work +correctly with the current major mode. This is important to +prevent problems with derived modes, that is, major modes that +call another major mode in their body." + (let* ((global-mode-name (symbol-name global-mode)) (pretty-name (easy-mmode-pretty-mode-name mode)) (pretty-global-name (easy-mmode-pretty-mode-name global-mode)) (group nil) (extra-args nil) - (buffers (intern (concat global-mode-name "-buffers"))) - (cmmh (intern (concat global-mode-name "-cmmh")))) + (MODE-buffers (intern (concat global-mode-name "-buffers"))) + (MODE-enable-in-buffers + (intern (concat global-mode-name "-enable-in-buffers"))) + (MODE-check-buffers + (intern (concat global-mode-name "-check-buffers"))) + (MODE-cmhh (intern (concat global-mode-name "-cmhh"))) + (MODE-major-mode (intern (concat (symbol-name mode) "-major-mode")))) ;; Check keys. (while (keywordp (car keys)) @@ -294,6 +306,8 @@ KEYS is a list of CL-style keyword arguments: "-mode\\'" "" (symbol-name mode)))))) `(progn + (defvar ,MODE-major-mode nil) + (make-variable-buffer-local ',MODE-major-mode) ;; The actual global minor-mode (define-minor-mode ,global-mode ,(format "Toggle %s in every buffer. @@ -306,10 +320,13 @@ in which `%s' turns it on." ;; Setup hook to handle future mode changes and new buffers. (if ,global-mode (progn - (add-hook 'after-change-major-mode-hook ',buffers) - (add-hook 'change-major-mode-hook ',cmmh)) - (remove-hook 'after-change-major-mode-hook ',buffers) - (remove-hook 'change-major-mode-hook ',cmmh)) + (add-hook 'after-change-major-mode-hook + ',MODE-enable-in-buffers) + (add-hook 'find-file-hook ',MODE-check-buffers) + (add-hook 'change-major-mode-hook ',MODE-cmhh)) + (remove-hook 'after-change-major-mode-hook ',MODE-enable-in-buffers) + (remove-hook 'find-file-hook ',MODE-check-buffers) + (remove-hook 'change-major-mode-hook ',MODE-cmhh)) ;; Go through existing buffers. (dolist (buf (buffer-list)) @@ -321,22 +338,33 @@ in which `%s' turns it on." :autoload-end ;; List of buffers left to process. - (defvar ,buffers nil) + (defvar ,MODE-buffers nil) ;; The function that calls TURN-ON in each buffer. - (defun ,buffers () - (remove-hook 'post-command-hook ',buffers) - (while ,buffers - (let ((buf (pop ,buffers))) - (when (buffer-live-p buf) - (with-current-buffer buf (,turn-on)))))) - (put ',buffers 'definition-name ',global-mode) + (defun ,MODE-enable-in-buffers () + (dolist (buf ,MODE-buffers) + (when (buffer-live-p buf) + (with-current-buffer buf + (if ,mode + (unless (eq ,MODE-major-mode major-mode) + (,mode -1) + (,turn-on) + (setq ,MODE-major-mode major-mode)) + (,turn-on) + (setq ,MODE-major-mode major-mode)))))) + (put ',MODE-enable-in-buffers 'definition-name ',global-mode) + + (defun ,MODE-check-buffers () + (,MODE-enable-in-buffers) + (setq ,MODE-buffers nil) + (remove-hook 'post-command-hook ',MODE-check-buffers)) + (put ',MODE-check-buffers 'definition-name ',global-mode) ;; The function that catches kill-all-local-variables. - (defun ,cmmh () - (add-to-list ',buffers (current-buffer)) - (add-hook 'post-command-hook ',buffers)) - (put ',cmmh 'definition-name ',global-mode)))) + (defun ,MODE-cmhh () + (add-to-list ',MODE-buffers (current-buffer)) + (add-hook 'post-command-hook ',MODE-check-buffers)) + (put ',MODE-cmhh 'definition-name ',global-mode)))) ;;; ;;; easy-mmode-defmap -- cgit v1.2.3