emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* minor mode recentf: show only *.tex and *.org files?!
@ 2013-06-25 10:06 AW
  2013-06-25 10:34 ` Nicolas Richard
  0 siblings, 1 reply; 7+ messages in thread
From: AW @ 2013-06-25 10:06 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

I'm using the minor mode recentf to get a list of recently opened files. But 
the list is cluttered with files like *.out, *.log and whatever.

Can somebody drop me two or three lines, which I can put into my .emacs file to 
make recentf only show *.org and *.tex files?

Thank you,

Regards,

Alexander

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

* Re: minor mode recentf: show only *.tex and *.org files?!
  2013-06-25 10:06 minor mode recentf: show only *.tex and *.org files?! AW
@ 2013-06-25 10:34 ` Nicolas Richard
  2013-06-25 12:30   ` AW
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Richard @ 2013-06-25 10:34 UTC (permalink / raw)
  To: AW; +Cc: emacs-orgmode

AW <alexander.willand@t-online.de> writes:
> I'm using the minor mode recentf to get a list of recently opened files. But 
> the list is cluttered with files like *.out, *.log and whatever.

Variable recentf-exclude is the answer.
I have this :
(setq recentf-exclude '(
                         "/.emacs.bmk$"
                         "\\.ido.last$" ; ido mode (emacs)
                         "session\\.[a-f0-9]*$" ; emacs
                         "~$" ; emacs (and others) backup
                         "\\.log$" ; LaTeX
                         "\\.pdfsync$" ; LaTeX
                         "\\.toc" ; LaTeX
                         "\\.aux$" ; LaTeX
                         "/Dropbox/" ; avoid opening dropbox files, there is probably a local mirror
                         "bssm2011-dropbox" ; symbolic link to dropbox
                         "/COMMIT_EDITMSG$"
                         "/tmp/"
                         ".el.gz$"
                         ))

but obviously you want to adjust that to your situation. If you really
only want org and tex files, you should ignore anything that doesn't end
in org or tex, i.e.

(setq recentf-exclude '(         ; if filename...
                        "[^gx]$" ; doesn't end in gx
                        "[^e]x$" ; or ends in x but not ex
                        "[^r]g$" ; or ends in g but not rg
                        "[^t]ex$"; or ends in ex but not tex
                        "[^o]rg$" ; or ends in rg but not org
                        ))       ; ...then exclude
N.

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

* Re: minor mode recentf: show only *.tex and *.org files?!
  2013-06-25 10:34 ` Nicolas Richard
@ 2013-06-25 12:30   ` AW
  2013-06-25 12:39     ` Nicolas Richard
  0 siblings, 1 reply; 7+ messages in thread
From: AW @ 2013-06-25 12:30 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: emacs-orgmode

Am Dienstag, 25. Juni 2013, 12:34:12 schrieb Nicolas Nicolas Richard:
> AW <alexander.willand@t-online.de> writes:
> > I'm using the minor mode recentf to get a list of recently opened files.
> > But the list is cluttered with files like *.out, *.log and whatever.
> 
> Variable recentf-exclude is the answer.
> I have this :
> (setq recentf-exclude '(
>                          "/.emacs.bmk$"
>                          "\\.ido.last$" ; ido mode (emacs)
>                          "session\\.[a-f0-9]*$" ; emacs
>                          "~$" ; emacs (and others) backup
>                          "\\.log$" ; LaTeX
>                          "\\.pdfsync$" ; LaTeX
>                          "\\.toc" ; LaTeX
>                          "\\.aux$" ; LaTeX
>                          "/Dropbox/" ; avoid opening dropbox files, there is
> probably a local mirror "bssm2011-dropbox" ; symbolic link to dropbox
> "/COMMIT_EDITMSG$"
>                          "/tmp/"
>                          ".el.gz$"
>                          ))
> 
> but obviously you want to adjust that to your situation. If you really
> only want org and tex files, you should ignore anything that doesn't end
> in org or tex, i.e.
> 
> (setq recentf-exclude '(         ; if filename...
>                         "[^gx]$" ; doesn't end in gx
>                         "[^e]x$" ; or ends in x but not ex
>                         "[^r]g$" ; or ends in g but not rg
>                         "[^t]ex$"; or ends in ex but not tex
>                         "[^o]rg$" ; or ends in rg but not org
>                         ))       ; ...then exclude
> N.

Thank you very much. Your way to exclude only some disturbing files seems much 
better to me.

But I fail to exclude in Emacs 24.3 under Windows 7 lines in recentf like 
this:

c:/Users/aw/AppData/Local/Temp/diary1234ABc

The filename is always "diary" + 4 digits + letters (2-4 letters)

So I wrote:

 (setq recentf-exclude '(
   "/diary[0-9]\{4\}[a-zA-Z]\{2,4\}$"
))

but without success, all the lines of my temp-diaries still appear in recentf.

Probably I should start the regex with something different than "/", but I 
tried everything I could think of, e.g. "\\", 
"c:/Users/aw/AppData/Local/Temp/", without "$" at the end...

As I'm running out of ideas, maybe you could give me a hint again.

Regards,

Alexander

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

* Re: minor mode recentf: show only *.tex and *.org files?!
  2013-06-25 12:30   ` AW
@ 2013-06-25 12:39     ` Nicolas Richard
  2013-06-25 13:21       ` AW
  2013-06-25 14:10       ` AW
  0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Richard @ 2013-06-25 12:39 UTC (permalink / raw)
  To: AW; +Cc: emacs-orgmode

Le 25/06/2013 14:30, AW a écrit :
>  (setq recentf-exclude '(
>    "/diary[0-9]\{4\}[a-zA-Z]\{2,4\}$"
> ))

You have to double the backslashes. Reason is that when lisp reads the
string, it translates it into
/diary[0-9]{4}[a-zA-Z]{2,4}$
which is not the regexp you want.

-- 
Nico.

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

* Re: minor mode recentf: show only *.tex and *.org files?!
  2013-06-25 12:39     ` Nicolas Richard
@ 2013-06-25 13:21       ` AW
  2013-06-25 14:24         ` Nicolas Richard
  2013-06-25 14:10       ` AW
  1 sibling, 1 reply; 7+ messages in thread
From: AW @ 2013-06-25 13:21 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: emacs-orgmode

Am Dienstag, 25. Juni 2013, 14:39:50 schrieb Nicolas Richard:
> Le 25/06/2013 14:30, AW a écrit :
> >  (setq recentf-exclude '(
> >  
> >    "/diary[0-9]\{4\}[a-zA-Z]\{2,4\}$"
> > 
> > ))
> 
> You have to double the backslashes. Reason is that when lisp reads the
> string, it translates it into
> /diary[0-9]{4}[a-zA-Z]{2,4}$
> which is not the regexp you want.

I get lots of lines like "c:/Users/aw/AppData/Local/Temp/diary1234ABc" , 
despite duplication of backlashes.

Hm. Tried with leading "/" and without, same result. So I inserted a whole 
filename including path instead of an regex and this failed as well. It seems 
the whole recentf-exclude does not work, at least under windows 7. I created a 
testfile Test.org and tried to exclude it in various ways, but without success.

Dammit. Can it be the leading "/"?

However, thank you for your very appreciated help!

Regards,

Alexander

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

* Re: minor mode recentf: show only *.tex and *.org files?!
  2013-06-25 12:39     ` Nicolas Richard
  2013-06-25 13:21       ` AW
@ 2013-06-25 14:10       ` AW
  1 sibling, 0 replies; 7+ messages in thread
From: AW @ 2013-06-25 14:10 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Nicolas Richard

Am Dienstag, 25. Juni 2013, 14:39:50 schrieb Nicolas Nicolas Richard:
> Le 25/06/2013 14:30, AW a écrit :
> >  (setq recentf-exclude '(
> >  
> >    "/diary[0-9]\{4\}[a-zA-Z]\{2,4\}$"
> > 
> > ))
> 
> You have to double the backslashes. Reason is that when lisp reads the
> string, it translates it into
> /diary[0-9]{4}[a-zA-Z]{2,4}$
> which is not the regexp you want.

Maybe the description of the variable "recentf-exclude" should be amended: 

"The variable recentf-exclude has to be set before your require recentf." 

When I put my setting before (require 'recentf), it works!

Regards,

Alexander

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

* Re: minor mode recentf: show only *.tex and *.org files?!
  2013-06-25 13:21       ` AW
@ 2013-06-25 14:24         ` Nicolas Richard
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Richard @ 2013-06-25 14:24 UTC (permalink / raw)
  To: AW; +Cc: emacs-orgmode

AW <alexander.willand@t-online.de> writes:
> I get lots of lines like "c:/Users/aw/AppData/Local/Temp/diary1234ABc" , 
> despite duplication of backlashes.

As you noticed in your next mesasge, you should activate recentf only
after setting this variable. Alternatively, you can call
(recentf-cleanup) after you set the variable. Sorry I didn't mention it,
when testing I called recentf-cleanup without even thinking about it.

For the record, I also looked at the variable recentf-exclude
description and I see that you can also add predicates to it, hence my
suggestion for "only org and tex files" could be very much simplified
(at least de-obfuscated) by writing a small lisp function.

-- 
Nico.

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

end of thread, other threads:[~2013-06-25 14:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-25 10:06 minor mode recentf: show only *.tex and *.org files?! AW
2013-06-25 10:34 ` Nicolas Richard
2013-06-25 12:30   ` AW
2013-06-25 12:39     ` Nicolas Richard
2013-06-25 13:21       ` AW
2013-06-25 14:24         ` Nicolas Richard
2013-06-25 14:10       ` AW

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).