helm-find-files: Working with filenames with the same prefix

72 views
Skip to first unread message

Ribonous

unread,
Jan 21, 2013, 2:28:38 PM1/21/13
to emacs...@googlegroups.com
I have three files in my home directory with the same prefix:

.cshrc
.cshrc_local
.cshrc_final

If I try M-x helm-find-files, and I type .cshrc, helm only shows one entry: .cshrc. However, the three choices above should also be completions of .cshrc.

If I type .cshr (i.e. I leave the c out), it shows the three options correctly though.

Is this the expected behavior in helm? Are there any settings I can change to get the desired behavior?

Thanks,

~LS

Thierry Volpiatto

unread,
Jan 21, 2013, 3:47:41 PM1/21/13
to emacs...@googlegroups.com
Ribonous <ribonu...@gmail.com> writes:

> I have three files in my home directory with the same prefix:
>
> .cshrc
> .cshrc_local
> .cshrc_final
>
> If I try M-x helm-find-files, and I type .cshrc, helm only shows one entry:
> .cshrc. However, the three choices above should also be completions of
> .cshrc.
>
> If I type .cshr (i.e. I leave the c out), it shows the three options
> correctly though.
>
> Is this the expected behavior in helm?
Yes.

> Are there any settings I can change to get the desired behavior?
No.
But you do not have to type ".cshrc",
you can type directly "csh" or "shlo" or "csfi" to finally find what you
want faster than what you are used to do in emacs.
It's not easy at first, but when you are used to it, you will see it is
really efficient.

> Thanks,
>
> ~LS
>

--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Bob Cromwell

unread,
Jan 25, 2013, 5:52:54 AM1/25/13
to emacs...@googlegroups.com
Hi All,

I'd like to add a new key binding in my init file to show lines with "#pragma mark" in another buffer , however below code doesn't work. Every time I invoke this function, I get a new empty buffer with prompt "pattern" in mini-buffer.  Could anyone give me a hint ? Thanks in advance !

(defvar helm-c-source-objc-headline
  '((name . "Objective-C Headline")
    (headline  "^[-+@]\\|^#pragma mark")))

(defun objc-headline ()
  (interactive)
  ;; Set to 500 so it is displayed even if all methods are not narrowed down.
    (helm-other-buffer '(helm-c-source-objc-headline)
                           "*ObjC Headline*")))
 
Bob Cromwell

Thierry Volpiatto

unread,
Jan 25, 2013, 1:43:17 PM1/25/13
to emacs...@googlegroups.com
Hi Bob,

Bob Cromwell <bob.crom...@gmail.com> writes:

> Hi All,
>
> I'd like to add a new key binding in my init file to show lines with "#pragma mark" in another buffer , however below code doesn't work. Every time I invoke this function, I get a new empty buffer with prompt "pattern" in mini-buffer. Could anyone give me a hint ? Thanks in advance !
>
> (defvar helm-c-source-objc-headline
> '((name . "Objective-C Headline")
> (headline "^[-+@]\\|^#pragma mark")))

I would write "^\\([-+@]\\|#pragma mark\\)"

> (defun objc-headline ()
> (interactive)
> ;; Set to 500 so it is displayed even if all methods are not narrowed down.
> (helm-other-buffer '(helm-c-source-objc-headline)
> "*ObjC Headline*")))
It should work, I tried in scratch buffer to add some "#pragma mark" and
they are listed correctly; Try to improve your regexp, or send here an
example of a line containing "#pragma mark" you want to match.

> Bob Cromwell

Bob Cromwell

unread,
Jan 27, 2013, 10:19:51 PM1/27/13
to emacs...@googlegroups.com
Hi Thierry,

Thanks for your answer.

unfortunately I did same thing in "scratch" buffer , still doesn't work. I tried following things.

1. replace the regexp to "#pragma mark" . (I had use "M-x re-builder" to verify that it should match)
2. invoke emacs like this "emacs -q" and load helm-misc.el helm.el manually
3. I found an example in helm-misc.el "helm-c-source-fixme" , I replace my var "helm-c-source-objc-headline" with it and I found it could not list "\\TODO" .
4. I tried helm-mini , they worked fine !

I am using GNU Emacs 24.1.1 under Mac OSX lion , Terminal.app. And the master branch of helm. (pulled latest change yesterday).

I tired to debug the "helm-headline-get-candidates" function however no clues found.

Could you please give me some more hints on this ? e.g. I should check which function's return value?

Thanks!

Bob Cromwell

Thierry Volpiatto

unread,
Jan 28, 2013, 12:45:01 AM1/28/13
to emacs...@googlegroups.com
Bob Cromwell <bob.crom...@gmail.com> writes:

> Hi Thierry,
>
> Thanks for your answer.
>
> unfortunately I did same thing in "scratch" buffer , still doesn't
> work. I tried following things.
>
> 1. replace the regexp to "#pragma mark" . (I had use "M-x
> re-builder" to verify that it should match)
You can use helm-regexp also (better).

> 2. invoke emacs like this "emacs -q" and load helm-misc.el helm.el
> manually
Bad. Start with ./emacs-helm.sh instead or install helm as described in README.

> 3. I found an example in helm-misc.el "helm-c-source-fixme" , I
> replace my var "helm-c-source-objc-headline" with it and I found it
> could not list "\\TODO" .
Probably they are not autoloaded due to 2.

Bob Cromwell

unread,
Jan 28, 2013, 9:16:10 PM1/28/13
to emacs...@googlegroups.com
Thierry ,  Thanks  a lot !

I finally find that  the headline function works after add "(helm-mode 1)" in my init file. However I am a bit confused, as I thought helm-mode function only handles completion.

Bob Cromwell

--
You received this message because you are subscribed to the Google Groups "emacs-helm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emacs-helm+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Thierry Volpiatto

unread,
Jan 29, 2013, 1:05:44 AM1/29/13
to emacs...@googlegroups.com
Bob Cromwell <bob.crom...@gmail.com> writes:

> Thierry , Thanks a lot !
>
> I finally find that the headline function works after add "(helm-mode
> 1)" in my init file. However I am a bit confused, as I thought
> helm-mode function only handles completion.
What helm-mode does here is just autoloading the required packages.
But it is good to enable it on startup, it will provide helm completion
in many places. (you can control this with
`helm-completing-read-handlers-alist').
Reply all
Reply to author
Forward
0 new messages