From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: heading specific fast keys? Date: Wed, 21 Dec 2016 15:53:35 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJntQ-000377-RH for emacs-orgmode@gnu.org; Wed, 21 Dec 2016 15:53:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cJntM-0003SO-NZ for emacs-orgmode@gnu.org; Wed, 21 Dec 2016 15:53:44 -0500 Received: from mail-qk0-x232.google.com ([2607:f8b0:400d:c09::232]:32878) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cJntM-0003SE-IA for emacs-orgmode@gnu.org; Wed, 21 Dec 2016 15:53:40 -0500 Received: by mail-qk0-x232.google.com with SMTP id t184so94039172qkd.0 for ; Wed, 21 Dec 2016 12:53:40 -0800 (PST) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" 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