emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: minibuffer-eldef


From: Miles Bader
Subject: Re: minibuffer-eldef
Date: Wed, 02 Jun 2004 18:50:12 +0900

address@hidden (Kim F. Storm) writes:
> Couldn't minibuffer-electric-default-mode automatically
> change (default X) to [X] ?

Hmmm, clever!

Try the attached patch, and then eval the following function and do:

   (setq minibuf-eldef-frob-function 'minibuf-eldef-squirk-default)

   (defun minibuf-eldef-squirk-default (overlay state)
     (cond (state
            (unless (overlay-get overlay 'replacement)
              (let ((string 
                     (buffer-substring (overlay-start overlay)
                                       (overlay-end overlay))))
                (setq string 
                      (replace-regexp-in-string " *(default `?\\(.*\\)'?)"
                                                " [\\1]"
                                                string))
                (overlay-put overlay 'replacement string)))
            (overlay-put overlay 'display (overlay-get overlay 'replacement)))
           (t
            (overlay-put overlay 'invisible t)
            (overlay-put overlay 'intangible t)
            (overlay-put overlay 'display nil))))


The only (slight) problem is that it uses a `display' property, which
can be annoying if you want to manually copy the value of the default
or something.  It could probably do something more clever like only
overlaying the bracketting portions of the default or something.

-Miles


Patch:

Attachment: +minibuf-default-frob.patch
Description: +minibuf-default-frob.patch

-- 
.Numeric stability is probably not all that important when you're guessing.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]