unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* enhancement/wish
@ 2008-10-25  0:36 Bernhard Koenig
  2008-10-25  8:12 ` enhancement/wish Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Bernhard Koenig @ 2008-10-25  0:36 UTC (permalink / raw)
  To: emacs-devel

The newest version of "gedit" has this feature that the toolbar has a
small icon right next to the "load file" icon which can be clicked and
you get a list of "recent files". In Emacs, even with the recentf
extension, it seems impossible to add a "recentf-open-files" icon to
the toolbar. Of course you can use keybindings, but some people like
the mouse and the "recent files" in the menubar require more clicks.

Sorry for the inconvenience, just a small suggestion/wish/enhancement feature.




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

* Re: enhancement/wish
  2008-10-25  0:36 enhancement/wish Bernhard Koenig
@ 2008-10-25  8:12 ` Eli Zaretskii
       [not found]   ` <de34c09f0810250129m5fea708bh78e06f9219fd864@mail.gmail.com>
  2008-10-25 15:20 ` enhancement/wish David Reitter
  2008-10-29 17:01 ` enhancement/wish Chming
  2 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2008-10-25  8:12 UTC (permalink / raw)
  To: Bernhard Koenig; +Cc: emacs-devel

> Date: Fri, 24 Oct 2008 20:36:01 -0400
> From: "Bernhard Koenig" <b.a.koenig@googlemail.com>
> 
> In Emacs, even with the recentf extension, it seems impossible to
> add a "recentf-open-files" icon to the toolbar.

How do you mean ``impossible''?  Please tell the details, because
adding buttons to the toolbar _should_ be possible (in fact, some
Emacs packages do just that).

Perhaps there's some kind of bug.




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

* Re: enhancement/wish
       [not found]   ` <de34c09f0810250129m5fea708bh78e06f9219fd864@mail.gmail.com>
@ 2008-10-25 10:25     ` Eli Zaretskii
  0 siblings, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2008-10-25 10:25 UTC (permalink / raw)
  To: Bernhard Koenig; +Cc: emacs-devel

[Please keep the discussion on the mailing list.]

> Date: Sat, 25 Oct 2008 04:29:45 -0400
> From: "Bernhard Koenig" <b.a.koenig@googlemail.com>
> 
> Simple test question: how do I reprogram the button "toolbar
> open-file" to invoke the command "recentf-open-file"?

I think you will find an example in grep.el.




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

* Re: enhancement/wish
  2008-10-25  0:36 enhancement/wish Bernhard Koenig
  2008-10-25  8:12 ` enhancement/wish Eli Zaretskii
@ 2008-10-25 15:20 ` David Reitter
  2008-10-25 20:21   ` enhancement/wish Bernhard Koenig
  2008-10-27 23:38   ` enhancement/wish Bernhard Koenig
  2008-10-29 17:01 ` enhancement/wish Chming
  2 siblings, 2 replies; 18+ messages in thread
From: David Reitter @ 2008-10-25 15:20 UTC (permalink / raw)
  To: Bernhard Koenig; +Cc: emacs-devel

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

On 24 Oct 2008, at 20:36, Bernhard Koenig wrote:


> you get a list of "recent files". In Emacs, even with the recentf
> extension, it seems impossible to add a "recentf-open-files" icon to
> the toolbar. Of course you can use keybindings, but some people like
> the mouse and the "recent files" in the menubar require more clicks.

It's perfectly possible.  I have it in Aquamacs, and it just took me a  
bit of Lisp code.  The full code is in aquamacs-tool-bar.el if you  
want to look it up.  Specifically, this is what does it:


   (tool-bar-add-item '("history" . "Recent") (lambda ()
			      (interactive)
			      (popup-menu (easy-menu-filter-return
					   (recentf-make-menu-items)
					   "Open Recent")))
		     'recent-files
		     :visible '(and (boundp 'recentf-mode) recentf-mode)
		     :help "Pop up the Recent Files menu")




[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2193 bytes --]

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

* Re: enhancement/wish
  2008-10-25 15:20 ` enhancement/wish David Reitter
@ 2008-10-25 20:21   ` Bernhard Koenig
  2008-10-27 23:38   ` enhancement/wish Bernhard Koenig
  1 sibling, 0 replies; 18+ messages in thread
From: Bernhard Koenig @ 2008-10-25 20:21 UTC (permalink / raw)
  To: David Reitter; +Cc: emacs-devel

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

Thanks for your help. If I add your patch below to my .emacs I get

Debugger entered--Lisp error: (wrong-type-argument listp "Recent")

The grep.el example that Eli mentioned is not that straightforward. Well,
I'm not a lisp techie but maybe I'll look at it again this weekend.

Best,
Bernhard


On Sat, Oct 25, 2008 at 11:20 AM, David Reitter <david.reitter@gmail.com>wrote:

> On 24 Oct 2008, at 20:36, Bernhard Koenig wrote:
>
>
>  you get a list of "recent files". In Emacs, even with the recentf
>> extension, it seems impossible to add a "recentf-open-files" icon to
>> the toolbar. Of course you can use keybindings, but some people like
>> the mouse and the "recent files" in the menubar require more clicks.
>>
>
> It's perfectly possible.  I have it in Aquamacs, and it just took me a bit
> of Lisp code.  The full code is in aquamacs-tool-bar.el if you want to look
> it up.  Specifically, this is what does it:
>
>
>  (tool-bar-add-item '("history" . "Recent") (lambda ()
>                              (interactive)
>                              (popup-menu (easy-menu-filter-return
>                                           (recentf-make-menu-items)
>                                           "Open Recent")))
>                     'recent-files
>                     :visible '(and (boundp 'recentf-mode) recentf-mode)
>                     :help "Pop up the Recent Files menu")
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 2548 bytes --]

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

* Re: enhancement/wish
  2008-10-25 15:20 ` enhancement/wish David Reitter
  2008-10-25 20:21   ` enhancement/wish Bernhard Koenig
@ 2008-10-27 23:38   ` Bernhard Koenig
  2008-10-28  4:12     ` enhancement/wish Eli Zaretskii
  1 sibling, 1 reply; 18+ messages in thread
From: Bernhard Koenig @ 2008-10-27 23:38 UTC (permalink / raw)
  To: David Reitter; +Cc: emacs-devel

> It's perfectly possible.  I have it in Aquamacs, and it just took me a bit
> of Lisp code.  The full code is in aquamacs-tool-bar.el if you want to look
> it up.  Specifically, this is what does it:
>
>
>  (tool-bar-add-item '("history" . "Recent") (lambda ()
>                              (interactive)
>                              (popup-menu (easy-menu-filter-return
>                                           (recentf-make-menu-items)
>                                           "Open Recent")))
>                     'recent-files
>                     :visible '(and (boundp 'recentf-mode) recentf-mode)
>                     :help "Pop up the Recent Files menu")

Sorry for being a noob here but how do I integrate this into .emacs?
"tool-bar-add-item" is not an interactive command so just adding it to
.emacs does nothing.

Where can I download aquamacs-tool-bar.el? Is this only applicable for
Mac or does it also make sense on other OS?

Best,
Bernhard




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

* Re: enhancement/wish
  2008-10-27 23:38   ` enhancement/wish Bernhard Koenig
@ 2008-10-28  4:12     ` Eli Zaretskii
  2008-10-28  5:11       ` enhancement/wish Bernhard Koenig
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2008-10-28  4:12 UTC (permalink / raw)
  To: Bernhard Koenig; +Cc: david.reitter, emacs-devel

> Date: Mon, 27 Oct 2008 19:38:29 -0400
> From: "Bernhard Koenig" <b.a.koenig@googlemail.com>
> Cc: emacs-devel@gnu.org
> 
> >  (tool-bar-add-item '("history" . "Recent") (lambda ()
> >                              (interactive)
> >                              (popup-menu (easy-menu-filter-return
> >                                           (recentf-make-menu-items)
> >                                           "Open Recent")))
> >                     'recent-files
> >                     :visible '(and (boundp 'recentf-mode) recentf-mode)
> >                     :help "Pop up the Recent Files menu")
> 
> Sorry for being a noob here but how do I integrate this into .emacs?
> "tool-bar-add-item" is not an interactive command so just adding it to
> .emacs does nothing.

??? .emacs is not only for interactive commands.  If adding this to it
does nothing, then something is wrong.

You did restart Emacs after adding this, did you?




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

* Re: enhancement/wish
  2008-10-28  4:12     ` enhancement/wish Eli Zaretskii
@ 2008-10-28  5:11       ` Bernhard Koenig
       [not found]         ` <4906BF50.40709@swipnet.se>
  0 siblings, 1 reply; 18+ messages in thread
From: Bernhard Koenig @ 2008-10-28  5:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: david.reitter, emacs-devel

Yes, I did restart. I found a thread with a similar problem but I
don't know how to resolve it:
http://www.nabble.com/Ciao-on-Intel-Mac-td15000558.html

In this thread they define a new function ciao-setup-tool-bar-helper,
but I don't understand the syntax. The patch below gives me
(wrong-type-argument listp "Recent"), the same problem from the url.

Bernhard


On Tue, Oct 28, 2008 at 12:12 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Mon, 27 Oct 2008 19:38:29 -0400
>> From: "Bernhard Koenig" <b.a.koenig@googlemail.com>
>> Cc: emacs-devel@gnu.org
>>
>> >  (tool-bar-add-item '("history" . "Recent") (lambda ()
>> >                              (interactive)
>> >                              (popup-menu (easy-menu-filter-return
>> >                                           (recentf-make-menu-items)
>> >                                           "Open Recent")))
>> >                     'recent-files
>> >                     :visible '(and (boundp 'recentf-mode) recentf-mode)
>> >                     :help "Pop up the Recent Files menu")
>>
>> Sorry for being a noob here but how do I integrate this into .emacs?
>> "tool-bar-add-item" is not an interactive command so just adding it to
>> .emacs does nothing.
>
> ??? .emacs is not only for interactive commands.  If adding this to it
> does nothing, then something is wrong.
>
> You did restart Emacs after adding this, did you?
>




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

* Re: enhancement/wish
       [not found]         ` <4906BF50.40709@swipnet.se>
@ 2008-10-28  8:17           ` Bernhard Koenig
  2008-10-28  8:38             ` enhancement/wish Bernhard Koenig
  2008-10-28 16:39             ` enhancement/wish Jan Djärv
  0 siblings, 2 replies; 18+ messages in thread
From: Bernhard Koenig @ 2008-10-28  8:17 UTC (permalink / raw)
  To: Jan D.; +Cc: emacs-devel

Thanks Jan, that worked. Can I make it global? (It's currently showing
up in things like .zshrc, .emacs even in M-x shell but not in the
Latex environment.)

Bernhard


On Tue, Oct 28, 2008 at 3:29 AM, Jan D. <jan.h.d@swipnet.se> wrote:
> Bernhard Koenig skrev:
>>
>> Yes, I did restart. I found a thread with a similar problem but I
>> don't know how to resolve it:
>> http://www.nabble.com/Ciao-on-Intel-Mac-td15000558.html
>>
>> In this thread they define a new function ciao-setup-tool-bar-helper,
>> but I don't understand the syntax. The patch below gives me
>> (wrong-type-argument listp "Recent"), the same problem from the url.
>>
>
> The syntax below is wrong. '("history" . "Recent") shall be replaced with a
> name of an icon file to use, such as "open".  See etc/images for available
> images.  You can of course add your own.
>
> Also note that you must have recentf-mode on to see the tool bar item.
>
>        Jan D.
>
>> Bernhard
>>
>>
>> On Tue, Oct 28, 2008 at 12:12 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>>>
>>>> Date: Mon, 27 Oct 2008 19:38:29 -0400
>>>> From: "Bernhard Koenig" <b.a.koenig@googlemail.com>
>>>> Cc: emacs-devel@gnu.org
>>>>
>>>>>  (tool-bar-add-item '("history" . "Recent") (lambda ()
>>>>>                             (interactive)
>>>>>                             (popup-menu (easy-menu-filter-return
>>>>>                                          (recentf-make-menu-items)
>>>>>                                          "Open Recent")))
>>>>>                    'recent-files
>>>>>                    :visible '(and (boundp 'recentf-mode) recentf-mode)
>>>>>                    :help "Pop up the Recent Files menu")
>>>>
>>>> Sorry for being a noob here but how do I integrate this into .emacs?
>>>> "tool-bar-add-item" is not an interactive command so just adding it to
>>>> .emacs does nothing.
>>>
>>> ??? .emacs is not only for interactive commands.  If adding this to it
>>> does nothing, then something is wrong.
>>>
>>> You did restart Emacs after adding this, did you?
>>>
>>
>>
>
>




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

* Re: enhancement/wish
  2008-10-28  8:17           ` enhancement/wish Bernhard Koenig
@ 2008-10-28  8:38             ` Bernhard Koenig
  2008-10-28 16:39             ` enhancement/wish Jan Djärv
  1 sibling, 0 replies; 18+ messages in thread
From: Bernhard Koenig @ 2008-10-28  8:38 UTC (permalink / raw)
  To: Jan D.; +Cc: emacs-devel

Btw, could we add this as an example to
http://www.gnu.org/software/emacs/elisp/html_node/Tool-Bar.html ?
I googled 24/7 (no kidding) and found no examples at all, not even in
www.dotemacs.org. I would be happy to write a small paragraph about it
even though I'm clearly a non-expert.

Best,
Bernhard


On Tue, Oct 28, 2008 at 4:17 AM, Bernhard Koenig
<b.a.koenig@googlemail.com> wrote:
> Thanks Jan, that worked. Can I make it global? (It's currently showing
> up in things like .zshrc, .emacs even in M-x shell but not in the
> Latex environment.)
>
> Bernhard
>
>
> On Tue, Oct 28, 2008 at 3:29 AM, Jan D. <jan.h.d@swipnet.se> wrote:
>> Bernhard Koenig skrev:
>>>
>>> Yes, I did restart. I found a thread with a similar problem but I
>>> don't know how to resolve it:
>>> http://www.nabble.com/Ciao-on-Intel-Mac-td15000558.html
>>>
>>> In this thread they define a new function ciao-setup-tool-bar-helper,
>>> but I don't understand the syntax. The patch below gives me
>>> (wrong-type-argument listp "Recent"), the same problem from the url.
>>>
>>
>> The syntax below is wrong. '("history" . "Recent") shall be replaced with a
>> name of an icon file to use, such as "open".  See etc/images for available
>> images.  You can of course add your own.
>>
>> Also note that you must have recentf-mode on to see the tool bar item.
>>
>>        Jan D.
>>
>>> Bernhard
>>>
>>>
>>> On Tue, Oct 28, 2008 at 12:12 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>>>>
>>>>> Date: Mon, 27 Oct 2008 19:38:29 -0400
>>>>> From: "Bernhard Koenig" <b.a.koenig@googlemail.com>
>>>>> Cc: emacs-devel@gnu.org
>>>>>
>>>>>>  (tool-bar-add-item '("history" . "Recent") (lambda ()
>>>>>>                             (interactive)
>>>>>>                             (popup-menu (easy-menu-filter-return
>>>>>>                                          (recentf-make-menu-items)
>>>>>>                                          "Open Recent")))
>>>>>>                    'recent-files
>>>>>>                    :visible '(and (boundp 'recentf-mode) recentf-mode)
>>>>>>                    :help "Pop up the Recent Files menu")
>>>>>
>>>>> Sorry for being a noob here but how do I integrate this into .emacs?
>>>>> "tool-bar-add-item" is not an interactive command so just adding it to
>>>>> .emacs does nothing.
>>>>
>>>> ??? .emacs is not only for interactive commands.  If adding this to it
>>>> does nothing, then something is wrong.
>>>>
>>>> You did restart Emacs after adding this, did you?
>>>>
>>>
>>>
>>
>>
>




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

* Re: enhancement/wish
  2008-10-28  8:17           ` enhancement/wish Bernhard Koenig
  2008-10-28  8:38             ` enhancement/wish Bernhard Koenig
@ 2008-10-28 16:39             ` Jan Djärv
  2008-10-28 20:40               ` enhancement/wish Bernhard Koenig
  1 sibling, 1 reply; 18+ messages in thread
From: Jan Djärv @ 2008-10-28 16:39 UTC (permalink / raw)
  To: Bernhard Koenig; +Cc: emacs-devel



Bernhard Koenig skrev:
> Thanks Jan, that worked. Can I make it global? (It's currently showing
> up in things like .zshrc, .emacs even in M-x shell but not in the
> Latex environment.)
> 

I guess your latex environment has its own tool bar map.  You must find some 
hook for when that environment starts so you then can add your item to that 
tool bar map.  Normally the variable tool-bar-map should be made buffer local 
if some mode installs its own tool map.  See for example how 
lisp/progmodes/grep.el does it.

	Jan D.

> Bernhard
> 
> 
> On Tue, Oct 28, 2008 at 3:29 AM, Jan D. <jan.h.d@swipnet.se> wrote:
>> Bernhard Koenig skrev:
>>> Yes, I did restart. I found a thread with a similar problem but I
>>> don't know how to resolve it:
>>> http://www.nabble.com/Ciao-on-Intel-Mac-td15000558.html
>>>
>>> In this thread they define a new function ciao-setup-tool-bar-helper,
>>> but I don't understand the syntax. The patch below gives me
>>> (wrong-type-argument listp "Recent"), the same problem from the url.
>>>
>> The syntax below is wrong. '("history" . "Recent") shall be replaced with a
>> name of an icon file to use, such as "open".  See etc/images for available
>> images.  You can of course add your own.
>>
>> Also note that you must have recentf-mode on to see the tool bar item.
>>
>>        Jan D.
>>
>>> Bernhard
>>>
>>>
>>> On Tue, Oct 28, 2008 at 12:12 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>>>> Date: Mon, 27 Oct 2008 19:38:29 -0400
>>>>> From: "Bernhard Koenig" <b.a.koenig@googlemail.com>
>>>>> Cc: emacs-devel@gnu.org
>>>>>
>>>>>>  (tool-bar-add-item '("history" . "Recent") (lambda ()
>>>>>>                             (interactive)
>>>>>>                             (popup-menu (easy-menu-filter-return
>>>>>>                                          (recentf-make-menu-items)
>>>>>>                                          "Open Recent")))
>>>>>>                    'recent-files
>>>>>>                    :visible '(and (boundp 'recentf-mode) recentf-mode)
>>>>>>                    :help "Pop up the Recent Files menu")
>>>>> Sorry for being a noob here but how do I integrate this into .emacs?
>>>>> "tool-bar-add-item" is not an interactive command so just adding it to
>>>>> .emacs does nothing.
>>>> ??? .emacs is not only for interactive commands.  If adding this to it
>>>> does nothing, then something is wrong.
>>>>
>>>> You did restart Emacs after adding this, did you?
>>>>
>>>
>>




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

* Re: enhancement/wish
  2008-10-28 16:39             ` enhancement/wish Jan Djärv
@ 2008-10-28 20:40               ` Bernhard Koenig
  2008-10-29  7:01                 ` enhancement/wish Bernhard Koenig
  2008-10-29  7:26                 ` enhancement/wish Jan D.
  0 siblings, 2 replies; 18+ messages in thread
From: Bernhard Koenig @ 2008-10-28 20:40 UTC (permalink / raw)
  To: Jan Djärv; +Cc: emacs-devel

OK, I see that there is a command tool-bar-local-item but it's not
listed in http://www.gnu.org/software/emacs/elisp/html_node/Tool-Bar.html

I guess the syopsis is
tool-bar-local-item icon def key map &rest props
but what is "map" in the case of "LaTeX-mode-hook"? Or in case of the info mode?

Best,
Bernhard


On Tue, Oct 28, 2008 at 12:39 PM, Jan Djärv <jan.h.d@swipnet.se> wrote:
>
>
> Bernhard Koenig skrev:
>>
>> Thanks Jan, that worked. Can I make it global? (It's currently showing
>> up in things like .zshrc, .emacs even in M-x shell but not in the
>> Latex environment.)
>>
>
> I guess your latex environment has its own tool bar map.  You must find some
> hook for when that environment starts so you then can add your item to that
> tool bar map.  Normally the variable tool-bar-map should be made buffer
> local if some mode installs its own tool map.  See for example how
> lisp/progmodes/grep.el does it.
>
>        Jan D.
>
>> Bernhard
>>
>>
>> On Tue, Oct 28, 2008 at 3:29 AM, Jan D. <jan.h.d@swipnet.se> wrote:
>>>
>>> Bernhard Koenig skrev:
>>>>
>>>> Yes, I did restart. I found a thread with a similar problem but I
>>>> don't know how to resolve it:
>>>> http://www.nabble.com/Ciao-on-Intel-Mac-td15000558.html
>>>>
>>>> In this thread they define a new function ciao-setup-tool-bar-helper,
>>>> but I don't understand the syntax. The patch below gives me
>>>> (wrong-type-argument listp "Recent"), the same problem from the url.
>>>>
>>> The syntax below is wrong. '("history" . "Recent") shall be replaced with
>>> a
>>> name of an icon file to use, such as "open".  See etc/images for
>>> available
>>> images.  You can of course add your own.
>>>
>>> Also note that you must have recentf-mode on to see the tool bar item.
>>>
>>>       Jan D.
>>>
>>>> Bernhard
>>>>
>>>>
>>>> On Tue, Oct 28, 2008 at 12:12 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>>>>>
>>>>>> Date: Mon, 27 Oct 2008 19:38:29 -0400
>>>>>> From: "Bernhard Koenig" <b.a.koenig@googlemail.com>
>>>>>> Cc: emacs-devel@gnu.org
>>>>>>
>>>>>>>  (tool-bar-add-item '("history" . "Recent") (lambda ()
>>>>>>>                            (interactive)
>>>>>>>                            (popup-menu (easy-menu-filter-return
>>>>>>>                                         (recentf-make-menu-items)
>>>>>>>                                         "Open Recent")))
>>>>>>>                   'recent-files
>>>>>>>                   :visible '(and (boundp 'recentf-mode) recentf-mode)
>>>>>>>                   :help "Pop up the Recent Files menu")
>>>>>>
>>>>>> Sorry for being a noob here but how do I integrate this into .emacs?
>>>>>> "tool-bar-add-item" is not an interactive command so just adding it to
>>>>>> .emacs does nothing.
>>>>>
>>>>> ??? .emacs is not only for interactive commands.  If adding this to it
>>>>> does nothing, then something is wrong.
>>>>>
>>>>> You did restart Emacs after adding this, did you?
>>>>>
>>>>
>>>
>




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

* Re: enhancement/wish
  2008-10-28 20:40               ` enhancement/wish Bernhard Koenig
@ 2008-10-29  7:01                 ` Bernhard Koenig
  2008-10-29  7:26                 ` enhancement/wish Jan D.
  1 sibling, 0 replies; 18+ messages in thread
From: Bernhard Koenig @ 2008-10-29  7:01 UTC (permalink / raw)
  To: Jan Djärv; +Cc: emacs-devel

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

Hi,

the following kind of works for me now:

;; define function to add recent files button
(defun tool-bar-add-recent-files ()
  "Add toolbar button for Recent Files."
  (interactive)
  (tool-bar-add-item "~/.icons/emacs/clock" (lambda ()
                            (interactive)
                            (popup-menu (easy-menu-filter-return
                                         (recentf-make-menu-items)
                                         "Open Recent")))
                   'recent-files
                   :visible '(and (boundp 'recentf-mode) recentf-mode)
		   :help "Pop up the Recent Files menu")
)

;; write tool-bar-add-recent-files into all hooks
(add-hook 'text-mode-hook 'tool-bar-add-recent-files)
(add-hook 'LaTeX-mode-hook 'tool-bar-local-recent-files)
;(add-hook 'info-mode-hook 'tool-bar-add-recent-files)
(add-hook 'emacs-startup-hook 'tool-bar-add-recent-files)

There are still some problems with the info mode that completely
overwrites all tool-bar-map settings, don't know.

Is there any political will to add this to recentf.el? Many other
editors have this feature, so it would bring emacs up to standard
regarding toolbar features. David said that Aquamacs has it. As icon I
would suggest the attached clock.xpm, which is GLPL and it's a clock
like in Aquamacs.

Best,
Bernhard

[-- Attachment #2: clock.xpm --]
[-- Type: image/x-xpixmap, Size: 1599 bytes --]

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

* Re: enhancement/wish
  2008-10-28 20:40               ` enhancement/wish Bernhard Koenig
  2008-10-29  7:01                 ` enhancement/wish Bernhard Koenig
@ 2008-10-29  7:26                 ` Jan D.
  2008-10-29  7:40                   ` enhancement/wish Bernhard Koenig
  1 sibling, 1 reply; 18+ messages in thread
From: Jan D. @ 2008-10-29  7:26 UTC (permalink / raw)
  To: Bernhard Koenig; +Cc: emacs-devel

Bernhard Koenig skrev:
> OK, I see that there is a command tool-bar-local-item but it's not
> listed in http://www.gnu.org/software/emacs/elisp/html_node/Tool-Bar.html
> 
> I guess the syopsis is
> tool-bar-local-item icon def key map &rest props
> but what is "map" in the case of "LaTeX-mode-hook"? Or in case of the info mode?
> 

 From what I see, LaTeX-mode-hook does not set its own tool bar map.  So 
you should not have to do anything. It should work.  Are you sure 
recentf-mode is on when you switch to latex-mode?

As for info mode, just put your code in a defun:

(defun my-tool-bar-addition ()
   ;; the code you have goes here
)

(add-hook 'Info-mode-hook 'my-tool-bar-addition)


As info mode makes tool-bar-map a buffer local variable, your old code 
continues to work.  Instead of putting stuff into the global 
tool-bar-mode it now adds stuff to info-modes tool bar map.  No need to 
mess about with tool-bar-local-item.

For other modes, you have to find their hook variable.
AFAIK, there is no way to add an item to "all tool bars", so it 
automatically gets added to new tool bars that modes may install.  Maybe 
we need such a command.

	Jan D.






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

* Re: enhancement/wish
  2008-10-29  7:26                 ` enhancement/wish Jan D.
@ 2008-10-29  7:40                   ` Bernhard Koenig
  2008-10-29 11:21                     ` enhancement/wish Jan D.
  0 siblings, 1 reply; 18+ messages in thread
From: Bernhard Koenig @ 2008-10-29  7:40 UTC (permalink / raw)
  To: Jan D.; +Cc: emacs-devel

> From what I see, LaTeX-mode-hook does not set its own tool bar map.  So you
> should not have to do anything. It should work.  Are you sure recentf-mode
> is on when you switch to latex-mode?

I found my problem with LaTeX-mode-hook: I had the line
(add-hook 'LaTeX-mode-hook 'LaTeX-install-toolbar)
in my .emacs which overwrites tool-bar-map. But then I commented out
this line (I think it might be obsolete) and everything worked.

> As for info mode, just put your code in a defun:
>
> (defun my-tool-bar-addition ()
>  ;; the code you have goes here
> )
>
> (add-hook 'Info-mode-hook 'my-tool-bar-addition)

Yes, I did that, see my mail 30 min earlier. Hmm, is it info-mode-hook
or Info-mode-hook?

> For other modes, you have to find their hook variable.
> AFAIK, there is no way to add an item to "all tool bars", so it
> automatically gets added to new tool bars that modes may install.  Maybe we
> need such a command.

It would be nice to have global hook, something that incorporates all
hooks, or at least almost all of them.

Best,
Bernhard




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

* Re: enhancement/wish
  2008-10-29  7:40                   ` enhancement/wish Bernhard Koenig
@ 2008-10-29 11:21                     ` Jan D.
  0 siblings, 0 replies; 18+ messages in thread
From: Jan D. @ 2008-10-29 11:21 UTC (permalink / raw)
  To: Bernhard Koenig; +Cc: emacs-devel

Bernhard Koenig skrev:

>>
>> (add-hook 'Info-mode-hook 'my-tool-bar-addition)
> 
> Hmm, is it info-mode-hook or Info-mode-hook?

The code says Info-mode-hook.

	Jan D.






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

* Re: enhancement/wish
  2008-10-25  0:36 enhancement/wish Bernhard Koenig
  2008-10-25  8:12 ` enhancement/wish Eli Zaretskii
  2008-10-25 15:20 ` enhancement/wish David Reitter
@ 2008-10-29 17:01 ` Chming
  2008-10-29 20:10   ` enhancement/wish Bernhard Koenig
  2 siblings, 1 reply; 18+ messages in thread
From: Chming @ 2008-10-29 17:01 UTC (permalink / raw)
  To: Bernhard Koenig; +Cc: emacs-devel

ido does this perfectly

On Fri, Oct 24, 2008 at 5:36 PM, Bernhard Koenig
<b.a.koenig@googlemail.com> wrote:
> The newest version of "gedit" has this feature that the toolbar has a
> small icon right next to the "load file" icon which can be clicked and
> you get a list of "recent files". In Emacs, even with the recentf
> extension, it seems impossible to add a "recentf-open-files" icon to
> the toolbar. Of course you can use keybindings, but some people like
> the mouse and the "recent files" in the menubar require more clicks.
>
> Sorry for the inconvenience, just a small suggestion/wish/enhancement feature.
>
>
>




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

* Re: enhancement/wish
  2008-10-29 17:01 ` enhancement/wish Chming
@ 2008-10-29 20:10   ` Bernhard Koenig
  0 siblings, 0 replies; 18+ messages in thread
From: Bernhard Koenig @ 2008-10-29 20:10 UTC (permalink / raw)
  To: Chming; +Cc: emacs-devel

Ido is a nice extension but AFAIK it does not add a toolbar item for
"Recent Files". Neither does recentf.el. I know that many geeks are
switching off the toolbar anyway, but I'm a "mouse person", lol.
That's why I suggested to add this hack to recent.el. There was a
couple of misprints in my earlier post, so I'll post it again:

;; define function to add recent files button
(defun tool-bar-add-recentf ()
  "Add toolbar button for Recent Files."
  (interactive)
  (tool-bar-add-item "clock" (lambda ()
			 (interactive)
                         (popup-menu (easy-menu-filter-return
				      (recentf-make-menu-items)
				      "Open Recent")))
		     'recent-files
		     :visible '(and (boundp 'recentf-mode) recentf-mode)
		     :help "Pop up the Recent Files menu")
)

;; write tool-bar-add-recentf into all hooks
(add-hook 'emacs-startup-hook 'tool-bar-add-recentf)
(add-hook 'text-mode-hook 'tool-bar-add-recentf)
(add-hook 'Info-mode-hook 'tool-bar-add-recentf)


On Wed, Oct 29, 2008 at 1:01 PM, Chming <chming@gmail.com> wrote:
> ido does this perfectly




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

end of thread, other threads:[~2008-10-29 20:10 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-25  0:36 enhancement/wish Bernhard Koenig
2008-10-25  8:12 ` enhancement/wish Eli Zaretskii
     [not found]   ` <de34c09f0810250129m5fea708bh78e06f9219fd864@mail.gmail.com>
2008-10-25 10:25     ` enhancement/wish Eli Zaretskii
2008-10-25 15:20 ` enhancement/wish David Reitter
2008-10-25 20:21   ` enhancement/wish Bernhard Koenig
2008-10-27 23:38   ` enhancement/wish Bernhard Koenig
2008-10-28  4:12     ` enhancement/wish Eli Zaretskii
2008-10-28  5:11       ` enhancement/wish Bernhard Koenig
     [not found]         ` <4906BF50.40709@swipnet.se>
2008-10-28  8:17           ` enhancement/wish Bernhard Koenig
2008-10-28  8:38             ` enhancement/wish Bernhard Koenig
2008-10-28 16:39             ` enhancement/wish Jan Djärv
2008-10-28 20:40               ` enhancement/wish Bernhard Koenig
2008-10-29  7:01                 ` enhancement/wish Bernhard Koenig
2008-10-29  7:26                 ` enhancement/wish Jan D.
2008-10-29  7:40                   ` enhancement/wish Bernhard Koenig
2008-10-29 11:21                     ` enhancement/wish Jan D.
2008-10-29 17:01 ` enhancement/wish Chming
2008-10-29 20:10   ` enhancement/wish Bernhard Koenig

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

	https://git.savannah.gnu.org/cgit/emacs.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).