From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: A simple way to search only headlines Date: Fri, 7 Jun 2013 20:05:21 -0400 Message-ID: References: <87sj11a8yq.fsf@thinkpad.tsdh.de> <86y5arocrz.fsf@somewhere.org> <86k3mae2mo.fsf@somewhere.org> <87mwr1egjr.fsf@berkeley.edu> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bd770a4b2888704de994d02 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ul6er-0004Ci-VJ for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 20:05:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ul6eo-0005sF-Em for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 20:05:25 -0400 Received: from mail-ie0-x232.google.com ([2607:f8b0:4001:c03::232]:64870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ul6eo-0005s1-8L for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 20:05:22 -0400 Received: by mail-ie0-f178.google.com with SMTP id at1so7967088iec.23 for ; Fri, 07 Jun 2013 17:05:21 -0700 (PDT) In-Reply-To: <87mwr1egjr.fsf@berkeley.edu> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Richard Lawrence Cc: org mode --047d7bd770a4b2888704de994d02 Content-Type: text/plain; charset=ISO-8859-1 Hi Richard Fantastic, thx alot for the code snippet and detailed explanation, it really helps to understand what goes on. unfortunately i get an error: Wrong type argument: commandp, (lambda nil (org-agenda nil "s" "<")) any clue? best Z. On Fri, Jun 7, 2013 at 5:50 PM, Richard Lawrence < richard.lawrence@berkeley.edu> wrote: > Xebar Saram writes: > > > Thank you both Thorsten and Seb, i really appreciate the help! > > > > Seb, you wrote: The programming equivalent to C-c a s is: > > > > (org-agenda nil "s") > > > > That's what you'd have to bind to a key (using a "lambda" function). > > > > im a complete neewb and dont really have any idea on how to do the above, > > can you show me an example? > > I think you're looking for something like: > > (define-key org-mode-map (kbd "C-M-h") (lambda () (org-agenda nil "s" > "<"))) > > You could put a line like that in your .emacs. Here's what it does: > #+BEGIN_SRC emacs-lisp > (define-key ;; insert a new keybinding > org-mode-map ;; into the Org mode map (so this won't affect bindings in > non-Org buffers) > > ;; This is the key we're binding: C-M-h, for "headline" search > ;; You can use whatever key you like, but you might want to check first > that it isn't > ;; already bound to something else (e.g., via C-h k from an Org buffer). > ;; The kbd macro converts a string representation to the appropriate key > code. > (kbd "C-M-h") > > ;; This is the function to run when the key is pressed. The lambda > ;; form creates an anonymous function which calls org-agenda with > ;; the "s" argument and a restriction to current buffer. > (lambda () (org-agenda nil "s" "<"))) > #+END_SRC > > Best, > Richard > > > --047d7bd770a4b2888704de994d02 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Richard

Fantastic, thx alot fo= r the code snippet and detailed explanation, it really helps to understand = what goes on. unfortunately i get an error:

Wrong type argument: commandp, (lambda nil (org-agenda nil "s" &q= uot;<"))

any clue?

best

Z.


On Fri, Jun 7, 2013 at 5:50 PM, Richard Lawrence <richard.law= rence@berkeley.edu> wrote:
Xebar Saram <zeltakc@gmail.com> writes:

> Thank you both Thorsten and Seb, i really appreciate the help!
>
> Seb, you wrote: The programming equivalent to C-c a s is:
>
> =A0 =A0 (org-agenda nil "s")
>
> That's what you'd have to bind to a key (using a "lambda&= quot; function).
>
> im a complete neewb and dont really have any idea on how to do the abo= ve,
> can you show me an example?

I think you're looking for something like:

(define-key org-mode-map (kbd "C-M-h") (lambda () (org-agenda nil= "s" "<")))

You could put a line like that in your .emacs. =A0Here's what it does:<= br> #+BEGIN_SRC emacs-lisp
(define-key =A0 =A0;; insert a new keybinding
=A0 org-mode-map ;; into the Org mode map (so this won't affect binding= s in non-Org buffers)

=A0 ;; This is the key we're binding: C-M-h, for "headline" s= earch
=A0 ;; You can use whatever key you like, but you might want to check first= that it isn't
=A0 ;; already bound to something else (e.g., via C-h k from an Org buffer)= .
=A0 ;; The kbd macro converts a string representation to the appropriate ke= y code.
=A0 (kbd "C-M-h")

=A0 ;; This is the function to run when the key is pressed. =A0The lambda =A0 ;; form creates an anonymous function which calls org-agenda with
=A0 ;; the "s" argument and a restriction to current buffer.
=A0 (lambda () (org-agenda nil "s" "<")))
#+END_SRC

Best,
Richard



--047d7bd770a4b2888704de994d02--