From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darlan Cavalcante Moreira Subject: Re: Easily go to some frequently accessed heading (narrowed to region) Date: Wed, 02 Feb 2011 23:10:04 -0300 Message-ID: <4d4a0e81.2945960a.1089.01aa@mx.google.com> References: <4d487c86.5043ec0a.55ad.ffffaf99@mx.google.com> <87y65y99m6.fsf@ucl.ac.uk> <4d4965fa.0431640a.66d2.664c@mx.google.com> <87k4hifn6w.fsf@ucl.ac.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from [140.186.70.92] (port=57170 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PkoeE-0000JD-7t for emacs-orgmode@gnu.org; Wed, 02 Feb 2011 21:10:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PkoeC-0001EC-SU for emacs-orgmode@gnu.org; Wed, 02 Feb 2011 21:10:14 -0500 Received: from mail-yi0-f41.google.com ([209.85.218.41]:50845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PkoeC-0001E6-Nw for emacs-orgmode@gnu.org; Wed, 02 Feb 2011 21:10:12 -0500 Received: by yia25 with SMTP id 25so338757yia.0 for ; Wed, 02 Feb 2011 18:10:11 -0800 (PST) In-Reply-To: <87k4hifn6w.fsf@ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric S Fraga Cc: Orgmode Mailing List Thanks again Eric, this is a good solution for projects that are not accessed frequently for me (I only know some of the org search capabilities, I guess it is time to reread that section in the manual). At last, using the initial code provided by Bastien I was able to program something that gives me what I wanted. The code is provided below. Basically, I only need to write a "my-find-someproject*-org-heading" function for each projects I am interested in and bind it to a key. I had before the "F1" key binded to a function that just opened my main org file, therefore the most straightforward idea is to rebind that function to "F1 F1" and then bind the different my-find-someproject*-org-heading functions to "F1 SomeKey". #+begin_src emacs-lisp (defun buffer-exists (bufname) (not (eq nil (get-buffer bufname)) ) ) (defun my-find-org-heading (projectName) (interactive) (let (heading org-indirect-buffer-display) (setq heading (concat "* " projectName)) (setq org-indirect-buffer-display 'current-window) (if (buffer-exists projectName) (switch-to-buffer projectName) ;; Else (progn (find-file "~/org/main.org") (goto-char (point-min)) (search-forward heading) (org-tree-to-indirect-buffer) (rename-buffer projectName) (org-overview) (show-children) ) ) ) ) (defun my-find-someproject-org-heading nil (interactive) (my-find-org-heading "someproject") ) #+end_src -- Darlan At Wed, 02 Feb 2011 15:52:55 +0000, Eric S Fraga wrote: > > Darlan Cavalcante Moreira writes: > > > Thanks Eric > > > > I tried org-goto before, but I needed something that I could bind to a > > [...] > > > A custom agenda view is is good to see the tasks associated with a project > > and I already tag each project as you suggested, but besides the tasks > > there are some subheadings in each project that have only information > > without tasks or schedule/deadline dates. That is what motivated me to > > search for a way to quickly access the project contents and not only its > > tasks. > > Okay, let's try a third suggestion (in case it's 3rd time lucky ;-): > > 3. what about a sparse tree view (org-sparse-tree, C-c /, followed by > 'm' for match on a tag of choice) of your projects file? > > But again, this isn't necessarily something you can program, although > maybe you can as org-sparse-tree invokes org-match-sparse-tree which > looks definitely viable as a candidate for programmatic use: > > ,---- > | org-match-sparse-tree is an interactive compiled Lisp function in > | `org.el'. > | > | (org-match-sparse-tree &optional TODO-ONLY MATCH) > | > | Create a sparse tree according to tags string MATCH. > | MATCH can contain positive and negative selection of tags, like > | "+WORK+URGENT-WITHBOSS". > | If optional argument TODO-ONLY is non-nil, only select lines that are > | also TODO lines. > `---- > > so you could definitely write specific a function to use this, with a > specific match string, followed by a narrow to subtree? > > -- > : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 > : using Org-mode version 7.4 (release_7.4.298.g16b40)