emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: Manish <mailtomanish.sharma@gmail.com>
Cc: Alan Schmitt <alan.schmitt@polytechnique.org>,
	Org-Mode <emacs-orgmode@gnu.org>
Subject: Re: Question re. Bernt's agenda setup
Date: Sun, 25 Nov 2012 19:45:23 -0500	[thread overview]
Message-ID: <87ehjhp4yk.fsf@norang.ca> (raw)
In-Reply-To: <CAHuUovWFrA8X1UA9KJpZGHYGwu0haSasrfxdXDagHYZz8ef2SA@mail.gmail.com> (Manish's message of "Sun, 25 Nov 2012 23:23:34 +0530")

Manish <mailtomanish.sharma@gmail.com> writes:

> On Sat, Nov 24, 2012 at 12:25 PM, Bernt Hansen wrote:
>> Viktor Rosenfeld writes:
>>
>>> Alan Schmitt wrote:
>>>
>>>> Viktor Rosenfeld writes:
>>>>
>>>> > it's Shift-P and you need to bind the function bh/narrow-to-project to
>>>> > the keycode. See the code blocks in the following two sections:
>>>> >
>>>> > http://doc.norang.ca/org-mode.html#SpeedCommands
>>>> > http://doc.norang.ca/org-mode.html#NarrowToSubtree
>>>>
>>>> I managed to make this work, but if I run the command in the agenda I
>>>> need to refresh it afterwards (using 'g'). Are you seeing the same
>>>> thing?
>>>
>>> Yes, unfortunately. I think I remember that it used to refresh the
>>> agenda automatically. This is above my pay grade, I'm afraid.
>>>
>>> Cheers,
>>> Viktor
>>>
>>>>
>>>> And I also want to say I have learned a lot implementing the suggestions
>>>> in that document.
>>>>
>>>> Alan
>>
>> I have also noticed this in Windows at work and actually toyed with the
>> idea of dropping the commands from the agenda that don't refresh
>> properly anymore ... but quickly found I can't live without that
>> functionality.  So I too am doing 'g' to refresh as required ATM.
>>
>> If I figure out a fix I'll post that.
>
> Meanwhile after wasting a couple of hours trying to make it work with
> AutoHotKey, I just recorded an Emacs macro, named and dumped it and tied
> it to a keychord. Following seems to be working well for me:
>
> #+begin_src emacs-lisp
> ;; work around for V not refreshing on Windows
> ;; use when in agenda after F12-SPC
> (global-set-key (kbd "C-<f7>")
>                 (fset 'my-next-project
>                       (lambda (&optional arg) "Keyboard macro."
>                         (interactive "p")
>                         (kmacro-exec-ring-item (quote ("Vg\274" 0 "%d")) arg))))
> #+end_src

This workaround also seems to fix V on windows:

--8<---------------cut here---------------start------------->8---
(defun bh/view-next-project ()
  (interactive)
  (unless (marker-position org-agenda-restrict-begin)
    (goto-char (point-min))
    (setq bh/current-view-project (point)))
  (bh/widen)
  (goto-char bh/current-view-project)
  (forward-visible-line 1)
  (while (and (< (point) (point-max))
	      (or (not (org-get-at-bol 'org-hd-marker))
		  (org-with-point-at (org-get-at-bol 'org-hd-marker)
		    (or (not (bh/is-project-p))
			(bh/is-project-subtree-p)))))
    (forward-visible-line 1))
  (setq bh/current-view-project (point))
  (if (org-get-at-bol 'org-hd-marker)
      (progn
	(bh/narrow-to-project)
	(org-agenda-redo)
	(beginning-of-buffer))
    (error "All projects viewed.")))
--8<---------------cut here---------------end--------------->8---

I would prefer something that is consistent on linux and windows
though...

Regards,
Bernt

  reply	other threads:[~2012-11-26  0:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15 19:24 Question re. Bernt's agenda setup Manish
2012-11-15 21:42 ` Viktor Rosenfeld
2012-11-16  7:59   ` Alan Schmitt
2012-11-16 10:55     ` Viktor Rosenfeld
2012-11-24  6:55       ` Bernt Hansen
2012-11-25 17:53         ` Manish
2012-11-26  0:45           ` Bernt Hansen [this message]
2012-11-27  6:12             ` Manish
2012-11-16 11:58   ` Manish
2012-11-16 13:09     ` Memnon Anon
2012-11-17 12:55       ` Manish
2012-11-18 16:05         ` Manish
2012-11-19 14:04           ` Alan Schmitt
2012-11-19 19:18             ` Manish
2012-11-24  7:00               ` Bernt Hansen
2012-11-24  6:50       ` Bernt Hansen
2012-11-24  6:47   ` Bernt Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ehjhp4yk.fsf@norang.ca \
    --to=bernt@norang.ca \
    --cc=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=mailtomanish.sharma@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).