emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* heading specific fast keys?
@ 2016-12-21 20:18 John Kitchin
  2016-12-21 20:27 ` Cook, Malcolm
  0 siblings, 1 reply; 3+ messages in thread
From: John Kitchin @ 2016-12-21 20:18 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

I wondered if anyone know a straight forward way to make
heading-specific fast keys in org-mode.

The idea is if I am on a heading that is a "contact" (which means it has
an EMAIL property), then there would be special hot keys for it, e.g.
"e" would compose a message, "u" might open a URL if it had one, etc...

Or, on entries captured from elfeed, I could just press "b" to open the
entry in a browser, etc...

I guess there would need to be some kind of hook that looks up a keymap
or something on these special positions. And maybe a default map for
non-special headings.

Thoughts?

-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

* Re: heading specific fast keys?
  2016-12-21 20:18 heading specific fast keys? John Kitchin
@ 2016-12-21 20:27 ` Cook, Malcolm
  2016-12-21 20:53   ` John Kitchin
  0 siblings, 1 reply; 3+ messages in thread
From: Cook, Malcolm @ 2016-12-21 20:27 UTC (permalink / raw)
  To: 'John Kitchin', 'emacs-orgmode@gnu.org'



 > -----Original Message-----
 > From: Emacs-orgmode [mailto:emacs-orgmode-
 > bounces+mec=stowers.org@gnu.org] On Behalf Of John Kitchin
 > Sent: Wednesday, December 21, 2016 2:18 PM
 > To: emacs-orgmode@gnu.org
 > Subject: [O] heading specific fast keys?
 > 
 > I wondered if anyone know a straight forward way to make
 > heading-specific fast keys in org-mode.
 > 
 > The idea is if I am on a heading that is a "contact" (which means it has
 > an EMAIL property), then there would be special hot keys for it, e.g.
 > "e" would compose a message, "u" might open a URL if it had one, etc...
 > 
 > Or, on entries captured from elfeed, I could just press "b" to open the
 > entry in a browser, etc...
 > 
 > I guess there would need to be some kind of hook that looks up a keymap
 > or something on these special positions. And maybe a default map for
 > non-special headings.
 > 
 > Thoughts?

Possible synergy from one of the approaches to [MultipleModes](https://www.emacswiki.org/emacs?search=%22MultipleModes%22)

I use polymode in org-mode to good effect within which switches mode with code blocks to be language specific.

It might suggest an architecture....


> 
 > --
 > Professor John Kitchin
 > Doherty Hall A207F
 > Department of Chemical Engineering
 > Carnegie Mellon University
 > Pittsburgh, PA 15213
 > 412-268-7803
 > @johnkitchin
 > http://kitchingroup.cheme.cmu.edu

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

* Re: heading specific fast keys?
  2016-12-21 20:27 ` Cook, Malcolm
@ 2016-12-21 20:53   ` John Kitchin
  0 siblings, 0 replies; 3+ messages in thread
From: John Kitchin @ 2016-12-21 20:53 UTC (permalink / raw)
  To: Cook, Malcolm; +Cc: 'emacs-orgmode@gnu.org', 'John Kitchin'

Thanks for the idea. It got me to read how org does it in the first
place ;)

Here is my solution at the moment. I just add a hook to
org-speed-command-hook, define special elfeed fast keys, and then when
on an ELFEED entry, get those first.

This is proof of concept code that works, and defaults to user then
default keys. What a great ecosystem org is!

Happy holidays everyone!

#+BEGIN_SRC emacs-lisp
(defun org-speed-elfeed (keys)
  (when (or (and (bolp) (looking-at org-outline-regexp)
		 (not (null (org-entry-get (point) "ELFEED")))) 
	    (and (functionp org-use-speed-commands)
		 (funcall org-use-speed-commands)))
    (cdr (assoc keys(append
		     org-speed-commands-elfeed
		     org-speed-commands-user
		     org-speed-commands-default)))))

(setq org-speed-commands-elfeed
      '(("b" . (lambda (&optional arg)
		 (save-excursion
		   (re-search-forward "Link: *")
		   (org-open-at-point-global))))))
      

(add-hook 'org-speed-command-hook 'org-speed-elfeed)
#+END_SRC

Cook, Malcolm writes:

>  > -----Original Message-----
>  > From: Emacs-orgmode [mailto:emacs-orgmode-
>  > bounces+mec=stowers.org@gnu.org] On Behalf Of John Kitchin
>  > Sent: Wednesday, December 21, 2016 2:18 PM
>  > To: emacs-orgmode@gnu.org
>  > Subject: [O] heading specific fast keys?
>  > 
>  > I wondered if anyone know a straight forward way to make
>  > heading-specific fast keys in org-mode.
>  > 
>  > The idea is if I am on a heading that is a "contact" (which means it has
>  > an EMAIL property), then there would be special hot keys for it, e.g.
>  > "e" would compose a message, "u" might open a URL if it had one, etc...
>  > 
>  > Or, on entries captured from elfeed, I could just press "b" to open the
>  > entry in a browser, etc...
>  > 
>  > I guess there would need to be some kind of hook that looks up a keymap
>  > or something on these special positions. And maybe a default map for
>  > non-special headings.
>  > 
>  > Thoughts?
>
> Possible synergy from one of the approaches to [MultipleModes](https://www.emacswiki.org/emacs?search=%22MultipleModes%22)
>
> I use polymode in org-mode to good effect within which switches mode with code blocks to be language specific.
>
> It might suggest an architecture....
>
>
>> 
>  > --
>  > Professor John Kitchin
>  > Doherty Hall A207F
>  > Department of Chemical Engineering
>  > Carnegie Mellon University
>  > Pittsburgh, PA 15213
>  > 412-268-7803
>  > @johnkitchin
>  > http://kitchingroup.cheme.cmu.edu


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

end of thread, other threads:[~2016-12-21 20:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-21 20:18 heading specific fast keys? John Kitchin
2016-12-21 20:27 ` Cook, Malcolm
2016-12-21 20:53   ` John Kitchin

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).