From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: file-name-shadow-mode Date: Sat, 19 Mar 2005 09:21:08 -0600 (CST) Message-ID: <200503191521.j2JFL8901509@raven.dms.auburn.edu> References: <200503180435.j2I4Z2R18621@raven.dms.auburn.edu> <87is3p5zp2.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1111245925 4344 80.91.229.2 (19 Mar 2005 15:25:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 19 Mar 2005 15:25:25 +0000 (UTC) Cc: miles@gnu.org, snogglethorpe@gmail.com, monnier@iro.umontreal.ca, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 19 16:25:24 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DCfp4-0007na-Qq for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2005 16:25:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DCg5m-0004qN-UD for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2005 10:42:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DCg5S-0004mz-DB for emacs-devel@gnu.org; Sat, 19 Mar 2005 10:42:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DCg5O-0004kZ-6Y for emacs-devel@gnu.org; Sat, 19 Mar 2005 10:41:58 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DCg5M-0004kV-Bu for emacs-devel@gnu.org; Sat, 19 Mar 2005 10:41:58 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DCflr-0006oi-Dw; Sat, 19 Mar 2005 10:21:47 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id j2JFLd9N020437; Sat, 19 Mar 2005 09:21:39 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j2JFL8901509; Sat, 19 Mar 2005 09:21:08 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: rms@gnu.org In-reply-to: (message from Richard Stallman on Fri, 18 Mar 2005 13:20:10 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:34773 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34773 The following four patches enable `file-name-shadow-mode' by default, preload rfn-eshadow.el and make define-minor-mode accept an :initialize argument. (It currently kind of accepts such an argument, but the result is that the macroexpanded defcustom contains two :initialize keywords, a bug.) To make things work correctly, I had to rearrange define-minor-mode to define the mode function before the defcustom. Apparently, this gives no compiler warnings (I checked), even though the function uses the mode variable, which is, in the new version, not yet defcustomed. The patches to loadup.el and src/Makefile.in are identical to those I sent earlier. I can install if desired. ===File ~/easy-mmode-diff=================================== *** easy-mmode.el 02 Nov 2004 08:26:43 -0600 1.55 --- easy-mmode.el 18 Mar 2005 18:25:25 -0600 *************** *** 131,150 **** (hook (intern (concat mode-name "-hook"))) (hook-on (intern (concat mode-name "-on-hook"))) (hook-off (intern (concat mode-name "-off-hook"))) ! keyw keymap-sym) ;; Check keys. (while (keywordp (setq keyw (car body))) (setq body (cdr body)) (case keyw ! (:init-value (setq init-value (pop body))) ! (:lighter (setq lighter (pop body))) ! (:global (setq globalp (pop body))) ! (:extra-args (setq extra-args (pop body))) ! (:group (setq group (nconc group (list :group (pop body))))) ! (:require (setq require (pop body))) ! (:keymap (setq keymap (pop body))) ! (t (push keyw extra-keywords) (push (pop body) extra-keywords)))) (setq keymap-sym (if (and keymap (symbolp keymap)) keymap (intern (concat mode-name "-map")))) --- 131,151 ---- (hook (intern (concat mode-name "-hook"))) (hook-on (intern (concat mode-name "-on-hook"))) (hook-off (intern (concat mode-name "-off-hook"))) ! keyw keymap-sym initialize) ;; Check keys. (while (keywordp (setq keyw (car body))) (setq body (cdr body)) (case keyw ! (:init-value (setq init-value (pop body))) ! (:lighter (setq lighter (pop body))) ! (:global (setq globalp (pop body))) ! (:extra-args (setq extra-args (pop body))) ! (:group (setq group (nconc group (list :group (pop body))))) ! (:initialize (setq initialize (list :initialize (pop body)))) ! (:require (setq require (pop body))) ! (:keymap (setq keymap (pop body))) ! (t (push keyw extra-keywords) (push (pop body) extra-keywords)))) (setq keymap-sym (if (and keymap (symbolp keymap)) keymap (intern (concat mode-name "-map")))) *************** *** 155,190 **** `(:group ',(or (custom-current-group) (intern (replace-regexp-in-string "-mode\\'" "" mode-name)))))) `(progn - ;; Define the variable to enable or disable the mode. - ,(if (not globalp) - `(progn - (defvar ,mode ,init-value ,(format "Non-nil if %s is enabled. - Use the command `%s' to change this variable." pretty-name mode)) - (make-variable-buffer-local ',mode)) - - (let ((curfile (or (and (boundp 'byte-compile-current-file) - byte-compile-current-file) - load-file-name))) - `(defcustom ,mode ,init-value - ,(format "Non-nil if %s is enabled. - See the command `%s' for a description of this minor-mode. - Setting this variable directly does not take effect; - use either \\[customize] or the function `%s'." - pretty-name mode mode) - :set 'custom-set-minor-mode - :initialize 'custom-initialize-default - ,@group - :type 'boolean - ,@(cond - ((not (and curfile require)) nil) - ((not (eq require t)) `(:require ,require)) - (t `(:require - ',(intern (file-name-nondirectory - (file-name-sans-extension curfile)))))) - ,@(nreverse extra-keywords)))) - ;; The actual function. (defun ,mode (&optional arg ,@extra-args) ,(or doc --- 156,165 ---- `(:group ',(or (custom-current-group) (intern (replace-regexp-in-string "-mode\\'" "" mode-name)))))) + (unless initialize + (setq initialize '(:initialize 'custom-initialize-default))) `(progn ;; The actual function. (defun ,mode (&optional arg ,@extra-args) ,(or doc *************** *** 219,225 **** ;; Return the new setting. ,mode) ! ;; Autoloading an easy-mmode-define-minor-mode autoloads ;; everything up-to-here. :autoload-end --- 194,228 ---- ;; Return the new setting. ,mode) ! ;; Define the variable to enable or disable the mode. ! ,(if (not globalp) ! `(progn ! (defvar ,mode ,init-value ,(format "Non-nil if %s is enabled. ! Use the command `%s' to change this variable." pretty-name mode)) ! (make-variable-buffer-local ',mode)) ! ! (let ((curfile (or (and (boundp 'byte-compile-current-file) ! byte-compile-current-file) ! load-file-name))) ! `(defcustom ,mode ,init-value ! ,(format "Non-nil if %s is enabled. ! See the command `%s' for a description of this minor-mode. ! Setting this variable directly does not take effect; ! use either \\[customize] or the function `%s'." ! pretty-name mode mode) ! :set 'custom-set-minor-mode ! ,@initialize ! ,@group ! :type 'boolean ! ,@(cond ! ((not (and curfile require)) nil) ! ((not (eq require t)) `(:require ,require)) ! (t `(:require ! ',(intern (file-name-nondirectory ! (file-name-sans-extension curfile)))))) ! ,@(nreverse extra-keywords)))) ! ! ;; Autoloading an easy-mmode-define-minor-mode autoloads ;; everything up-to-here. :autoload-end ============================================================ ===File ~/rfn-eshadow-diff================================== *** rfn-eshadow.el 02 Sep 2003 07:36:02 -0500 1.12 --- rfn-eshadow.el 18 Mar 2005 17:49:19 -0600 *************** *** 92,98 **** (symbol :tag "Property") (sexp :tag "Value"))))) - ;;;###autoload (defcustom file-name-shadow-properties '(face file-name-shadow field shadow) "Properties given to the `shadowed' part of a filename in the minibuffer. --- 92,97 ---- *************** *** 102,108 **** :type file-name-shadow-properties-custom-type :group 'minibuffer) - ;;;###autoload (defcustom file-name-shadow-tty-properties '(before-string "{" after-string "} " field shadow) "Properties given to the `shadowed' part of a filename in the minibuffer. --- 101,106 ---- *************** *** 195,201 **** ;;; `define-minor-mode' actually calls the mode-function if the ;;; associated variable is non-nil, which requires that all needed ;;; functions be already defined. [This is arguably a bug in d-m-m] - ;;;###autoload (define-minor-mode file-name-shadow-mode "Toggle File-Name Shadow mode. When active, any part of a filename being read in the minibuffer --- 193,198 ---- *************** *** 207,212 **** --- 204,211 ---- With prefix argument ARG, turn on if positive, otherwise off. Returns non-nil if the new state is enabled." :global t + :init-value t + :initialize 'custom-initialize-set :group 'minibuffer (if file-name-shadow-mode ;; Enable the mode ============================================================ ===File ~/loadup-diff======================================= *** loadup.el 27 Dec 2004 15:02:07 -0600 1.135 --- loadup.el 18 Mar 2005 15:15:11 -0600 *************** *** 192,197 **** --- 192,198 ---- (load "vc-hooks") (load "ediff-hook") + (load "rfn-eshadow") (message "%s" (garbage-collect)) ;If you want additional libraries to be preloaded and their ============================================================ ===File ~/src-Makefile.in-diff============================== *** Makefile.in 30 Nov 2004 16:57:14 -0600 1.307 --- Makefile.in 17 Mar 2005 20:58:22 -0600 *************** *** 779,784 **** --- 779,785 ---- ${lispsource}emacs-lisp/timer.elc \ ${lispsource}vc-hooks.elc \ ${lispsource}ediff-hook.elc \ + ${lispsource}rfn-eshadow.elc \ VMS_SUPPORT \ MSDOS_SUPPORT \ WINNT_SUPPORT \ *************** *** 870,875 **** --- 871,877 ---- ../lisp/emacs-lisp/timer.elc \ ../lisp/vc-hooks.elc \ ../lisp/ediff-hook.elc \ + ../lisp/rfn-eshadow.elc \ ../lisp/widget.elc \ ../lisp/window.elc \ ../lisp/version.el ============================================================