BUG+PATCH org-capture hangs under Cygwin/X

2022-07-11 Thread Max Mikhanosha
Due to various reasons I'm now using Cygwin/X Emacs, and for this emacs,
(gui-get-selection) method is kind of slow (about 0.2) seconds.

While this is not a big deal usually, (org-get-x-clipboard) calls
(gui-get-selection) 4 times with different formats (utf8, text,
compound-text and string).

On top of that, (org-capture-fill-template) calls (org-get-x-clipboard) 3
times with PRIMARY, CLIPBOARD and SECONDARY, and then calls it again to
make values for the ^%C expansion.

In addition it also calls (current-kill 0), which in itself calls
(gui-selection-value), which also may call (gui-get-selection up to 4
times), and has a side effect of clearing the clipboard if
select-use-clipboard is true.

All of the above calls are made even if template parameters don't have any
expansions that reference selection.

This results in org-capture having about 16 second hang for me on Cygwin/X
when clipboard and selection are completely empty.

Attached patch changes it so that we only call (org-get-x-clipboard) and
(current-kill 0) lazily. The logic had not changed, we just don't pre-cache
values that we don't need.


0001-org-capture-fix-hang-under-Cygwin-X-emacs.patch
Description: Binary data


PATCH: [PATCH] Allow bulk agenda actions to take log notes

2022-07-10 Thread Max Mikhanosha
Currently org-agenda-bulk-action is completely broken if anything tries to
take a log note during the action, this patch fixes it by storing log note
setup variables in a list, and then taking one log note, and duplicating it
over all affected items.

Please CC me when responding as I'm not subscribed.

Regards,
  Max


0001-Allow-bulk-agenda-actions-to-take-log-notes-a-note-f.patch
Description: Binary data


Re: [O] RFQ - new contribution - org-screenshot.el

2013-05-17 Thread Max Mikhanosha
At Fri, 17 May 2013 09:38:29 +0200,
Rainer M. Krug wrote:
 
 Nice and very useful. Can this be included in /contrib?

That is my intention, I have the FSF paper signed for Emacs and Org.

So what I'm looking for some minimum amount of eyes on the code, and
advice as to minimum set of things I need to adjust before committing it?

My list is.

1. Convert defvar to defcustom

2. Is (require 'dired) fine? It uses macro `dired-mark-if' defined in
   dired.el

3. The prefix C-c M-s seems awkward but Org is so big everything else
   is taken, and C-c C-x s is too close to C-c C-x C-s, which is
   archive subtree (I initially had it there and moved after archiving
   subtree by mistake)

Its its fine to go in as is, then its fine too, I'm pretty lazy :-)

Regards,
  Max



Re: [O] RFQ - new contribution - org-screenshot.el

2013-05-17 Thread Max Mikhanosha
At Fri, 17 May 2013 15:05:05 +0200,
Carsten Dominik wrote:
  
  Nice and very useful. Can this be included in /contrib?
 
 Certainly!

Ok cool, I've already cleaned up the docstrings, I'll change some
defvars to defcustoms and commit it later today.

Regards,
  Max



Re: [O] RFQ - new contribution - org-screenshot.el

2013-05-17 Thread Max Mikhanosha
At Fri, 17 May 2013 13:20:16 -0400,
Brett Viren wrote:
 
 Hi Max, 
 
 Max Mikhanosha m...@openchat.com writes:
 
  I have committed org-screenshot to master
 
 This sounds like a great idea.  And just to prove that no good deed goes
 unpunished, here is a bug report:
 
 In an org-mode file I run M-x org-screenshot-take, scrot runs and I
 can either click on a window or draw a selection box.  
 
 However, lifting the mouse button leads to:
 
   error in process sentinel: Symbol's value as variable is void: return [2 
 times]

Just committed a potential fix, can you see if it works? Commit
0d68eef0372b6b57359a49cb5e35b67c651c5ee2

If it does not work, I'll need you to give me a backtrace, instructions on how
to are http://orgmode.org/manual/Feedback.html#Feedback around 1 page down
under How to create a useful backtrace

Regards,
  Max



[O] RFQ - new contribution - org-screenshot.el

2013-05-16 Thread Max Mikhanosha
Hi All,

I've been writing some documentation in OrgMode with screenshots, and
as with any screenshot taking, it takes a while to get one just right.

A few tiny helper utilities, quickly snowballed into this :-) It may
need some cleanup, but IMHO its too awesome not to share it with the
list.

To try it out, you'll need /usr/bin/scrot which is available as
scrot package on most distributions.

Then (require 'org-screenshot) and try C-c M-s (org-screenshot-take) in an Org 
File. Make
sure to turn on inline image display (C-c C-x C-v) after taking the
first screenshot.

Regards,
 Max



org-screenshot.el
Description: Binary data


[O] PATCH: Habit consistency always show DONE days green option

2013-05-06 Thread Max Mikhanosha
I had always disliked how if you miss a habit deadline and then go on
a several day streak, first day still show up red. Makes it hard to
visually see green streaks

Following patch adds a new variable `org-habit-show-done-always-green'
to fix that. It defaults to off, if enough people like it we can
make it new default.

To illustrate the difference in display, try to count number of two
day streaks in below screen-shots.

Current display:

   http://i.imgur.com/HlyXE2o.png

With new option:

   http://i.imgur.com/3ZmImkP.png

Note that no information is lost, you can still figure out if streak
started after missing a deadline, by color of the previous day.

Regards,
  Max

From 5c7f9b63b6021631b19b883760340a18024e6344 Mon Sep 17 00:00:00 2001
From: Max Mikhanosha m...@openchat.com
Date: Mon, 6 May 2013 09:26:10 -0400
Subject: [PATCH] Add option to always show DONE days as green on consistency
 graph. It can be enabled by setting
 `org-habit-show-done-alwyays-green' variable to t.

* lisp/org-habit.el (org-habit-get-faces): Add show done days green option
---
 lisp/org-habit.el | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index 8465ba4..0899f45 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -85,6 +85,12 @@ (defcustom org-habit-completed-glyph ?*
   :version 24.1
   :type 'character)
 
+(defcustom org-habit-show-done-always-green nil
+  If non-nil, a DONE day will always be green in consistency
+graph, even if it was done after deadline
+  :group 'org-habit
+  :type 'boolean)
+
 (defface org-habit-clear-face
   'background light)) (:background #8270f9))
 (((background dark)) (:background blue)))
@@ -272,8 +278,9 @@ (defun org-habit-get-faces (habit optional now-days 
scheduled-days donep)
   (if donep
  '(org-habit-ready-face . org-habit-ready-future-face)
'(org-habit-alert-face . org-habit-alert-future-face)))
- (t
-  '(org-habit-overdue-face . org-habit-overdue-future-face)
+ ((and org-habit-show-done-always-green donep)
+  '(org-habit-ready-face . org-habit-ready-future-face))
+ (t '(org-habit-overdue-face . org-habit-overdue-future-face)
 
 (defun org-habit-build-graph (habit starting current ending)
   Build a graph for the given HABIT, from STARTING to ENDING.
-- 
1.7.11.rc0.100.g5498c5f





Re: [O] Insert TODO Item at Bottom

2012-10-21 Thread Max Mikhanosha
At Fri, 19 Oct 2012 01:31:24 +0200,
Esben Stien wrote:
 
 I add a TODO item with M-S-RET, but is there any way to insert the new
 TODO item at the bottom of the current node or is there any way to
 navigate quickly to the last TODO item of the current node?.
 
 I often run C-c a s to search, but I end up at the top and I always have
 to scroll down to the last TODO item; this is wasting my life

This is what I use, the commands insert the new todo at the beginning
of the current subtree, and in the end..

For example if you are currently editing the org document shown below,
and are at the point before position, then corresponding commands
will add the two items at the top and the bottom.. Get rid of viper
part if you not using viper.

* Project
** TODO point after
** TODO Some item
   some text point before
** TODO Another item
** TODO point after

(defun my-org-end-of-parent ()
  Go to the end of the parent of the current headline, return parent headline 
level
  (org-back-to-heading t)
  (org-up-heading-safe)
  (let ((level (org-outline-level)))
(org-end-of-subtree t t)
(or (bolp) (insert \n))
(org-back-over-empty-lines)
(org-reveal nil)
level))

(defun my-org-insert-todo-heading-end (arg)
  Insert TODO heading at the end of the current project
  (interactive p)
  (let ((parent-level (my-org-end-of-parent)))
(when parent-level
  (end-of-line 0)
  (org-reveal nil)
  (org-insert-todo-heading-respect-content)
  (viper-change-state-to-insert

(defun my-org-insert-todo-heading-start (arg)
  Insert TODO heading at the end of the current project
  (interactive p)
  (org-back-to-heading t)
  (org-up-heading-safe)
  (outline-next-heading)
  (beginning-of-line)
  (org-reveal)
  (org-insert-todo-heading-respect-content)
  (viper-change-state-to-insert))





Re: [O] [PATCH] speedup redisplay of agenda item after change

2012-09-30 Thread Max Mikhanosha
At Sat, 29 Sep 2012 08:21:08 +0200,
Bastien wrote:
 
 Max Mikhanosha m...@openchat.com writes:
 
  Following patch changes (org-agenda-change-all-lines) to call
  (org-agenda-finalize) for each line changed, with agenda buffer
  narrowed to just that line, and it speeds up redisplay of current item
  a lot, the Shift-Up changing of priority can almost keep up with
  keyboard repeat rate on large agendas.
 
 This is a great optimization trick, thanks a lot for this patch,
 I just applied it.
 
  I was running with this patch for a month, and did not noticed any
  problems so far.
 
 Did you run it with latest Org from maint, from master? 

No sorry I had not tried with maint, just with head of the repository.

 Also, would you like to get push access to the repo?  I'd be glad.
 Just send me your public key if so.

I've had commit access (for sticky agenda), so unless someone removed
me I should still have it.

The reason I did not commit it directly, that its kind of innocent
looking change but in the sensitive area of the code, so I wanted more
eyes / testing on it first. If there is anything broken by it, my
guess it could bulk commands, clocking and/or undo stuff, and I'm not
these much.

Regards,
  Max



Re: [O] Bug: startup: hidestars does not use the real window background color [7.8.11]

2012-09-28 Thread Max Mikhanosha
At Tue, 18 Sep 2012 12:25:04 +0200,
Bastien wrote:
 
 Hi Arne,
 
 Arne Babenhauserheide (IMK) arne.babenhauserhe...@kit.edu writes:
 
  Dear org Hackers,
 
  I use a custom color scheme in KDE with brown window background color,
  and when I activate #+STARTUP: hidestars, the first stars are white
  instead of brown.
 
  My color scheme is Antiford
  ? http://opendesktop.org/content/show.php/Antiford?content=142571
 
 This is now fixed: the `org-hide' face is a bit more clever when trying
 the get the background color.

Just updated org, and this fix a problem for me in multi-tty emacs. On
the tty frames, the my default face background is unspecified-bg,
which leaves background color alone (ie its whatever default
background xterm or other emulator uses)

This allows to have different xterm's with similar but differently
shaded backgrounds for different tasks, without changing background in
Emacs.

With this new fix, when org-mode file is visited on tty, it sets
'org-hide face foreground to unspecified-bg which makes all leading
stars reverse color.

Patch to fix this is pasted below.


From 1f0ef1241acd7c22fff275ae65a6bf2a9fd84f06 Mon Sep 17 00:00:00 2001
From: Max Mikhanosha m...@openchat.com
Date: Fri, 28 Sep 2012 11:48:05 -0400
Subject: [PATCH] * lisp/org.el (org-mode): don't set org-hide foreground to
 invisible-bg (org-find-invisible-foreground): new
 function

---
 lisp/org.el | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index c47e2ad..7f09d15 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5144,14 +5144,7 @@ (define-derived-mode org-mode outline-mode Org
 (unless org-inhibit-startup-visibility-stuff
   (org-set-startup-visibility)))
   ;; Try to set org-hide correctly
-  (set-face-foreground
-   'org-hide
-   (or (face-background 'default)
-   (face-background 'org-default)
-   (cdr (assoc 'background-color default-frame-alist))
-   (cdr (assoc 'background-color initial-frame-alist))
-   (cdr (assoc 'background-color window-system-default-frame-alist))
-   (face-foreground 'org-hide
+  (set-face-foreground 'org-hide (org-find-invisible-foreground)))
 
 (when (fboundp 'abbrev-table-put)
   (abbrev-table-put org-mode-abbrev-table
@@ -5159,6 +5152,19 @@ (define-derived-mode org-mode outline-mode Org
 
 (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify)
 
+
+(defun org-find-invisible-foreground ()
+  (let ((candidates (remove
+unspecified-bg 
+(list 
+ (face-background 'default) 
+ (face-background 'org-default) 
+ (cdr (assoc 'background-color default-frame-alist)) 
+ (cdr (assoc 'background-color initial-frame-alist)) 
+ (cdr (assoc 'background-color 
window-system-default-frame-alist)) 
+ (face-foreground 'org-hide) 
+(car (remove nil candidates
+
 (defun org-current-time ()
   Current time, possibly rounded to `org-time-stamp-rounding-minutes'.
   (if ( (car org-time-stamp-rounding-minutes) 1)
-- 
1.7.11.rc0.100.g5498c5f




[O] [PATCH] speedup redisplay of agenda item after change

2012-09-28 Thread Max Mikhanosha
I had noticed that with large agendas (several hundred items), any
command that changes and re-displays the current item is slow. For
example something like changing priority with Shift-Up/Down key, can
take a second or two.

Most of that time is spent in (org-agenda-finalize) call, which is
responsible for putting finishes touches, such as fortifying [#A] as
bold when you change priority from [#B].

It seems that even if only single line had changed, the
(org-agenda-finalize) still processes entire agenda buffer, which is
the cause of the slowness.

Following patch changes (org-agenda-change-all-lines) to call
(org-agenda-finalize) for each line changed, with agenda buffer
narrowed to just that line, and it speeds up redisplay of current item
a lot, the Shift-Up changing of priority can almost keep up with
keyboard repeat rate on large agendas.

I was running with this patch for a month, and did not noticed any
problems so far.

From 432293f3c55308f3f76b0c5284ca696fb11f10ea Mon Sep 17 00:00:00 2001
From: Max Mikhanosha m...@openchat.com
Date: Fri, 28 Sep 2012 09:02:07 -0400
Subject: [PATCH] speedup redisplay of agenda item after change

* lisp/org-agenda.el (org-agenda-change-all-lines): speedup
 refresh of a single line of agenda by narrowing the agenda
 buffer just that line before calling org-agenda-finalize-

---
 lisp/org-agenda.el | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ea607eb..30dd5bf 100755
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8079,9 +8079,11 @@ (defun org-agenda-change-all-lines (newhead hdmarker
 undone-face done-face
(org-agenda-highlight-todo 'line)
(beginning-of-line 1))
-  (t (error Line update did not work
-   (beginning-of-line 0)))
-(org-agenda-finalize)))
+  (t (error Line update did not work)))
+ (save-restriction
+   (narrow-to-region (point-at-bol) (point-at-eol))
+   (org-agenda-finalize)))
+   (beginning-of-line 0)
 
 (defun org-agenda-align-tags (optional line)
   Align all tags in agenda items to `org-agenda-tags-column'.
-- 
1.7.11.rc0.100.g5498c5f




[O] Bug?: org-agenda-set-property sets property on wrong element

2012-06-28 Thread Max Mikhanosha

Can someone confirm this, before I try to fix this?

1. Generate agenda
2. Go to some entry A by pressing RET
3. Switch back to agenda, and make sure its the only window (or that
   A's buffer is not in any other window)
4. In Agenda navigate to entry B (in the same buffer as A), and C-c
   C-x p (org-agenda-set-property), use any property name or value

Result: property is set in entry A not in entry B. This is with
org-mode from git, and emacs 23.

The problem seems to be that the code like this (with-current-buffer
buffer (goto-char pos (call-interactively 'some-command)) the point
inside of 'some-command will not be at `pos', but where the user last
moved it, _unless_ the buffer's window is selected window, then
(goto-char) sticks through (call-interactively) boundary.

Could be that there are other pieces of code like this in lurking in
there.

Regards,
  Max



Re: [O] [bug] org-habit-show-all-today undefined

2012-05-29 Thread Max Mikhanosha
At Tue, 29 May 2012 11:33:35 -0400,
Nick Dokos wrote:
 
 Eric S Fraga e.fr...@ucl.ac.uk wrote:
 
  I get the following error as soon as I try to view my agenda.  I don't
  use habits at all.
  
  ,
  | Debugger entered--Lisp error: (void-variable org-habit-show-all-today)
 
 I fixed it (or maybe I should say: I fixed it :-) ) by giving an
 initial value to the variable in org-agenda.el:
 
 (defvar org-habit-show-all-today nil
   ... doc string ...)

Sorry, forgot to test without 'org-habit loaded, should be fixed now.

Regards,
  Max




Re: [O] List all habits with consistency graph

2012-05-28 Thread Max Mikhanosha
Hi Henning,

At Wed, 21 Mar 2012 12:08:17 +0100,
Henning Weiss wrote:
 
 I tried using a skip function to create an agenda that only contains
 habits following this post. To display habits that are not scheduled
 for today, I enabled org-habit-show-habits-only-for-today. This
 made it possible for me to view all other habits by navigating
 through the agenda.
 
 The problem with this approach is that some of my habits have
 various intervals, ie. daily, bi-weekly, bi-monthly and
 monthly. This makes it quite cumbersome to track down all of the
 habits in the agenda. Also, there is a lot of noise because of the
 agenda day separators and the duplication of habits (ie. daily
 habits are displayed every day).
 
 How can I get a cleaner view of the habit list for entries that
 are scheduled at some point in the future? Maybe if it would somehow
 be possible to create an agenda that collapses multiple days into
 one, I could filter it by habit to give me a habit list. I could see
 myself using this collapsed agenda for other things as well.

I implemented the above functionality, and pushed it to master. There
is new customization variable `org-habit-show-all-today' which when
set to t, will show all habits (even if they are scheduled for the
future) on today's agenda.

In fact I kind of like it, so wondering maybe it should be made `t' by
default?

Regards,
  Max



Re: [O] [Sticky Agenda] How to create Agenda Buffers in functions

2012-04-19 Thread Max Mikhanosha
At Thu, 19 Apr 2012 22:17:08 +0200,
Sebastien Vauban wrote:

 I tried the updated version of Sven:
 
 #+begin_src emacs-lisp
   (defun my-gtd-frame ()
 (interactive)
 (save-excursion)
 (make-frame '(
(name  . gtd)
(active-alpha  . 0.75)
(inactive-alpha. 0.8)
(top   . 20)
(left  . 20)
(width . 80)
(height. 40)))
 (select-frame-by-name gtd)
 (org-agenda-goto-today)
 (delete-other-windows)
 (split-window-horizontally)
 (other-window 1)
 (catch 'exit
   (org-batch-agenda work)))
 #+end_src
 
 But I get the following error:
 
 --8---cut here---start-8---
 Debugger entered--Lisp error: (error Not allowed in nil-type agenda buffers)
   signal(error (Not allowed in nil-type agenda buffers))
   error(Not allowed in %s-type agenda buffers nil)
   (if error (error Not allowed in %s-type agenda buffers org-agenda-type) 
 nil)
   (if (memq org-agenda-type types) t (if error (error Not allowed in %s-type 
 agenda buffers org-agenda-type) nil))
   org-agenda-check-type(t timeline agenda)
   org-agenda-goto-today()
   my-gtd-frame()
   call-interactively(my-gtd-frame)
   ...
 Am I missing something?
 

The call to (org-agenda-goto-today) is before it created the agenda, I
think it should be inside the catch, after the (org-batch-agenda) call.

Regards,
  Max



Re: [O] starting agenda gives: Selecting deleted buffer

2012-04-18 Thread Max Mikhanosha
At Wed, 18 Apr 2012 16:22:01 +0200,
Rainer Stengele wrote:
 
 After deleting all buffers and then trying to start any agenda (for example 
 C-a a) I get this error message:
 
 Debugger entered--Lisp error: (error Selecting deleted buffer)
   org-compile-prefix-format(agenda)
   org-agenda-list(nil)
   call-interactively(org-agenda-list)
   (let ((org-agenda-span (quote day)) (org-agenda-start-with-log-mode t) 
 (org-agenda-overriding-header Today's Agenda  + Prio A todos ))
 (call-interactively (quote org-agenda-list)))
   (let ((org-agenda-sorting-strategy (quote (time-up priority-down 
 todo-state-up (let ((org-agenda-span (quote day))
 (org-agenda-start-with-log-mode t) (org-agenda-overriding-header Today's 
 Agenda  + Prio A todos )) (call-interactively (quote
 org-agenda-list
   eval((let ((org-agenda-sorting-strategy (quote (time-up priority-down 
 todo-state-up (let ((org-agenda-span (quote day))
 (org-agenda-start-with-log-mode t) (org-agenda-overriding-header Today's 
 Agenda  + Prio A todos )) (call-interactively (quote
 org-agenda-list)
   org-let2(((org-agenda-sorting-strategy (quote (time-up priority-down 
 todo-state-up ((org-agenda-span (quote day))
 (org-agenda-start-with-log-mode t) (org-agenda-overriding-header Today's 
 Agenda  + Prio A todos )) (call-interactively (quote
 org-agenda-list)))
   org-agenda-run-series(agenda - no (!) todos - sorted prio up - 1 day 
 (((agenda prio ABC agenda ((org-agenda-span (quote day))
 (org-agenda-start-with-log-mode t) (org-agenda-overriding-header Today's 
 Agenda  + Prio A todos ))) (alltodo todos Prio A+B
 ((org-agenda-skip-function (lambda nil (or (org-agenda-skip-entry-if ... 
 \\=.*\\[#A\\|#B\\]) (org-agenda-skip-entry-if ... ...)))
 ((org-agenda-sorting-strategy (quote (time-up priority-down 
 todo-state-up))
   byte-code(\306\307   \232\203
 
 Can anybody confirm this is a bug?
 

Is this with git master version, that includes sticky changes?

This is really weird, only place this error can come from is from
(with-current-buffer org-agenda-buffer) inside of
`org-compile-prefix-format', but there is no code path through
`org-agenda' - `org-prepare-agenda' that does not set
org-agenda-buffer variable.

I just updated to latest master, and I can't reproduce it.

Could it be that you somehow forgot to recompile .elc files?

Regards,
  Max




Re: [O] Sticky agenda branch merged

2012-04-17 Thread Max Mikhanosha
At Tue, 17 Apr 2012 12:09:40 +0200,
Rainer Stengele wrote:
 
 Am 16.04.2012 11:47, schrieb Max Mikhanosha:
  I had just pushed a merge of max-sticky-agenda branch to master, let
  me know if there are any problems, also feel free to hack/iterate on
 
 I see a strange behaviour when clocking in with C-c C-x C-i.
 Sometimes (!) there is no new CLOCK: entry created.
 The TODO state changes as expected, but no new CLOCK: line is created, even 
 when clocking out.
 Looks like this happens when the initial TODO state is set.
 
 Maybe I missed a change in the behaviour?

Rainer, I can't reproduce this, can you give me a few more details?

1. Are you doing C-c C-x C-i from agenda, or from an Org File?

2. I don't understand the TODO state changes as expected part, I
thought clock-in command has no effect on todo state, ie it simply
adds CLOCK line to logbook drawer. Is there some extra configuration I
need to change to enable this bit?

3. Are sticky agendas enabled?

4. If its from agenda, and its sticky, is it freshly generated, or was
   it refreshed with g or r key?

5. If its from sticky agenda, can you reproduce it without enabling sticky 
agendas?

Regards,
  Max



Re: [O] Sticky agenda branch merged

2012-04-17 Thread Max Mikhanosha
Hi Rainer, 

At Tue, 17 Apr 2012 15:23:00 +0200,
Rainer Stengele wrote:
 
 Am 17.04.2012 14:29, schrieb Max Mikhanosha:
  At Tue, 17 Apr 2012 12:09:40 +0200,
  Rainer Stengele wrote:
  Am 16.04.2012 11:47, schrieb Max Mikhanosha:
  I had just pushed a merge of max-sticky-agenda branch to master, let
  me know if there are any problems, also feel free to hack/iterate on
  I see a strange behaviour when clocking in with C-c C-x C-i.
  Sometimes (!) there is no new CLOCK: entry created.
  The TODO state changes as expected, but no new CLOCK: line is created, 
  even when clocking out.
  Looks like this happens when the initial TODO state is set.
 
  Maybe I missed a change in the behaviour?
  Rainer, I can't reproduce this, can you give me a few more details?
 
  1. Are you doing C-c C-x C-i from agenda, or from an Org File?
 
 from org file
 
 
  2. I don't understand the TODO state changes as expected part, I
  thought clock-in command has no effect on todo state, ie it simply
  adds CLOCK line to logbook drawer. Is there some extra configuration I
  need to change to enable this bit?
 
 I have set org-clock-in-switch-to-state to INARBEIT state in my state 
 sequence
 
 #+SEQ_TODO: TODO INARBEIT WARTEN | MOVED DONE CANCELED DELEGATED
 
 As soon as I am in state INARBEIT and doing a clockin, the CLOCK: line 
 appears.
 
  3. Are sticky agendas enabled?
 
 YES!
 
  4. If its from agenda, and its sticky, is it freshly generated, or was
 it refreshed with g or r key?
 it is not from agenda
 
  5. If its from sticky agenda, can you reproduce it without enabling sticky 
  agendas?
 Let me see: no, problem occurs with or without sticky agendas
 

So far this looks to me as its unrelated to sticky changes, could you
by any chance try commit 3bd1c2e9bff539c94f92f1ec919f8f0f1640f8c0
which is 1 before sticky merge , and see if same scenario is broken
there?

The git commands to do it (ignore if your git-fu is strong)

git checkout 3bd1c2e9bff539c94f92f1ec919f8f0f1640f8c0
.. test ..
git checkout master
.. back to normal ..

Regards,
 Max




[O] BUG: Agenda clock related v for multi-block agendas

2012-04-17 Thread Max Mikhanosha
At Tue, 17 Apr 2012 17:58:27 +0200,
Rainer Stengele wrote:

 What I just found:
 
 being in a sticky agenda and trying v r I get this error which was not 
 there before the merge:
 org-agenda-check-type: Not allowed in nil-type agenda buffers.
 Actually v c directly before entering v r gave results!

Investigating this showed it's not related to sticky agendas, but
uncovered the following bug. Clock related sub-functions of the v
key, have a check that they could only be done in the time related
agenda buffers, as opposite to the ones generated by C-c a t

For multi-block agendas, that include a an agenda block followed by
several todo blocks, you can only invoke v c or v r when point
is in the daily agenda block area, instead of tags or todo block area.

Interestingly enough the block separator line (the ) has
agenda type text property of nil, so you only get the type nil
message when you do v r or v c with point on the separator line.

Regards,
  Max



[O] Sticky agenda branch merged

2012-04-16 Thread Max Mikhanosha
I had just pushed a merge of max-sticky-agenda branch to master, let
me know if there are any problems, also feel free to hack/iterate on
it, if you have question as to why something was done, I'll do my best
to answer.

In particular I just seen a new commit introducing filter on
categories, and org-agenda-filtered-by-top-category probably needs to
be included into local variable list to have it work per agenda
buffer.

Also the individual calls to org-todo-list and such, do not work right
with sticky agenda as there is nothing to catch the 'exit tag, that is
thrown by `org-prepare-agenda' when it finds cached buffer. I'm not
sure there is more elegant way of fixing it, other then wrapping all
the individual scanner pieces with (catch) blocks, that re-throw if
they had detected that they been called from (org-agenda) command

Regards,
  Max



Re: [O] Sticky agenda branch merged

2012-04-16 Thread Max Mikhanosha
At Mon, 16 Apr 2012 19:44:54 +0200,
Tassilo Horn wrote:
 
  I had just pushed a merge of max-sticky-agenda branch to master, let
  me know if there are any problems,...
 
 since the merge, I get an error on emacs startup.  The error is caused
 by invoking `org-agenda-to-appt' on emacs startup.
 
 Here's a backtrace:
 
 --8---cut here---start-8---
 Debugger entered--Lisp error: (wrong-type-argument stringp nil)
   org-agenda-new-marker(9228)
   byte-code(\306 ... VBV)\311\207 [s txt pos save-match-data-internal 
 todo-state org-agenda-repeating-timestamp-show-all org-agenda-skip 
 match-string 1 nil match-data ((byte-code \301\302\\207 
 [save-match-data-internal set-match-data evaporate] 3)) org-get-todo-state t 
 org-time-string-to-absolute past 0 abs functionp org-is-habit-p 
 org-get-category get-text-property org-category-position re-search-backward 
 ^\\*+[]+ throw :skip assoc org-get-tags-at 
 buffer-substring-no-properties ^\n string-match  
 \\([012]?[0-9]:[0-9][0-9]\\)   time org-agenda-format-item format 
 org-scheduled-previously org-scheduled-today org-scheduled 
 org-habit-parse-todo org-add-props undone-face face org-agenda-done 
 org-marker org-agenda-new-marker org-hd-marker type past-scheduled ...] 26)
   org-agenda-get-scheduled(nil)

I had pushed a fix, which should fix `org-agenda-to-appt'

Regards,
  Max



Re: [O] Sticky agenda status?

2012-04-13 Thread Max Mikhanosha
At Fri, 13 Apr 2012 06:54:30 +0200,
Bastien wrote:

 Max, Carsten, please go ahead with the merge against master when you
 think it's time: from what I've tested, the feature is stable/mature
 enough.

I'll update it to master later today, and use it a over the weekend to
see if anything broke, then will commit to master Monday

Regards,
  Max



Re: [O] Sticky agenda status?

2012-04-13 Thread Max Mikhanosha
At Fri, 13 Apr 2012 08:59:37 +0800,
Kyle Machulis wrote:
 
 Just curious if the sticky agenda branch is going to land as a feature
 at some point, or if there was some discussion on what's blocking it
 that I'm missing? There was lots of action last month then silence,
 and it looks like the branch has bitrotted against the trunk now. Was
 kinda looking forward to it as a feature. :)
 

I had merged origin/master into max-sticky-agenda, can you try it out
so that there is more then one person running it? If everything looks
good I'll push it to master on Monday.

So far I had one problem with babel, which appears unrelated to sticky
changes, as org-babel-header-arg-expand seems to be made it into
default value of org-tab-first-hook, and right that function throws
some weird error inside of it.

I simply added

(remove-hook 'org-tab-first-hook 'org-babel-header-arg-expand)

to my org mode initialization.

Regards,
  Max






Re: [O] speeding up org (was How could I mix COMMENT and TODO?)

2012-04-06 Thread Max Mikhanosha
At Fri, 6 Apr 2012 18:40:43 +0530,
Rustom Mody wrote:
 
 François wrote:
  
 
 In my very first tries with Org, a few months ago, I put all Org files
 into the agenda, to discover that Org was very, very slow.  So, I
 changed it all and collected all agenda and TODO into three files only,
 holding lots of links to all other Org files where the information
 really was.  Org recovered all its speed.  And besides, to repair the
 lost search capabilities, I kludged M-x rgrep so it could search all Org
 files and reveal contents when visiting hits.  Well, the reveal does
 not always work, but yet, the quicker search is constantly useful to me.

 Currently, having put TODOs back in their proper Org files and declaring
 them as agenda files, 38 agenda files are taken out from 360 Org files.
 Even if slightly less speedy than 3 agenda files, this is still very
 bearable: Org does not crawl.  The way Org handles org-agenda-files as
 a string naming a file is really convenient to me, it eases the writing
 of external programs acting on them all.  All in all, very satisfactory!
 
 Hi François,
 
 I made the suggestion that ragel should/could be part of emacs:
 http://lists.gnu.org/archive/html/emacs-orgmode/2012-03/msg00864.html
 
 Summarised by saying that if ragel is integrated into elisp, org code could 
 become both significantly faster and more readable.
 
 That most sluggish elisp code may be so due to regular expression code, is 
 discussed here:
 http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg01202.html
 
 [In all fairness this is all a bit OT for an org list and should really be on 
 an emacs devel list]

Experiencing slow generation of agenda, was the reason for writing
sticky agendas branch. It takes more of a fix the symptom approach,
instead speeding up agenda generation, it caches the agenda buffer
itself and lets user refresh it, while also allowing for multiple
agenda buffers, so that a C-c a / search buffer, does not discard your
C-c a a one.

My initial idea was to wrap all the scanner functions (like
org-todo-list or org-tags-view), with caches, but after a day or so it
was obvious that its not a a few days task.

But if someone takes up task of speeding up agenda generation, IMHO
the idea of re-factoring the scanning functions to avoid re-scanning
.org files that had not changed, will have best chance of producing
results.

Regards,
  Max







Re: [O] [Sticky Agenda] How to create Agenda Buffers in functions

2012-04-03 Thread Max Mikhanosha
At 3 Apr 2012 19:10:30 +0200,
Sven Bretfeld wrote:
 
 Hi all
 
 The Sticky Agenda is something I have been waiting for since a long
 time. Thank you very much!
 
 I want to write a function that creates a new frame with several
 windows, each displaying a different Agenda Views. I fail to find a
 function that creates special agenda views. Formerly I used
 org-batch-agenda for similar purposes. But that doesn't work in the
 sticky branch. This is what I have:
 
 (defun my-gtd-frame ()
   (interactive)
   (save-excursion)
   (make-frame '(
  (name  . gtd)
  (active-alpha  . 0.75)
  (inactive-alpha. 0.8)
  (top   . 110) 
  (left  . 2000) 
  (width . 80) 
  (height. 40)
  (font . -Adobe-Courier-Medium-R-Normal--18-180-75-75-M-110-ISO8859-1)))
   (select-frame-by-name gtd)
   (toggle-fullscreen)
   (org-agenda-goto-today)
   (delete-other-windows)
   (split-window-horizontally)
   (other-window 1)
   (org-batch-agenda OFFICE/NEXT)
 )
 

This is the same bug as Martyn Jago reported earlier, basically I
forgot that separate org agenda commands can be run individually
rather then through (org-agenda) function.

A temporary workaround in your specific case would be to wrap
(org-batch-agenda) call like this:

(catch 'exit
  (org-batch-agenda OFFICE/NEXT))

I tested it and it seems to work.. The actual fix for the bug will be
similar and will be wrapping bodies of (org-todo-list) (org-tags-list)
and friends with (catch 'exit), but it needs to be done conditionally
as to only do it its called individually and not from (org-agenda)




Re: [O] Sticky Agenda buffer: Announcement and request for testing

2012-03-14 Thread Max Mikhanosha
At Wed, 14 Mar 2012 16:54:17 +0100,
Rainer Stengele wrote:
 
 I have a few functions based on the org-agenda-buffer-name, which now is no 
 more available,
 as all the agenda buffers are named differently:
 
 ..
   (if (get-buffer org-agenda-buffer-name)
 ..
 will no more work.

If you don't turn sticky on, then the name of the agenda will stay the
same as before, it only generates unique names if sticky is enabled.


 I hope that the current agenda buffer names pattern will stay as it is.
 I will have to hardcode the changed buffer names.

The method of generating default sticky agenda buffer names by adding
keys used to invoke it will not change.

You can also override it by using `org-agenda-custom-commands', if you
specify `org-agenda-buffer-name' as one of the variables being
overridden for a specific command, that name will take precedence over
the automatic method.

Regards,
  Max



[O] Rebased to the latest tip

2012-02-29 Thread Max Mikhanosha
At Tue, 28 Feb 2012 10:57:11 -0600,
Marcelo de Moraes Serpa wrote:
 
 Anyway, I can't emphasize enough how useful this feature is. Having
 different agenda filtered views at the same time is a
 timesaver. This should be in the main org branch! 


Thanks for the kind words, I think you are the only person who
seriously tried it.

As for merging its up to the maintainers. If there are any objections
or code needs to be cleaned up or such, I have not heard anything.

Anyway I had re-based multiple-agenda-buffers branch to the latest
origin/master, and it seems to have went smoothly, and pushed to
https://github.com/7max/org-mode

Regards,
  Max




Re: [O] Frames and the agenda

2012-02-28 Thread Max Mikhanosha
At Mon, 27 Feb 2012 18:52:09 -0600,
Marcelo de Moraes Serpa wrote:

 Although everything else is working great, I'm getting the following
 error message when trying to follow links to org files:
 
 cond: Symbol's function definition is void: org-in-clocktable-p [11 times]

My branch is probably a few weeks behind the master, so the fix that
Nick mentioned above is not there.

You can temporarily fix this by doing M-x load-library RET
org-clock. 

I'll rebase my branch to the latest origin/master soon, with the pace
of development in org-mode its hard to be completely synced up all the
time.

Regards,
  Max



Re: [O] Frames and the agenda

2012-02-24 Thread Max Mikhanosha
Check out my multiple-agenda-buffers branch from http://github.com/7max/org-mode

Its designed exactly for that (multiple independent agenda buffers
living together). to enable it use, M-x org-toggle-sticky-agenda

You will have to set different agenda names for different agenda views
in your org-agenda-custom-commands variable like so:

 (setq org-agenda-custom-commands
   '((a Agenda and NEXT (priority)
  ((agenda 
   ((org-agenda-span 'day)))
   (tags-todo /!NEXT
  ((org-agenda-overriding-header Next Tasks)
   (org-agenda-tags-todo-honor-ignore-options t)
   (org-agenda-todo-ignore-scheduled t)
   (org-agenda-todo-ignore-deadlines t)
   (org-tags-match-list-sublevels t)
   (org-agenda-sorting-strategy
'(priority-down category-keep)
  ((org-agenda-buffer-name *Agenda*)))
 (t TODO entries
  todo 
  ((org-agenda-buffer-name *Todo List*)

Carsten suggested that this will eventually get merged, but I think
people may be afraid, as it's a bit of a major change, converting most
agenda related variables to buffer local, and at least initially had a
several bugs, which took me a few weeks to catch and fix.

But I've been running on this branch for a month+, and quality of
my org-moding had greatly improved, since now all my agendas pop-out
immediately instead of rebuilding for several seconds.

At Fri, 24 Feb 2012 12:38:39 -0600,
Marcelo de Moraes Serpa wrote:
 
 Hey guys,
 
 So, I would like to keep a sort of dashboard in a osx virtual desktop - 
 basically having emacs frames with different todo lists
 for reference at quick glance:
 
 http://minus.com/mlgjv21R4
 
 The problem is that the agenda is global to the emacs instance and won't 
 allow me to show a filter view in one frame and another
 in the other (i.e: One frame showing all my personal TODOs and the other 
 showing all TODOs related to my job.). 
 
 I could have those lists in separate files, but my configuration now has all 
 todos in a big gtd.org file.
 
 Is there a way to have differente filters in different frames? If not, any 
 thoughts on how I could accomplish this idea?
 
 Thanks,
 
 Marcelo.
 
 



[O] Multiple/sticky agenda buffers branch updated

2012-02-09 Thread Max Mikhanosha
In case anyone is trying out g...@github.com:7max/org-mode.git sticky
agendas functionality, I pushed some bug fixes.

M-x org-toggle-sticky-agenda now works correctly when its turned on
when agenda buffer already exists.

When refreshing agenda buffers, prefix format was being pickup up from
the last time non-sticky agenda was generated, instead of the agenda
that is being refreshed.



Re: [O] Some struggles of mine with org-mode

2012-02-08 Thread Max Mikhanosha
At Tue, 07 Feb 2012 14:16:02 -0800,
lngn...@gmail.com wrote:
 
 So, to summarize,  org-agenda-files should reflect those files I
 need to access because they have TODOs, Deadlines, Happenings, or
 Reminders in them.  My search Universe should be constrained
 enough to result in instant searches, but not so constrained as
 org-agenda-files that need to be processed to produce a daily
 agenda.   

Are you using `org-agenda-custom-commands' variable? You can specify
different sets of agenda files for different commands.

There is an `org-agenda-text-search-extra-files' variable, which when
bound, adds to the existing agenda files, and has a special value
'agenda-archives, which means all the .org_archive files with same
name as agenda files.

So assuming you have your regular org-agenda-files set to your
minimum universe, you can define extra searches like so:

(setq org-agenda-custom-commands
  '((/ Occur with archives
 ((search 
  ((org-agenda-text-search-extra-files '(agenda-archives))
(k Occur with archives + knowledge base
 ((search 
  ((org-agenda-files (cons ~/kb/ org-agenda-files))
   (org-agenda-text-search-extra-files '(agenda-archives))
  ))

This will make C-c a / search your normal agenda files, plus their
archives, and C-c a k will in addition search all org files and their
archives in ~/kb/ directory.




Re: [O] Multiple agenda buffers at g...@github.com:7max/org-mode.git

2012-01-26 Thread Max Mikhanosha
I realize that I may have too many, my initial approach was to start
with some obvious one, then test and keep adding to the list.

But the bugs that shows up are hard to reproduce, and subtle, and it
was slow going, and I was sure I'm missing some.

So I went the other direction, and made a list of vars by grepping
org-agenda.el for (defvar , and tested again, and it was easier
to eliminate the variables from the list, since any variables that
caused problems usually throw error (due to global value being NIL),
instead of doing something subtly wrong that is hard to notice.

At Thu, 26 Jan 2012 09:50:22 +, Carsten Dominik wrote:
 
 Hi Max,
 
 how did you select the variables that should become buffer-local?
 You might have too many in your list, for example org-last-heading-marker...
 
 Cheers
 
 - Carsten
 
 On 25.1.2012, at 21:45, Max Mikhanosha wrote:
 
  I had put my initial implementation of multiple agenda buffers and
  sticky agenda support on g...@github.com:7max/org-mode.git branch
  multiple-agenda-buffers.
  
  To enable, use M-x org-toggle-sticky-agenda
  
  In order to take full advantage of the sticky agenda, you need to give
  your various agendas different buffer names, you can do it by
  including `org-agenda-buffer-name' into the list of bound variables in
  `org-agenda-custom-commands'
  
  For example:
  
  (setq org-agenda-custom-commands
   '((a Agenda and NEXT (priority)
  ((agenda 
   ((org-agenda-span 'day)))
   (tags-todo /!NEXT
  ((org-agenda-overriding-header Next Tasks)
   (org-agenda-tags-todo-honor-ignore-options t)
   (org-agenda-todo-ignore-scheduled t)
   (org-agenda-todo-ignore-deadlines t)
   (org-tags-match-list-sublevels t)
   (org-agenda-sorting-strategy
'(priority-down category-keep)
  ((org-agenda-buffer-name *Agenda*)))
 (t TODO entries
  todo 
  ((org-agenda-buffer-name *Todo List*)
  
  
  When sticky agenda is enabled, most of org-agenda Emacs variables
  become buffer local, and org-agenda-quit is changed to bury the buffer
  instead of killing it. Correspondingly org-agenda will show previously
  buried buffer if it exists, instead of re-generating it.
  
  This allows user to have many mini-agendas and switch between them
  rapidly
  
  I would appreciate any bug-reports about things not working, and of
  course patches or fixes for them. The most likely cause of any
  breakage is that `org-agenda-local-vars' list needs adjusting and/or
  fixing.
  
  Regards
   Max
 



Re: [O] Multiple agenda buffers at g...@github.com:7max/org-mode.git

2012-01-26 Thread Max Mikhanosha
I had committed a change that activates local variables, only if
org-agenda-sticky is turned on, hopefully making it completely safe to
test for people..

Now if something is screwed up, and you are in a hurry, you can turn
sticky agenda off and get on with normal org-mode usage, and then send
bug report later.

At Thu, 26 Jan 2012 06:17:45 -0500,
Max Mikhanosha wrote:
 
 I realize that I may have too many, my initial approach was to start
 with some obvious one, then test and keep adding to the list.
 
 But the bugs that shows up are hard to reproduce, and subtle, and it
 was slow going, and I was sure I'm missing some.
 
 So I went the other direction, and made a list of vars by grepping
 org-agenda.el for (defvar , and tested again, and it was easier
 to eliminate the variables from the list, since any variables that
 caused problems usually throw error (due to global value being NIL),
 instead of doing something subtly wrong that is hard to notice.
 
 At Thu, 26 Jan 2012 09:50:22 +, Carsten Dominik wrote:
  
  Hi Max,
  
  how did you select the variables that should become buffer-local?
  You might have too many in your list, for example org-last-heading-marker...
  
  Cheers
  
  - Carsten
  
  On 25.1.2012, at 21:45, Max Mikhanosha wrote:
  
   I had put my initial implementation of multiple agenda buffers and
   sticky agenda support on g...@github.com:7max/org-mode.git branch
   multiple-agenda-buffers.
   
   To enable, use M-x org-toggle-sticky-agenda
   
   In order to take full advantage of the sticky agenda, you need to give
   your various agendas different buffer names, you can do it by
   including `org-agenda-buffer-name' into the list of bound variables in
   `org-agenda-custom-commands'
   
   For example:
   
   (setq org-agenda-custom-commands
'((a Agenda and NEXT (priority)
   ((agenda 
((org-agenda-span 'day)))
(tags-todo /!NEXT
   ((org-agenda-overriding-header Next Tasks)
(org-agenda-tags-todo-honor-ignore-options t)
(org-agenda-todo-ignore-scheduled t)
(org-agenda-todo-ignore-deadlines t)
(org-tags-match-list-sublevels t)
(org-agenda-sorting-strategy
 '(priority-down category-keep)
   ((org-agenda-buffer-name *Agenda*)))
  (t TODO entries
   todo 
   ((org-agenda-buffer-name *Todo List*)
   
   
   When sticky agenda is enabled, most of org-agenda Emacs variables
   become buffer local, and org-agenda-quit is changed to bury the buffer
   instead of killing it. Correspondingly org-agenda will show previously
   buried buffer if it exists, instead of re-generating it.
   
   This allows user to have many mini-agendas and switch between them
   rapidly
   
   I would appreciate any bug-reports about things not working, and of
   course patches or fixes for them. The most likely cause of any
   breakage is that `org-agenda-local-vars' list needs adjusting and/or
   fixing.
   
   Regards
Max
  
 



Re: [O] Multiple agenda buffers at g...@github.com:7max/org-mode.git

2012-01-26 Thread Max Mikhanosha
At Thu, 26 Jan 2012 06:39:45 -0500,

Found that switching to weekly/daily view was broken, and committed
removal of org-agenda-overriding-restriction and
org-agenda-overriding-arguments from the local var list.
 
Max Mikhanosha wrote:
 
 I had committed a change that activates local variables, only if
 org-agenda-sticky is turned on, hopefully making it completely safe to
 test for people..
 
 Now if something is screwed up, and you are in a hurry, you can turn
 sticky agenda off and get on with normal org-mode usage, and then send
 bug report later.
 
 At Thu, 26 Jan 2012 06:17:45 -0500,
 Max Mikhanosha wrote:
  
  I realize that I may have too many, my initial approach was to start
  with some obvious one, then test and keep adding to the list.
  
  But the bugs that shows up are hard to reproduce, and subtle, and it
  was slow going, and I was sure I'm missing some.
  
  So I went the other direction, and made a list of vars by grepping
  org-agenda.el for (defvar , and tested again, and it was easier
  to eliminate the variables from the list, since any variables that
  caused problems usually throw error (due to global value being NIL),
  instead of doing something subtly wrong that is hard to notice.
  
  At Thu, 26 Jan 2012 09:50:22 +, Carsten Dominik wrote:
   
   Hi Max,
   
   how did you select the variables that should become buffer-local?
   You might have too many in your list, for example 
   org-last-heading-marker...
   
   Cheers
   
   - Carsten
   
   On 25.1.2012, at 21:45, Max Mikhanosha wrote:
   
I had put my initial implementation of multiple agenda buffers and
sticky agenda support on g...@github.com:7max/org-mode.git branch
multiple-agenda-buffers.

To enable, use M-x org-toggle-sticky-agenda

In order to take full advantage of the sticky agenda, you need to give
your various agendas different buffer names, you can do it by
including `org-agenda-buffer-name' into the list of bound variables in
`org-agenda-custom-commands'

For example:

(setq org-agenda-custom-commands
 '((a Agenda and NEXT (priority)
((agenda 
 ((org-agenda-span 'day)))
 (tags-todo /!NEXT
((org-agenda-overriding-header Next Tasks)
 (org-agenda-tags-todo-honor-ignore-options t)
 (org-agenda-todo-ignore-scheduled t)
 (org-agenda-todo-ignore-deadlines t)
 (org-tags-match-list-sublevels t)
 (org-agenda-sorting-strategy
  '(priority-down category-keep)
((org-agenda-buffer-name *Agenda*)))
   (t TODO entries
todo 
((org-agenda-buffer-name *Todo List*)


When sticky agenda is enabled, most of org-agenda Emacs variables
become buffer local, and org-agenda-quit is changed to bury the buffer
instead of killing it. Correspondingly org-agenda will show previously
buried buffer if it exists, instead of re-generating it.

This allows user to have many mini-agendas and switch between them
rapidly

I would appreciate any bug-reports about things not working, and of
course patches or fixes for them. The most likely cause of any
breakage is that `org-agenda-local-vars' list needs adjusting and/or
fixing.

Regards
 Max
   
  
 



[O] Multiple agenda buffers at g...@github.com:7max/org-mode.git

2012-01-25 Thread Max Mikhanosha
I had put my initial implementation of multiple agenda buffers and
sticky agenda support on g...@github.com:7max/org-mode.git branch
multiple-agenda-buffers.

To enable, use M-x org-toggle-sticky-agenda

In order to take full advantage of the sticky agenda, you need to give
your various agendas different buffer names, you can do it by
including `org-agenda-buffer-name' into the list of bound variables in
`org-agenda-custom-commands'

For example:

(setq org-agenda-custom-commands
  '((a Agenda and NEXT (priority)
 ((agenda 
  ((org-agenda-span 'day)))
  (tags-todo /!NEXT
 ((org-agenda-overriding-header Next Tasks)
  (org-agenda-tags-todo-honor-ignore-options t)
  (org-agenda-todo-ignore-scheduled t)
  (org-agenda-todo-ignore-deadlines t)
  (org-tags-match-list-sublevels t)
  (org-agenda-sorting-strategy
   '(priority-down category-keep)
 ((org-agenda-buffer-name *Agenda*)))
(t TODO entries
 todo 
 ((org-agenda-buffer-name *Todo List*)


When sticky agenda is enabled, most of org-agenda Emacs variables
become buffer local, and org-agenda-quit is changed to bury the buffer
instead of killing it. Correspondingly org-agenda will show previously
buried buffer if it exists, instead of re-generating it.

This allows user to have many mini-agendas and switch between them
rapidly

I would appreciate any bug-reports about things not working, and of
course patches or fixes for them. The most likely cause of any
breakage is that `org-agenda-local-vars' list needs adjusting and/or
fixing.

Regards
  Max



Re: [O] Organizing by time or by subject and an idea

2012-01-21 Thread Max Mikhanosha
At Sat, 21 Jan 2012 07:59:38 -0500,
Max Mikhanosha wrote:

 If you do this copy the project thing once a week or so, you can
 have a nice ediff of the project's progress along the time-line.
 
 Actually it may not be a bad idea to implement M-x
 org-ediff-subtree-with-sibling command, that would do that
 automatically, and would include the ediff hooks to do fold/reveal of
 regions

Expanding on that thought, if one were to write a contrib module to do
this type of stuff, maybe each time you want to make revision of a
project, you make a copy of it, and archive the old one. This way all
searches only find the most recent stuff. And then have M-x
org-ediff-subtree-with-archive command, which accepts numeric argument
being the N'th copy of the archived tree?



Re: [O] reveal the matches in grep-find or the diffs in ediff and hide the rest

2012-01-21 Thread Max Mikhanosha
At Sat, 21 Jan 2012 16:24:12 +0100,
Michael Brand wrote:
 
 Hi all
 
 On Sat, Jan 21, 2012 at 13:59, Max Mikhanosha m...@openchat.com wrote:
  Then use M-x ediff-buffers, and you can navigate changes easily by
  pressing n or p in ediff control panel. I just tried it out and it
  worked pretty good. Only thing that could have worked better, is to
  hook-up ediff with org-reveal or reveal-mode, so that it automatically
  folds all unchanged stuff, and only reveals text in the highlighted
  regions.
 
 hook-up org-reveal when using grep-find or pressing n or p in ediff
 control panel sounds like what I have been looking for for a long
 time.
 
 Is this documented? I couldn't find it in the Org manual, Emacs
 manual, Worg or EmacsWiki. Just enabling reveal-mode before
 ediff-buffers alone doesn't seem to do the trick. At least for

No enabling reveal-mode did not worked for me either, that's why i
wrote the only thing that could have worked better.

reveal-mode actually works, if you C-x o from the Ediff control panel
buffer to one of the source buffers and then back again. So it
probably has a check inside of it, that only reveals if buffer is the
active one.

Should be possible to do some magics with defadvice to make it happen
regardless if buffer is current or not, if buffer is part of Ediff
session or some other special condition.



Re: [O] Hack: org-agenda-cache.el

2012-01-16 Thread Max Mikhanosha
Hi Carsten,

At Mon, 16 Jan 2012 16:40:01 +0100,
Carsten Dominik wrote:
 On 16.1.2012, at 13:18, Carsten Dominik wrote:
 
 Sorry, I am talking about `org-agenda-markers', and indeed, some
 care has to be taken here.  Basically, the function
 org-agenda-new-marker needs to be modified to take a buffer as an
 argument, and then to push the new marker on the list of markers in
 that buffer.  Also, org-agenda-save-markers-in-region needs to be
 modified.
 
 OK, this is a bit complicated, I am willing to help.  If you make a
 new patch that implements the multibuffer stuff in org-agenda, I
 will look at the marker issues and implement them.

Cool, I'll redo it and submit a patch in the next few days. The plan
is:

  - Multi-buffer support (ie buffer-local vars) goes in
unconditionally, since I think there is no way to undo making
variable buffer local, and if there is, it would make toggling on/off
function really complicated.

About the markers, what about if I call to clean them up
kill-buffer-hook? This will work even if user kills the buffer
manually, not just on q key.

  - The use existing buffer, and bury on quit toggle needs a new
name org-agenda-reuse-buffers? Wanderlust has a similar mechanism
and its called sticky summary buffers, so maybe
org-agenda-buffer-sticky?

  - The C-u r that you suggested to kill all buffers is already taken
by reload with a
search string, so I think for cleanup bindings could be:

q  - kill buffer or bury if enabled
Q  - always kill
C-u Q  - kill all agenda buffers (ie cleanup)

Now that I'm thinking it also needs to keep track of all agenda
buffers, so need a global list. The kill-buffer hook should work
there too.

Regards,
  Max




[O] Hack: org-agenda-cache.el

2012-01-15 Thread Max Mikhanosha
As my agenda files slowly grew over the years, the speed of generating
agenda had slowly deteriorated, finally hitting the point of me jdoing
something about it. (it got to around 5-7 seconds, which kind of
interrupts work-flow)

Attached file org-agenda-cache.el is a quick fix solution that I
developed for myself, its more of a request for discussion and not
intended as contribution yet.

Basic idea is:

1. Multiple-agenda buffers can exist at the same time, having separate
tag filters and other such settings. This is accomplished by bunch of
org-agenda-* variables being made buffer-local.

2. Custom agenda commands should bind `org-agenda-buffer-name' variable,
so that for example C-c a generates *Agenda* buffer and C-c t
generates *Todo List* buffer. 

3. org-agenda checks if buffer with `org-agenda-buffer-name' exists
and if it does, it will show that buffer, rather then re-generating
it. To generate a fresh agenda, becomes C-c a r instead of C-c a

4. org-agenda-quit buries the agenda buffer instead of killing it.

5. All of the above shenanigans can be switched on and off by doing
M-x toggle-org-agenda-caching command, its off by default so you have
to turn it on after loading the file.

I had been using this setup for last few days, and it had really been
a blast, returning me to the times when I just started with org-mode,
and information had appeared in milliseconds rather then seconds.



org-agenda-cache.el
Description: Binary data



Re: [O] Overall organization/setup for org mode: Projects and Tasks

2011-09-17 Thread Max Mikhanosha
Below is infodump on how I use org-mode personally.. You are welcome
to poach ideas. Generally I'm pretty happy with my setup, and do not
plan to do any radical changes to it. Wall of text warning.

1. Org file per project, with single top level heading.. Each file has
   a #+TAGS cookie that assigns default tags.

   Such project files would have more then one level heading, usually
   when project logically splits into sub-projects

   Example: Emacs.org, top level headings. This one has unusually large
   amount of top level headings.
   
   - Emacs 
   - Org-Mode
   - Paredit-Magic
   - C-Paredit
   - Cycle-buffer

A few special org files which are not projects, one is called Assorted
Accounts for recording acc/pass/email info on various accounts, and
one is called Assorted Info for basically a knowledge base of anything
that is not a TODO. The way I access these are through C-c / search,
seems to work very well.. Another special project is Finances.org
and has everything to do with investments, encrypted entries for all
financial accounts, all recurring TODOS for bills, or portfolio
review, investment ideas, spreadsheets etc.
   
Capture often. Write down just enough so you can re-construct idea
later.. If you often wondering wtf did I meant by that, then you are
not writing down enough.. If possible write/assign yourself a shortcut
key to your window manager so you can capture a short sentence with 1
key stroke even when in the other programs.

If it takes less then 1 minute to do what you are capturing,
especially if it involves emacs customization, do it right there, and
mark it it done, or C-c C-k it.. I usually mark it done and C-c C-c
it.

All captures go to Mind-Sweep.org, under top level heading.. Every few
days (once I have 10-20 items) in there, I go ahead and refile them to
appropriate projects, assigning priorities and efforts if these are
not there.

Have two agenda keys to show agenda sorted by priority, and by effort
up..I use block agenda that shows day agenda first, then all NEXT
items, then all TODO items.

Learn to use / key in agenda to quickly filter out stuff by tags.. For
me /e switches agenda to filter out be :emacs tag.

Have areas of focus. The mind is like a process working set. If I had
been working on some emacs problem and have Emacs booted up in my
brain, it takes a while to switch reboot my brain into Looking at my
investments mode.

So as long as I'm working on lets say fixing something with paredit,
you can just as well knock out some other emacs things..

That is where agenda sorted by effort comes up. Since I'm hacking on
my emacs setup anyway, I bring up my effort-up agenda view, filter by
emacs and just knock out every item estimated at 10 minutes or
less. Sometimes knocking out up to 20 or so small TODO's in 2 hour
burst, taking care of everything that was annoying me with Emacs in
last 2 weeks.

Assign priorities to prune aggressively. If you have that #A item
starting you for last 5 days, its not #A.. Demote it until it sits in
the #F pile way down in agenda.

Temporary move projects out of agenda. Lets say you have a well
defined project and a bunch of nicely prioritized items, some of them
#A (which they are in the context of that project) but right now you
just don't feel like working on that project.

Starting at these #A items on top of your agenda every day without
starting to work on them, may be demoralizing. Way I deal with it, is
that I have hold tag, which I put on top level headings of the
projects, and its excluded from my agenda by default... If you have
not touched a project for 2 weeks, it probably should be on
hold.. When you bored and looking for things to work on, they you can
use agenda view without filtering out the hold projects, and see if
you can get a start on some of them.. This way I have only 3-4 projects
that are in focus rather then 30.. 

Review low priority items once a week, if you remember reviewing that
item last few weeks, just delete it.. If you are type of person who
can't let go, move it to MAYBE state.

If something computer related annoys you and interrupts your work flow
often, it should be #A item and needs to be fixed. Ie if you Emacs
session consists of 50% beeps, you need to fix something in your
setup.. If you dread doing something because its just too much effort,
you need to automate/rethink/change that process.

Don't burn out.. The bodybuilders and athletes have it right, you have
to cycle. If you go 100% all the time, generating ideas and knocking
out TODO's like a robot, you'll burn out. Take it easy for 1 week each
month. Does not mean eat pizza and party every day, but basically its
relax and don't kill yourself time.

Do any health, work, and lifestyle related TODO's first over any
computer related ones. Get that physical. Update/re-balance those
investments Deposit them checks and pay them bills. Switch to online bill
payment for everything, and synchronize your bill cycle dates, so that
you can pay all 

Re: [O] how to include effort in agenda prefix?

2011-08-17 Thread Max Mikhanosha
Use %e format for effort. If it gives you an error you need newer
org-mode, as the patch to fix %e format only got applied recently.

At Wed, 17 Aug 2011 15:14:12 -0700,
Michael Gilbert wrote:
 
 Hi all �� 
 I want to be able to skim across my agenda and see effort estimates. I have 
 been looking at the variable org-agenda-prefix-format and wondering if use of 
 the expression evaluation option in there is the way to do it. However, while 
 I have configured this prefix to suit me in other ways, writing a suitable 
 expression to include the effort of the item is beyond my current skills. Any 
 advice?
 
 TIA!
 
 — Michael
 
 
 



[O] [PATCH] recognize HH:MM duration when sorting table rows

2011-08-04 Thread Max Mikhanosha
`org-table-sort-lines' function allows one to sort the rows of a
table, by the t/T format for the column only recognizes timestamps
with a date. A patch pasted below adds recognition of HH:MM durations.

diff --git a/lisp/org.el b/lisp/org.el
index c1fd346..e65d992 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8042,11 +8042,14 @@ If WITH-CASE is non-nil, the sorting will be 
case-sensitive.
  ((= dcst ?t)
   (setq extractfun
(lambda (x)
- (if (or (string-match org-ts-regexp x)
- (string-match org-ts-regexp-both x))
- (org-float-time
-  (org-time-string-to-time (match-string 0 x)))
-   0))
+ (cond ((or (string-match org-ts-regexp x)
+(string-match org-ts-regexp-both x))
+(org-float-time
+ (org-time-string-to-time (match-string 0 x
+   ;; possibly bolded hh:mm duration
+   ((string-match ^\\*?\\([0-9]+:[0-5][0-9]\\)\\*?$ x)
+ (org-duration-string-to-minutes (match-string 1 x)))
+   (t 0)))
comparefun (if (= dcst sorting-type) ' ')))
  (t (error Invalid sorting type `%c' sorting-type)))
 




[O] [PATCH] Add :sort option to clocktable report

2011-08-04 Thread Max Mikhanosha
Attached patch adds new options :sort to the clocktable report
options. Valid values:

time-up or T - highest time on top
time-down- lowest time on top

For multi-file clock reports, entries in each file are sorted
separately and then the files are also sorted based on file total.

Perhaps this should be made a default? It seems clocktable report is
something that user would naturally expect to be sorted.



0016-Add-sort-option-to-clocktable-report.patch
Description: Binary data


Re: [O] [PATCH] New org-depend trigger for finding next highest priority/effort item

2011-07-27 Thread Max Mikhanosha
At Wed, 27 Jul 2011 13:33:16 +0200,
Bastien wrote:
 
 Also, it would be really nice to update this tutorial on Worg and to
 show how to use the new feature you introduced:
 
   http://orgmode.org/worg/org-contrib/org-depend.html
 

Done, will push once I have permissions



Re: [O] [PATCH] New org-depend trigger for finding next highest priority/effort item

2011-07-26 Thread Max Mikhanosha
At Tue, 26 Jul 2011 13:48:30 +0200,
Bastien wrote:
 
  +;;  list and then filtered and sorted according to OPTIONS
  +;;- The first sibling on the list is changed into KEYWORD state
  +;;- The sibling also gets the same TRIGGER property
  +;;  chain-siblings-scheduled, so the chain can continue.
 
 This should rather be chain-find-next here, right?

Yes thats a typo, I was trying to select a more appropriate name for it.

  +;;OPTIONS should be a comma separated string without spaces, and
  +;;can contain following options:
  +;;
  +;;- from-top  the candidate list is all of the siblings in
  +;;the current subtree
  +;;
  +;;- from-bottom   candidate list are all siblings from bottom up
  +;;
  +;;- from-current  candidate list are all siblings from current item
  +;;until end of subtree, then wrapped around from
  +;;first sibling
  +;;
  +;;- no-wrap   candidate list are siblings from current one down
 
 I'm not sure to understand the difference between from-top and
 from-current, and between from-top and no-wrap. 
 
 Can you give an example?

* Parent
** TODO Item 1
** TODO Item 2
** TODO Item 3
** TODO Item 4
** NEXT Item 5 Current  (the one with TRIGGER property)
** TODO Item 6
** Item 7
** TODO Item 8
** DONE Item 9

Below are example list of candidates depending on option

from-top  = 1,2,3,4,6,7,8
from-bottom   = 8,7,6,4,3,2,1
from-current  = 6,7,8,1,2,3,4
from-current,no-wrap  = 6,7,8

Adding todo-only will eliminate item 7 from all of above, adding
include-done will include item 9.

After inital candidate list is established as above, its sorted by priority
or effort, then 1st item is made NEXT.

  +;;
  +;;- include-done  include siblings with TODO in `org-done-keywords',
  +;;they are excluded by default
 
 The phrasing is a bit confusing to me -- perhaps removing they are
 excluded by default is enough.

Agree, maybe whole option can be eliminated, I had an opposite option
initially (skip-done), to have default compatible with original
trigger, but decided that skipping done may be a better default.

  +;;- todo-only Only consider siblings that have TODO only, by 
  default
  +;;siblings without TODO keyword are considered too
 
 I suggest this:
 
   Only consider siblings that have a TODO keyword.
 
 I suppose todo-only and include-done are compatible, right?

todo-only excludes items without any todo keyword, ie plain
headlines. See example above on if item 7 is included or not.

include-done forces items with a DONE/CANCELLEd keyword to be considered

 
 What about using exclusive options like todo-only and
 todo-and-done-only?  So that you would need to use only one.

I'm fine with that, will change.
   
   (require 'org)
  +(require 'cl)
 
 this (eval-when-compile (require 'cl)) -- emacs has a policy of
 preventing (require 'cl) only...

I grepped *.el and saw other file using it without eval-when-compile
(it was htmlize.el i think), so I thought it was ok in contrib. My
worry was that using functions as opposite to macros needs it loaded,
since I use (remove-if) and (position)

But I just tested it on clean file and emacs -Q, and
(eval-when-compile (require 'cl)) and then using 'cl-seq functions
like remove-if seems to works fine.

I'll submit updated patch later today taken above comments inte
consideration. Attached is an org file where you can test various
options

 Thanks for further feedback on this!  If you can provide a small
 Org file where I can test the new functionalities that will help
 a lot.

Attached is a test file you can use for all the situation that you
asked clarification for. After testing this file I'm thinking maybe
from-current should be a default instead of from-top. Basically I'm
open to suggestion as to the most sensible default options. I myself
use a hook that auto-inserts TRIGGER line i want when entry becomes
next, maybe such hook should be included into org-depend also? At
least as example?




org-depend-chain-find-next-test.org
Description: Binary data





Re: [O] [PATCH] New org-depend trigger for finding next highest priority/effort item

2011-07-26 Thread Max Mikhanosha
Amended patch attached, changes:

- use (eval-when-compile) with require 'cl
- changed include-done to todo-and-done-only
- Added defcustom org-depend-find-next-options for default options
  which are now: from-current,todo-only,priority-up
- cleaned up documentation  

Also attached is updated test file, added #+TODO line since NEXT is
not in default list of keywords.

Content-Disposition: attachment; 
filename=0011-Add-chain-find-next-trigger-option.patch][8bit]]
From 6140261b2fe0e15ac36d8222c38790680cd3f9d4 Mon Sep 17 00:00:00 2001
From: Max Mikhanosha m...@openchat.com
Date: Sun, 24 Jul 2011 14:44:44 -0400
Subject: [PATCH 11/11] Add chain-find-next trigger option.

---
 contrib/lisp/org-depend.el |  145 +++-
 1 files changed, 143 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/org-depend.el b/contrib/lisp/org-depend.el
index 089a6a0..77a7c68 100644
--- a/contrib/lisp/org-depend.el
+++ b/contrib/lisp/org-depend.el
@@ -55,7 +55,43 @@
 ;;- The sibling also gets the same TRIGGER property
 ;;  chain-siblings-scheduled, so the chain can continue.
 ;;
-;; 3) If the TRIGGER property contains any other words like
+;; 3) If the TRIGGER property contains the string
+;;chain-find-next(KEYWORD[,OPTIONS]), then switching that entry
+;;to DONE do the following:
+;;- All siblings are of the entry are collected into a temporary
+;;  list and then filtered and sorted according to OPTIONS
+;;- The first sibling on the list is changed into KEYWORD state
+;;- The sibling also gets the same TRIGGER property
+;;  chain-find-next, so the chain can continue.
+;;  
+;;OPTIONS should be a comma separated string without spaces, and
+;;can contain following options:
+;;
+;;- from-top  the candidate list is all of the siblings in
+;;the current subtree
+;;
+;;- from-bottom   candidate list are all siblings from bottom up
+;;
+;;- from-current  candidate list are all siblings from current item
+;;until end of subtree, then wrapped around from
+;;first sibling
+;;
+;;- no-wrap   candidate list are siblings from current one down
+;;
+;;- todo-only Only consider siblings that have a todo keyword
+;;- 
+;;- todo-and-done-only
+;;Same as above but also include done items.
+;;
+;;- priority-up   sort by highest priority
+;;- priority-down sort by lowest priority
+;;- effort-up sort by highest effort
+;;- effort-down   sort by lowest effort
+;;
+;;Default OPTIONS are from-top 
+;;
+;;
+;; 4) If the TRIGGER property contains any other words like
 ;;XYZ(KEYWORD), these are treated as entry id's with keywords.  That
 ;;means Org-mode will search for an entry with the ID property XYZ
 ;;and switch that entry to KEYWORD as well.
@@ -121,12 +157,20 @@
 ;;
 
 (require 'org)
+(eval-when-compile
+  (require 'cl))
 
 (defcustom org-depend-tag-blocked t
   Whether to indicate blocked TODO items by a special tag.
   :group 'org
   :type 'boolean)
 
+(defcustom org-depend-find-next-options
+  from-current,todo-only,priority-up
+  Default options for chain-find-next trigger
+  :group 'org
+  :type 'string)
+
 (defmacro org-depend-act-on-sibling (trigger-val rest rest)
   Perform a set of actions on the next sibling, if it exists,
 copying the sibling spec TRIGGER-VAL to the next sibling.
@@ -143,6 +187,8 @@ copying the sibling spec TRIGGER-VAL to the next sibling.
(org-entry-add-to-multivalued-property
 nil TRIGGER ,trigger-val
 
+(defvar org-depend-doing-chain-find-next nil)
+
 (defun org-depend-trigger-todo (change-plist)
   Trigger new TODO entries after the current is switched to DONE.
 This does two different kinds of triggers:
@@ -184,12 +230,107 @@ This does two different kinds of triggers:
   ;; Go through all the triggers
   (while (setq tr (pop triggers))
(cond
+((and (not org-depend-doing-chain-find-next)
+  (string-match \\`chain-find-next(\\b\\(.+?\\)\\b\\(.*\\))\\' 
tr))
+ ;; smarter sibling selection
+ (let* ((org-depend-doing-chain-find-next t)
+(kwd (match-string 1 tr))
+(options (match-string 2 tr))
+(options (if (or (null options)
+ (equal options ))
+ org-depend-find-next-options
+   options))
+(todo-only (string-match todo-only options))
+(todo-and-done-only (string-match todo-and-done-only
+  options))
+(from-top (string-match from-top options))
+(from-bottom (string-match from-bottom options))
+(from-current (string-match from-current options))
+(no-wrap (string-match no-wrap options

[O] [PATCH] New org-depend trigger for finding next highest priority/effort item

2011-07-24 Thread Max Mikhanosha
org-depend TRIGGER chain-siblings(NEXT) property is hardly usable for
me, because it requires too much effort to keep items nicely sorted.

For example if next headline is already in DONE state, chain-siblings
would still change it. I prefer to sort my items by setting their
priorities and/or effort estimate, leaving DONE items in place for
some time.

Attached patch implements new TRIGGER chain-find-next(NEXT[,options])
trigger, which allows to flexibly select which of the siblings will be
changed to NEXT.

Example: chain-find-next(NEXT,from-current,priority-up,todo-only)



0011-Add-chain-find-next-trigger-option.patch
Description: Binary data


Re: [O] Problems getting dropbox support on MobileOrg

2011-07-22 Thread Max Mikhanosha
 see Dropbox authentication.  Should the MobileOrg folder 
 have been created for me on my Dropbox site?  (It looks like it is
 automatically created on the iphone app).  Nothing was created, either
 before or after attempting to sync.  So, I then manually created
 MobileOrg folder, and tried to Sync again, but no joy.

No you need to create the folder from the Emacs side.

Example setup;

1. Install dropbox on your linux/windows box
2. Make sure its started (setsid ~/.dropbox-dist/dropboxd)
3. mkdir ~/Dropbox/syncdir
4. From emacs 
   (setq org-mobile-directory ~/Dropbox/syncdir)
   M-x org-mobile-push
5. From Android, Settings - Configure Synchronizer - Path
  /syncdir/index.org

6. From Android: Sync  Enjoy

I recently submitted a few patches for org-mobile android developer,
that fix a few annoying problems (ie back button resetting the view to
1st element), there should be a new version released soon with these fixes.





Re: [O] [PATCH 1/2] Fix error with %e agenda prefix format when there is no effort set

2011-07-22 Thread Max Mikhanosha

  (setq category (substring category 0 (1- 
  org-prefix-category-max-length)
 ;; Evaluate the compiled format
  +  (assert effort)
 
 Why is this needed?  

Oops left that in accidentally. If you hold on for a few days, I'll
send a more complete patch implementing:

1. Refresh the %e effort displayed on agenda line after it changed by 
(org-agenda-set-effort)

2. Two new commands, org-agenda-effort-up, org-agenda-effort-down,
that would shift the effort up/down to the next value, with suggested
bindings of M-Left and M-Right, which will allow effortless editing of
efforts in Agenda







Re: [O] [PATCH] Fix %e agenda format and refresh of agenda items in general

2011-07-22 Thread Max Mikhanosha
Here is an updated patch, its split into 3 very small part, belowe is
an explanaton of each:

1. First patch is my original patch to fix error with %e agenda format.

2. Second patch fixes what I beleive to be a logic bug. Most agenda
related commands have the following format:

  (defun org-agenda-do-STUFF ()

   (org-with-remote-undo buffer
  (with-current-buffer buffer

;; change the item
(call-interactively 'org-do-STUFF)
(setq newhead (org-get-heading)))

 ;; refresh agenda lines that have same marker
 (org-agenda-change-all-lines newhead hdmarker))) 

The problem is with (org-agenda-change-all-lines). It calls
(org-format-agenda-item) on each item, but with the current buffer
being the agenda buffer and not the original item's buffer.

Also (org-format-agenda-item) expects the agenda item format to be in
the variable org-prefix-format-compiled. But when called by
(org-agenda-change-all-lines), that variable is not restored, and
instead has stale value from the last block of the agenda.

This causes the items to be randomly reformatted with last block's
agenda format, when they are changed.

My second patch fixes above problem, by making
(org-agenda-change-all-lines) call (org-format-agenda-item) in the
same way as when item was originally generated including changing
to the item's buffer, and restoring the correct compiled format variable.

3. Third patch changes (org-agenda-set-effort) to refresh the item. It requires
the 2nd patch to work.




0003-Fix-error-with-e-agenda-prefix-format-when-there-is-.patch
Description: Binary data


0007-org-agenda-change-all-lines-Change-to-item-s-buffer-.patch
Description: Binary data


0008-org-agenda-set-effort-Refresh-changed-lines.patch
Description: Binary data


[O] [PATCH 1/2] Fix error with %e agenda prefix format when there is no effort set

2011-07-21 Thread Max Mikhanosha
`org-agenda-prefix-format' has un undocumented format %e for Effort, which
is broken. it throws error on entries without effort property.

Following patch fixes that problem. TODO: make agenda redraw current line
when `org-agenda-set-effort' sets a new effort

From c06b376737142eff5cdec71e8fc8129552aba673 Mon Sep 17 00:00:00 2001
From: Max Mikhanosha m...@openchat.com
Date: Wed, 6 Jul 2011 20:05:06 -0400
Subject: [PATCH 1/2] Fix error with %e agenda prefix format when there is no 
effort set

---
 lisp/org-agenda.el |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index cd09a74..f34ffae 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5511,7 +5511,9 @@ Any match of REMOVE-RE will be removed from TXT.
(error nil)))
(when effort
  (setq neffort (org-duration-string-to-minutes effort)
-   effort (setq effort (concat [ effort ] )
+   effort (setq effort (concat [ effort ])
+  ;; prevent erroring out with %e format when there is no effort
+  (or effort (setq effort ))
 
   (when remove-re
(while (string-match remove-re txt)
@@ -5549,6 +5551,7 @@ Any match of REMOVE-RE will be removed from TXT.
 (= (length category) org-prefix-category-max-length))
(setq category (substring category 0 (1- 
org-prefix-category-max-length)
   ;; Evaluate the compiled format
+  (assert effort)
   (setq rtn (concat (eval org-prefix-format-compiled) txt))
 
   ;; And finally add the text properties
-- 
1.7.3.4




[O] [PATCH 2/2] Log yesterday item today, better org-extend-today-until

2011-07-21 Thread Max Mikhanosha
Started using habits, which are a great addition. My only problem with
habits is that for some of them such as workout or cardio, I just
don't have the energy to get to the computer in the evening and mark
them done.

Instead I do most of my planning for the day in the first 20 minutes
or so of the morning, catching up, refiling, etc. But there is no way
to mark the habit DONE yesterday, and have the correct consistency
graph shown, without manual editing of LOGGING drawer.

There is already unfinished support for backdating stuff via
org-extend-today-until variable, but it does not work in the log-note
time-stamp. Following patch fixes that oversight, and adds two new
commands: (org-done-yesterday) and (org-agenda-done-yesterday), which are
exactly as their today counterparts, but all the timestamps and
CLOSED line will be marked as of 23:59 yesterday.

From daebd6ca8f75ad3266075a8b3ec5d3a1f411ecfb Mon Sep 17 00:00:00 2001
From: Max Mikhanosha m...@openchat.com
Date: Thu, 21 Jul 2011 13:20:01 -0400
Subject: [PATCH 2/2] Make `org-extend-today-until' variable affect log notes, 
and CLOSED: line.

(org-done-yesterday), (org-agenda-done-yesterday): new functions
---
 lisp/org.el |   42 +-
 1 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 611672b..b0f113a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10918,6 +10918,32 @@ nil or a string to be used for the todo mark. )
 
 (defvar org-agenda-headline-snapshot-before-repeat)
 
+(defun org-current-effective-time ()
+  Return current time adjusted for `org-extend-today-until' variable
+  (let* ((ct (org-current-time))
+ (dct (decode-time ct))
+ (ct1
+  (if ( (nth 2 dct) org-extend-today-until)
+  (encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct))
+ct)))
+ct1))
+
+(defun org-todo-yesterday (optional arg)
+  Like `org-todo' but the time of change will be 23:59 of yesterday
+  (interactive P)
+  (let* ((hour (third (decode-time
+   (org-current-time
+ (org-extend-today-until (1+ hour)))
+(org-todo arg)))
+
+(defun org-agenda-todo-yesterday (optional arg)
+  Like `org-agenda-todo' but the time of change will be 23:59 of yesterday
+  (interactive P)
+  (let* ((hour (third (decode-time
+   (org-current-time
+ (org-extend-today-until (1+ hour)))
+(org-agenda-todo arg)))
+
 (defun org-todo (optional arg)
   Change the TODO state of an item.
 The state of an item is given by a keyword at the start of the heading,
@@ -11097,7 +11123,7 @@ For calling through lisp, arg is also interpreted in 
the following way:
  (org-add-planning-info nil nil 'closed))
(when (and now-done-p org-log-done)
  ;; It is now done, and it was not done before
- (org-add-planning-info 'closed (org-current-time))
+ (org-add-planning-info 'closed (org-current-effective-time))
  (if (and (not dolog) (eq 'note org-log-done))
  (org-add-log-setup 'done state this 'findpos 'note)))
(when (and state dolog)
@@ -11638,7 +11664,7 @@ This function is run automatically after each state 
change to a DONE state.
 ((equal (match-string 1 ts) .)
  ;; Shift starting date to today
  (org-timestamp-change
-  (- (time-to-days (current-time)) (time-to-days time))
+  (- (org-today) (time-to-days time))
   'day))
 ((equal (match-string 1 ts) +)
  (let ((nshiftmax 10) (nshift 0))
@@ -11909,6 +11935,11 @@ be removed.
 (defvar org-log-note-extra nil)
 (defvar org-log-note-window-configuration nil)
 (defvar org-log-note-return-to (make-marker))
+(defvar org-log-note-effective-time nil
+  Remembered current time so that dynamically scoped
+`org-extend-today-until' affects tha timestamps in state change
+log)
+
 (defvar org-log-post-message nil
   Message to be displayed after a log note has been stored.
 The auto-repeater uses this.)
@@ -11976,7 +12007,8 @@ EXTRA is additional text that will be inserted into the 
notes buffer.
  org-log-note-state state
  org-log-note-previous-state prev-state
  org-log-note-how how
- org-log-note-extra extra)
+ org-log-note-extra extra
+ org-log-note-effective-time (org-current-effective-time))
(add-hook 'post-command-hook 'org-add-log-note 'append)
 
 (defun org-skip-over-state-notes ()
@@ -12047,10 +12079,10 @@ EXTRA is additional text that will be inserted into 
the notes buffer.
   (cons %U user-full-name)
   (cons %t (format-time-string
   (org-time-stamp-format 'long 'inactive)
-  (current-time)))
+  org-log-note-effective-time))
   (cons %T (format-time-string

[O] org-timestamp-up/down broken in tip

2011-07-21 Thread Max Mikhanosha
With latest git I can only press S-up or S-down on the time part of
the timestamp once, after changing the time it moves point to the
closing bracket, and doing another S-up or S-down changes the date
part instead of time.

Example: with point on the 05 at the timestamp [2011-07-21 Thu
19:05] doing Shift-Up results in time correctly changed to 19:10, but
point moves to the closing bracket. Next time you press S-Up it
changes date, not time.

Reverting following commit fixes the problem for me:

commit fd0f8e10d1d3a339da9460d6c71283e85897c455
Author: Nicolas Goaziou n.goaz...@gmail.com
Date:   Thu Jul 21 11:48:35 2011 +0200

Fix bug with TODO states changes modifying scheduling of next headline

* lisp/org.el (org-timestamp-change): some locales don't use the same
  length for date abbreviations. Set a marker at origin in case length
  of new timestamp is different.



[Orgmode] dates fontification stickiness

2008-07-21 Thread Max Mikhanosha
If one goes to the end of the line with a date like so (| representing
cursor)

 [2008-07-21]|

And then press enter and type something, like so

 [2008-07-21]
spaces typing here|

Then the line you added will all be highlighted with org date
face. I've changed it so that my TODO's have initial state change note
upon creation (so that I can know how long TODO is sitting there since
created), and now each time I'm about to add text under these TODO
headlines I'm hitting the above problem, which was very annoying.

I've fixed it by doing (add-to-list 'org-nonsticky-props 'face), seems
to work for me, will that cause problems? So far I have not noticed
any artifacts from this change, but its only been a few minutes.

Regards,
  Max








___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: dates fontification stickiness

2008-07-21 Thread Max Mikhanosha
Ok, with --no-init-file this does not happen. I'll do binary search on
my .emacs to see whats causing this and if its any of the standard
emacs settings that can cause it.

At Mon, 21 Jul 2008 13:00:57 -0400,
Bernt Hansen wrote:
 
 I can't reproduce this either.
 
 GNU Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 
 2008-04-27 on raven, modified by Debian
 Org-mode version 6.06pre01
 
 -Bernt
 
 Carsten Dominik [EMAIL PROTECTED] writes:
 
  I am unable to reproduce this problem.  Anyone?
 
  - Carsten
 
  On Jul 21, 2008, at 7:24 AM, Max Mikhanosha wrote:
 
  If one goes to the end of the line with a date like so (| representing
  cursor)
 
  [2008-07-21]|
 
  And then press enter and type something, like so
 
  [2008-07-21]
  spaces typing here|
 
  Then the line you added will all be highlighted with org date
  face. I've changed it so that my TODO's have initial state change note
  upon creation (so that I can know how long TODO is sitting there since
  created), and now each time I'm about to add text under these TODO
  headlines I'm hitting the above problem, which was very annoying.
 
  I've fixed it by doing (add-to-list 'org-nonsticky-props 'face), seems
  to work for me, will that cause problems? So far I have not noticed
  any artifacts from this change, but its only been a few minutes.
 
  Regards,
   Max
 
 
 
 
 
 
 
 
  ___
  Emacs-orgmode mailing list
  Remember: use `Reply All' to send replies to the list.
  Emacs-orgmode@gnu.org
  http://lists.gnu.org/mailman/listinfo/emacs-orgmode
 
 
 
  ___
  Emacs-orgmode mailing list
  Remember: use `Reply All' to send replies to the list.
  Emacs-orgmode@gnu.org
  http://lists.gnu.org/mailman/listinfo/emacs-orgmode


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: dates fontification stickiness

2008-07-21 Thread Max Mikhanosha
After restarting emacs, I can't reproduce this any longer. One of the
disadvantages of running multi-tty emacs is that its up for weeks, and
accumulatively things can get misteriously non-working.

At Mon, 21 Jul 2008 14:25:43 -0400,
Max Mikhanosha wrote:
 
 Ok, with --no-init-file this does not happen. I'll do binary search on
 my .emacs to see whats causing this and if its any of the standard
 emacs settings that can cause it.
 
 At Mon, 21 Jul 2008 13:00:57 -0400,
 Bernt Hansen wrote:
  
  I can't reproduce this either.
  
  GNU Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 
  2008-04-27 on raven, modified by Debian
  Org-mode version 6.06pre01
  
  -Bernt
  
  Carsten Dominik [EMAIL PROTECTED] writes:
  
   I am unable to reproduce this problem.  Anyone?
  
   - Carsten
  
   On Jul 21, 2008, at 7:24 AM, Max Mikhanosha wrote:
  
   If one goes to the end of the line with a date like so (| representing
   cursor)
  
   [2008-07-21]|
  
   And then press enter and type something, like so
  
   [2008-07-21]
   spaces typing here|
  
   Then the line you added will all be highlighted with org date
   face. I've changed it so that my TODO's have initial state change note
   upon creation (so that I can know how long TODO is sitting there since
   created), and now each time I'm about to add text under these TODO
   headlines I'm hitting the above problem, which was very annoying.
  
   I've fixed it by doing (add-to-list 'org-nonsticky-props 'face), seems
   to work for me, will that cause problems? So far I have not noticed
   any artifacts from this change, but its only been a few minutes.
  
   Regards,
Max
  
  
  
  
  
  
  
  
   ___
   Emacs-orgmode mailing list
   Remember: use `Reply All' to send replies to the list.
   Emacs-orgmode@gnu.org
   http://lists.gnu.org/mailman/listinfo/emacs-orgmode
  
  
  
   ___
   Emacs-orgmode mailing list
   Remember: use `Reply All' to send replies to the list.
   Emacs-orgmode@gnu.org
   http://lists.gnu.org/mailman/listinfo/emacs-orgmode
 
 
 ___
 Emacs-orgmode mailing list
 Remember: use `Reply All' to send replies to the list.
 Emacs-orgmode@gnu.org
 http://lists.gnu.org/mailman/listinfo/emacs-orgmode


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Bug: Undo does not work in org-agenda-todo when logging a note

2008-07-18 Thread Max Mikhanosha
If I press 't' in the agenda buffer and the state change is logged
with a note, undo in the agenda buffer only undoes a note line in the
org buffer, leaving the item state changed, and now being out of sync
with agenda.

If there is no note, then undo works fine. 

Regards,
  Max



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Bug in customize for org-agenda-custom-commands

2008-07-17 Thread Max Mikhanosha
I've redone my org-agenda-custom-commands through customize to learn
about new features, and there is a bug if one uses :other
customization in the variables list.. It pre-defines the variable to be
org-agenda-skip-function and then when I enter the value as 'my-skip.

When I apply the changes, it puts ((...) (...)
((org-agenda-skip-function (quote my-skip into the agenda command,
note the extra level of parenthesis, and trying to run that agenda item
gives not a symbol error.. If I use any variable and put
org-agenda-skip-function and 'my-skip then it works fine.

This is with .git version

Regards,
  Max


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] FR: headline iteration API

2008-07-16 Thread Max Mikhanosha
At Wed, 11 Jun 2008 12:15:11 -0500,
Eddward DeVilla wrote:

  - doc traversal
 - first-item
   Go to the first item in the file.
 - current-item
   Go to the beginning of the item containing the cursor.
 - next-item
   Go to the item after the current one.
 - previous-item
   Go to item before the current one

Some time ago I wrote the following for myself, and I find that I use
these bindings several times a day.

(defun my-org-skip-forward (arg)
  Move forward to the next visible 2nd or greater level heading,
skipping headings of the same level as the starting position
  (interactive p)
  (let ((initial-level (org-outline-level))
(done nil))
(while (not done)
  (outline-next-visible-heading arg)
  (let ((level (org-outline-level)))
(when (and ( initial-level 1) (= level 1))
   (setq initial-level -1))
(setq done (or
(and ( arg 0) (bobp)) 
(and ( arg 0) (eobp))
(and (not (= level initial-level)

(defun my-org-skip-backward (arg)
  (interactive p)
  (my-org-skip-forward (- arg)))

The idea is that point is moved to the next visible boundary where
outline level changes. This is useful when you have your file in
collapsed state with only a few trees expanded. Above command allows
one to quickly jump between such trees.

Also useful for navigating result of a sparse tree search in the same
manner.

Regards,
  Max



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] BUG: blank lines when cutting and pasting

2008-01-09 Thread Max Mikhanosha
Given the following top level heading


* test
** one
*** one.one

some text

** two
*** two.two

some text

** three
*** three.three

some text


If one goes to the beginning of heading ** two and use C-M-w to cut
the heading, the cut buffer starts with \n\n** two, ie contains two
extra blank lines before the actual start of the heading.  It does 
not matter if children are expanded or not.

If you paste that heading with C-M-y the extra blank line is inserted
before the heading.

IMHO if user cuts a heading, cut buffer should contain the text
starting with asterisk, without any extra new lines.

Regards,
  Max



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] org-refile hack to show headings

2007-11-30 Thread Max Mikhanosha
At Thu, 29 Nov 2007 20:22:53 -0500,
John Rakestraw wrote:
 
 and then adapted/adopted by Carsten in org 5.14. However, I found it
 difficult sometimes to remember the particular heading to which I
 wanted to move the new item -- the auto-complete is helpful, but only
 if I can remember just how a heading starts. I have a simple (and

Glad you liked my setup. I can't help but recommend using
http://www.emacswiki.org/cgi-bin/wiki/Icicles library.

In case you never heard of it, icicles is to TAB completion what TAB
completion is to typing things manually every time. In my setup (I
think this is a default too) TAB does the prefix completion (like
Emacs), but Shift-Tab matches the regexp.

So when refiling Emacs related entries all I have to do is type is
emaS-TAB and it completes it to Using Org-mode in Emacs.

Regards,
  Max


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] PATCH: include in-progress/started todos into daily agenda

2007-10-09 Thread Max Mikhanosha
Hi Dominik,

Carsten Dominik wrote:
 
 In 5.12 there will be a new variable `org-agenda-scheduled-leaders' that
 determines the leading string of a scheduled item in the agenda display.
 
 If you customize
 
 (setq org-agenda-scheduled-leaders '(Start:  Cont:  ))
 
 then your INPROGRESS item will look like  this:
 
 Work:  Start: TODO This task is scheduled for today
 Work:  Cont:  INPROGRESS task was scheduled in past, not DONE.
 
 Maybe less distressing than Sched: 15x ?

The above will probably work for me, I have to try it for a few
days. To me the INPROGRESS thing is also about efficiency, as if I
lets say have to put something aside, I just flip it back into TODO
state with 1 t from agenda, but if I have it scheduled, to unschedule
it I have to go to the item and remove the SCHEDULED line. Someone
recently asked on a list for a command to unschedule a TODO, I would
like to join this request.

 Many thanks for your input, great that you produced a patch, sorry
 for not using it.

Its no problem, I'm posting posting patches mostly to generate
discussion / give back to the google it first community (ppl who
solve most of their problems by googling it and finding someone
already posted a fix/patch/idea for it on some mailing list).

Regards,
  Max

 On Sep 26, 2007, at 22:50, Max Mikhanosha wrote:
 
  I had always used the day/weekly/mothly agenda vs the searchable
  agenda separately and sometimes missed things because they were in one
  list but not another.  For example when looking into a tags based
  agenda for :computer, I may have missed some other item that was
  scheduled for today but not tagged with computer, and via versa.
 
  The method described in the post titled Not using GTD post, where
  only the daily agenda is the primary agenda used solves this problem,
  but I don't like to schedule/reschedule my items all the time.
 
  So inspired by the Not using GTD post, proposed patch allows
  specifying a TODO type that would always be included into daily
  agenda on a current day, as if it was scheduled.
 
  So one can just mark items that need to be worked on doing the day as
  lets say INPROGRESS and they would stay in the daily agenda
  alongside/intermixed with the items scheduled for today until you
  close them. If you like to postpone the item, you put it as TODO
  again, and it would disappear.
 
  Proposed patch is as plain text below, feel free to rewrite/change
  as the method I've used may not have been optimal.
 
  Regards,
Max
 
  diff -rp -x '*.orig' -x '*.elc' -x '*~' org-5.10a.orig/org.el 
  org-5.10a/org.el
  *** org-5.10a.orig/org.el   Wed Sep 26 13:33:20 2007
  --- org-5.10a/org.elWed Sep 26 16:33:52 2007
  *** When nil, only the days which actually h
  *** 2323,2328 
  --- 2323,2342 
  :group 'org-agenda-daily/weekly
  :type 'boolean)
 
  + (defcustom org-agenda-show-inprogress-todos nil
  +   Non-nil means, include the TODO's of the type specified by
  + `org-inprogress-todos' into the daily agenda.
  +   :group 'org-agenda-daily/weekly
  +   :type 'boolean)
  +
  + (defcustom org-inprogress-todos INPROGRESS
  +   Specifies TODO type that would be automatically included into
  + the daily agenda when `org-agenda-show-inprogress-todos' is set.
  + You can specify more then one value separating them with |, for
  + example INPROGRESS|STARTED
  +   :group 'org-agenda-daily/weekly
  +   :type 'string)
  +
(defcustom org-agenda-format-date 'org-agenda-format-date-aligned
  Format string for displaying dates in the agenda.
Used by the daily/weekly agenda and by the timeline.  This should be
  *** NDAYS defaults to `org-agenda-ndays'.
  *** 18056,18062 
  (- sd (+ (if ( d 0) 7 0) d)
   (day-numbers (list start))
   (inhibit-redisplay (not debug-on-error))
  !s e rtn rtnall file date d start-pos end-pos todayp nd)
(setq org-agenda-redo-command
(list 'org-agenda-list (list 'quote include-all) start-day ndays))
;; Make the list of days
  --- 18070,18077 
  (- sd (+ (if ( d 0) 7 0) d)
   (day-numbers (list start))
   (inhibit-redisplay (not debug-on-error))
  !s e rtn rtnall file date d start-pos end-pos todayp nd
  !  args)
(setq org-agenda-redo-command
(list 'org-agenda-list (list 'quote include-all) start-day ndays))
;; Make the list of days
  *** NDAYS defaults to `org-agenda-ndays'.
  *** 18102,18117 
  (setq end-pos (point
  (setq files thefiles
  rtnall nil)
  (while (setq file (pop files))
  (catch 'nextfile
(org-check-agenda-file file)
  ! (if org-agenda-show-log
  ! (setq rtn (org-agenda-get-day-entries
  !file date
  !:deadline :scheduled :timestamp :sexp :closed))
  !   (setq rtn (org-agenda-get-day-entries
  !  file date

Re: [Orgmode] Moving an item to a precise place

2007-10-02 Thread Max Mikhanosha
Hi Xavier,

At Sun, 16 Sep 2007 03:00:10 +0200,
Xavier Maillard wrote:
 
 So let's say I have this organization:
 
 * Project 1
 ** TODO Ask foo about bar
 
 * Project 2
 ** TODO Write customer report
 
 * Project 3
 
 How can I move the TODO from Project 1 to Project 3 directly
 -i.e. move by name

I'm catching up on reading my mailing lists, therefore you may have
already found a different way to do it, but just in case below is what
I wrote for myself for same functionality that you asked for.

Regards,
  Max

;;; Below code provides a function M-x org-quicky-refile which cuts a
;;; heading, then scans the file for the names of top level headings,
;;; and asks for the heading name to paste the item into (with
;;; standard Emacs completion)
;;;
;;; Simply bind org-quicky-refile to a key in org-mode-map.
;;;
;;; Bugs: leaves empty line sometimes, but this is a bug in
;;  org-paste-subtree IMHO.
;;;
;;; Possible improvements: only collect headings with specific tags
;;; as targets, so that one can tag 3rd/4th level headings as target

(defun org-quicky-get-heading (optional no-props)
  (if (looking-at ^\\*+[ \t]+\\([^\r\n]*?\\)[ \t]*\\(:[a-zA-Z0-9:[EMAIL 
PROTECTED])?[ \t]*[\r\n]) 
  (if no-props (org-match-string-no-properties 1) 
(match-string 1)) ))

(defun org-quicky-get-toplevel-headings ()
  Return a list of top level headings
  (let (headings) 
(save-excursion
  (goto-char (point-min))
  (while (not (eobp))
(when (and (looking-at outline-regexp)
   (= (org-outline-level) 1))
  (push (cons (org-quicky-get-heading t) (point-marker)) headings))
(forward-line)))
(nreverse headings)))

(defmacro when* (expr rest body)
  `(let ((it ,expr))
 (when it
   ,@body)))

(defvar org-quicky-refile-history nil)

(defun org-quicky-refile (optional arg)
  (interactive)
  (let* ((headings (org-quicky-get-toplevel-headings))
 (completion-ignore-case t)
 pos)
(when* (completing-read 
Project:  (mapcar #'car headings)
nil t nil 'org-quicky-refile-history)
   (setq pos (cdr (assoc it headings)))
   (org-cut-special)
   (save-excursion 
 (goto-char pos)
 (setq pos (or (save-excursion 
 (outline-get-next-sibling))
   (point-max)))
 (goto-char pos)
 (org-paste-subtree 2)



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: PATCH: include in-progress/started todos into daily agenda

2007-09-27 Thread Max Mikhanosha
Responding to my own email, because I accidentally deleted Carsten
response.

Carsten suggested that I check the block agenda functionality to see
if it already does the same thing. The block agenda have the following
little quirks which made me implement my own solution instead:

Example of block agenda:


Day-agenda:
Thursday  27 September 2007
  proj:   Scheduled:  TODO [#C] Some scheduled task


Global list of TODO items of type: INPROGRESS   
 
  proj:   INPROGRESS [#A] Some task that is already in progress
-


1. Items from the block agenda are a separate block, and not sorted
   together with the items scheduled for the same day. So even if my
   in-progress item is A its shown below the scheduled for this day
   item that is C

2. There are 3 lines of vertical space taken by the empty line at the
   end of the daily agenda, the === separator and the Global list
   heading. I usually use emacs from tty, so my screen is 100x30 so 3
   lines is 1/3 of the whole agenda buffer.

Below is how it looks like when in-progress items are treated as if
they were scheduled for today, which is what my patch does.


Day-agenda:
Thursday  27 September 2007
  proj:   INPROGRESS [#A] Some task that is already in progress
  proj:   Scheduled:  TODO [#C] Some scheduled task
-

Which is much clearer to me.  The in-progress tasks are in the same
list as the tasks scheduled for today, and are sorted together.

Its not problem if my patch is rejected, I have a less invasive
solution for my own needs that does the same thing with a single
defadvice. I have only sent a patch because IMHO ppl were already
discussing the same method of mixing the daily agenda with in-progress
items, but with a manual method of managing the in-progress items,
ie re-scheduling them every day until done with them.

At Wed, 26 Sep 2007 16:50:15 -0400, Max Mikhanosha wrote:
 
 I had always used the day/weekly/mothly agenda vs the searchable
 agenda separately and sometimes missed things because they were in one
 list but not another.  For example when looking into a tags based
 agenda for :computer, I may have missed some other item that was
 scheduled for today but not tagged with computer, and via versa.
 
 The method described in the post titled Not using GTD post, where
 only the daily agenda is the primary agenda used solves this problem,
 but I don't like to schedule/reschedule my items all the time. 
 
 So inspired by the Not using GTD post, proposed patch allows
 specifying a TODO type that would always be included into daily
 agenda on a current day, as if it was scheduled.
 
 So one can just mark items that need to be worked on doing the day as
 lets say INPROGRESS and they would stay in the daily agenda
 alongside/intermixed with the items scheduled for today until you
 close them. If you like to postpone the item, you put it as TODO
 again, and it would disappear.
 
 Proposed patch is as plain text below, feel free to rewrite/change 
 as the method I've used may not have been optimal.
 
 Regards,
   Max
 
 diff -rp -x '*.orig' -x '*.elc' -x '*~' org-5.10a.orig/org.el org-5.10a/org.el
 *** org-5.10a.orig/org.el Wed Sep 26 13:33:20 2007
 --- org-5.10a/org.el  Wed Sep 26 16:33:52 2007
 *** When nil, only the days which actually h
 *** 2323,2328 
 --- 2323,2342 
 :group 'org-agenda-daily/weekly
 :type 'boolean)
   
 + (defcustom org-agenda-show-inprogress-todos nil
 +   Non-nil means, include the TODO's of the type specified by
 + `org-inprogress-todos' into the daily agenda.
 +   :group 'org-agenda-daily/weekly
 +   :type 'boolean)
 + 
 + (defcustom org-inprogress-todos INPROGRESS
 +   Specifies TODO type that would be automatically included into
 + the daily agenda when `org-agenda-show-inprogress-todos' is set.
 + You can specify more then one value separating them with |, for
 + example INPROGRESS|STARTED
 +   :group 'org-agenda-daily/weekly
 +   :type 'string)
 + 
   (defcustom org-agenda-format-date 'org-agenda-format-date-aligned
 Format string for displaying dates in the agenda.
   Used by the daily/weekly agenda and by the timeline.  This should be
 *** NDAYS defaults to `org-agenda-ndays'.
 *** 18056,18062 
   (- sd (+ (if ( d 0) 7 0) d)
(day-numbers (list start))
(inhibit-redisplay (not debug-on-error))
 !  s e rtn rtnall file date d start-pos end-pos todayp nd)
   (setq org-agenda-redo-command
 (list 'org-agenda-list (list 'quote include-all) start-day ndays))
   ;; Make the list of days
 --- 18070,18077 
   (- sd (+ (if ( d 0) 7 0) d

[Orgmode] PATCH: include in-progress/started todos into daily agenda

2007-09-26 Thread Max Mikhanosha
I had always used the day/weekly/mothly agenda vs the searchable
agenda separately and sometimes missed things because they were in one
list but not another.  For example when looking into a tags based
agenda for :computer, I may have missed some other item that was
scheduled for today but not tagged with computer, and via versa.

The method described in the post titled Not using GTD post, where
only the daily agenda is the primary agenda used solves this problem,
but I don't like to schedule/reschedule my items all the time. 

So inspired by the Not using GTD post, proposed patch allows
specifying a TODO type that would always be included into daily
agenda on a current day, as if it was scheduled.

So one can just mark items that need to be worked on doing the day as
lets say INPROGRESS and they would stay in the daily agenda
alongside/intermixed with the items scheduled for today until you
close them. If you like to postpone the item, you put it as TODO
again, and it would disappear.

Proposed patch is as plain text below, feel free to rewrite/change 
as the method I've used may not have been optimal.

Regards,
  Max

diff -rp -x '*.orig' -x '*.elc' -x '*~' org-5.10a.orig/org.el org-5.10a/org.el
*** org-5.10a.orig/org.el   Wed Sep 26 13:33:20 2007
--- org-5.10a/org.elWed Sep 26 16:33:52 2007
*** When nil, only the days which actually h
*** 2323,2328 
--- 2323,2342 
:group 'org-agenda-daily/weekly
:type 'boolean)
  
+ (defcustom org-agenda-show-inprogress-todos nil
+   Non-nil means, include the TODO's of the type specified by
+ `org-inprogress-todos' into the daily agenda.
+   :group 'org-agenda-daily/weekly
+   :type 'boolean)
+ 
+ (defcustom org-inprogress-todos INPROGRESS
+   Specifies TODO type that would be automatically included into
+ the daily agenda when `org-agenda-show-inprogress-todos' is set.
+ You can specify more then one value separating them with |, for
+ example INPROGRESS|STARTED
+   :group 'org-agenda-daily/weekly
+   :type 'string)
+ 
  (defcustom org-agenda-format-date 'org-agenda-format-date-aligned
Format string for displaying dates in the agenda.
  Used by the daily/weekly agenda and by the timeline.  This should be
*** NDAYS defaults to `org-agenda-ndays'.
*** 18056,18062 
(- sd (+ (if ( d 0) 7 0) d)
 (day-numbers (list start))
 (inhibit-redisplay (not debug-on-error))
!s e rtn rtnall file date d start-pos end-pos todayp nd)
  (setq org-agenda-redo-command
  (list 'org-agenda-list (list 'quote include-all) start-day ndays))
  ;; Make the list of days
--- 18070,18077 
(- sd (+ (if ( d 0) 7 0) d)
 (day-numbers (list start))
 (inhibit-redisplay (not debug-on-error))
!s e rtn rtnall file date d start-pos end-pos todayp nd
!  args)
  (setq org-agenda-redo-command
  (list 'org-agenda-list (list 'quote include-all) start-day ndays))
  ;; Make the list of days
*** NDAYS defaults to `org-agenda-ndays'.
*** 18102,18117 
(setq end-pos (point
(setq files thefiles
rtnall nil)
(while (setq file (pop files))
(catch 'nextfile
  (org-check-agenda-file file)
! (if org-agenda-show-log
! (setq rtn (org-agenda-get-day-entries
!file date
!:deadline :scheduled :timestamp :sexp :closed))
!   (setq rtn (org-agenda-get-day-entries
!  file date
!  :deadline :scheduled :sexp :timestamp)))
  (setq rtnall (append rtnall rtn
(if org-agenda-include-diary
  (progn
--- 18117,18132 
(setq end-pos (point
(setq files thefiles
rtnall nil)
+   (setq args '(:deadline :scheduled :timestamp :sexp))
+   (when org-agenda-show-log
+ (push :closed args)) 
+   (when org-agenda-show-inprogress-todos
+ (push :inprogress args))
(while (setq file (pop files))
(catch 'nextfile
  (org-check-agenda-file file)
!   (setq rtn (apply 'org-agenda-get-day-entries
!file date args))
  (setq rtnall (append rtnall rtn
(if org-agenda-include-diary
  (progn
*** the documentation of `org-diary'.
*** 18606,18611 
--- 18621,18632 
  ;; The way we repeatedly append to `results' makes it O(n^2) :-(
  (while (setq arg (pop args))
(cond
+((and (eq arg :inprogress)
+  (equal date (calendar-current-date)))
+ (let ((org-select-this-todo-keyword
+  org-inprogress-todos))
+ (setq rtn (org-agenda-get-todos))
+ (setq results (append results rtn
 ((and (eq arg :todo)
   (equal date