all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Patch for completion-setup-function
@ 2004-07-25 18:36 Satyaki Das
  2004-07-26 23:58 ` Kevin Rodgers
  0 siblings, 1 reply; 3+ messages in thread
From: Satyaki Das @ 2004-07-25 18:36 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 422 bytes --]


Recently, I noticed the nifty highlighting for the first letter
that differs among the available choices during file completion.
This feature doesn't work perfectly for MH-E folder completion
since the regexp to recognize the root is hardcoded.

The attached patch to simple.el changes this.  If this patch were
applied then I could just bind the variable and make the
highlighting work better in MH-E.

Thanks,
Saytaki


[-- Attachment #2: Patch for completion-setup-function --]
[-- Type: text/plain, Size: 871 bytes --]

Index: simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.651
diff -u -r1.651 simple.el
--- simple.el	23 Jul 2004 11:52:03 -0000	1.651
+++ simple.el	25 Jul 2004 18:26:52 -0000
@@ -4304,6 +4304,8 @@
 of the differing parts is, by contrast, slightly highlighted."
   :group 'completion)
 
+(defvar completion-root-regexp "^/")
+
 (defun completion-setup-function ()
   (let ((mainbuf (current-buffer))
 	(mbuf-contents (minibuffer-contents)))
@@ -4332,7 +4334,7 @@
 		(with-current-buffer mainbuf
 		  (save-excursion
 		    (goto-char (point-max))
-		    (skip-chars-backward "^/")
+		    (skip-chars-backward completion-root-regexp)
 		    (- (point) (minibuffer-prompt-end)))))
 	;; Otherwise, in minibuffer, the whole input is being completed.
 	(if (minibufferp mainbuf)

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch for completion-setup-function
  2004-07-25 18:36 Patch for completion-setup-function Satyaki Das
@ 2004-07-26 23:58 ` Kevin Rodgers
  2004-07-27  0:40   ` Satyaki Das
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Rodgers @ 2004-07-26 23:58 UTC (permalink / raw)


Satyaki Das wrote:
 > Recently, I noticed the nifty highlighting for the first letter
 > that differs among the available choices during file completion.
 > This feature doesn't work perfectly for MH-E folder completion
 > since the regexp to recognize the root is hardcoded.
 >
 > The attached patch to simple.el changes this.  If this patch were
 > applied then I could just bind the variable and make the
 > highlighting work better in MH-E.

completion-root-regexp should be renamed to something like
completion-root-chars, since it's not a true regexp.

Or perhaps it could be defined as a regexp and skipped via
re-search-backward.

 > Index: simple.el
 > ===================================================================
 > RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
 > retrieving revision 1.651
 > diff -u -r1.651 simple.el
 > --- simple.el	23 Jul 2004 11:52:03 -0000	1.651
 > +++ simple.el	25 Jul 2004 18:26:52 -0000
 > @@ -4304,6 +4304,8 @@
 >  of the differing parts is, by contrast, slightly highlighted."
 >    :group 'completion)
 >
 > +(defvar completion-root-regexp "^/")
 > +
 >  (defun completion-setup-function ()
 >    (let ((mainbuf (current-buffer))
 >  	(mbuf-contents (minibuffer-contents)))
 > @@ -4332,7 +4334,7 @@
 >  		(with-current-buffer mainbuf
 >  		  (save-excursion
 >  		    (goto-char (point-max))
 > -		    (skip-chars-backward "^/")
 > +		    (skip-chars-backward completion-root-regexp)
 >  		    (- (point) (minibuffer-prompt-end)))))
 >  	;; Otherwise, in minibuffer, the whole input is being completed.
 >  	(if (minibufferp mainbuf)

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch for completion-setup-function
  2004-07-26 23:58 ` Kevin Rodgers
@ 2004-07-27  0:40   ` Satyaki Das
  0 siblings, 0 replies; 3+ messages in thread
From: Satyaki Das @ 2004-07-27  0:40 UTC (permalink / raw)
  Cc: emacs-devel

On Mon, 26 Jul 2004 17:58:46 -0600, Kevin Rodgers <ihs_4664@yahoo.com> wrote:
> 
> completion-root-regexp should be renamed to something like
> completion-root-chars, since it's not a true regexp.

Yes, this is true.  I wasn't paying attention when I made that patch.

> Or perhaps it could be defined as a regexp and skipped via
> re-search-backward.

Making it into a true regexp isn't required for my purposes.  I will
be a happy camper if I can bind completion-root-chars to "^/+" before
calling our completion function.

Thanks,
Satyaki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-27  0:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-25 18:36 Patch for completion-setup-function Satyaki Das
2004-07-26 23:58 ` Kevin Rodgers
2004-07-27  0:40   ` Satyaki Das

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.