emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-agenda: rewrite mode-line
@ 2010-12-06 15:41 Julien Danjou
  2010-12-12  8:32 ` Carsten Dominik
  2011-01-21  9:25 ` Carsten Dominik
  0 siblings, 2 replies; 10+ messages in thread
From: Julien Danjou @ 2010-12-06 15:41 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Julien Danjou

* org-agenda.el (org-agenda-filter-apply)
(org-agenda-filter-by-tag-show-all) (org-agenda-change-time-span)
(org-remove-subtree-entries-from-agenda) (org-agenda-entry-text-mode,
org-agenda-clockreport-mode) (org-agenda-toggle-diary,
org-agenda-archives-mode) (org-agenda-toggle-deadlines,
org-agenda-toggle-time-grid): Stop calling org-agenda-set-mode-name.
(org-agenda-set-mode-name): Rewrite mode-name value using dynamic
evaluation with :eval and other advanced format.

Signed-off-by: Julien Danjou <julien@danjou.info>
---
 lisp/org-agenda.el |   66 ++++++++++++++++++++-------------------------------
 1 files changed, 26 insertions(+), 40 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 20c901a..7624348 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5936,7 +5936,6 @@ If the line does not have an effort defined, return nil."
   (let (tags)
     (setq org-agenda-filter filter
 	  org-agenda-filter-form (org-agenda-filter-make-matcher))
-    (org-agenda-set-mode-name)
     (save-excursion
       (goto-char (point-min))
       (while (not (eobp))
@@ -5973,8 +5972,7 @@ If the line does not have an effort defined, return nil."
   (mapc 'delete-overlay org-agenda-filter-overlays)
   (setq org-agenda-filter-overlays nil)
   (setq org-agenda-filter nil)
-  (setq org-agenda-filter-form nil)
-  (org-agenda-set-mode-name))
+  (setq org-agenda-filter-form nil))
 
 (defun org-agenda-manipulate-query-add ()
   "Manipulate the query by adding a search term with positive selection.
@@ -6164,7 +6162,6 @@ SPAN may be `day', `week', `month', `year'."
 	  (list (car org-agenda-last-arguments) sd span t)))
     (org-agenda-redo)
     (org-agenda-find-same-or-today-or-agenda))
-  (org-agenda-set-mode-name)
   (message "Switched to %s view" span))
 
 (defun org-agenda-compute-starting-span (sd span &optional n)
@@ -6258,7 +6255,6 @@ so that the date SD will be in that range."
   "Toggle follow mode in an agenda buffer."
   (interactive)
   (setq org-agenda-follow-mode (not org-agenda-follow-mode))
-  (org-agenda-set-mode-name)
   (if (and org-agenda-follow-mode (org-get-at-bol 'org-marker))
       (org-agenda-show))
   (message "Follow mode is %s"
@@ -6274,7 +6270,6 @@ so that the date SD will be in that range."
        (let ((org-agenda-entry-text-maxlines
 	      (if (integerp arg) arg org-agenda-entry-text-maxlines)))
 	 (org-agenda-entry-text-show)))
-  (org-agenda-set-mode-name)
   (message "Entry text mode is %s.  Maximum number of lines is %d"
 	   (if org-agenda-entry-text-mode "on" "off")
 	   (if (integerp arg) arg org-agenda-entry-text-maxlines)))
@@ -6288,7 +6283,6 @@ agenda filter."
   (if with-filter
       (setq org-agenda-clockreport-mode 'with-filter)
     (setq org-agenda-clockreport-mode (not org-agenda-clockreport-mode)))
-  (org-agenda-set-mode-name)
   (org-agenda-redo)
   (message "Clocktable mode is %s"
 	   (if org-agenda-clockreport-mode "on" "off")))
@@ -6305,7 +6299,6 @@ With a double `C-u' prefix arg, show *only* log items, nothing else."
 	    'only
 	  (if special '(closed clock state)
 	    (not org-agenda-show-log))))
-  (org-agenda-set-mode-name)
   (org-agenda-redo)
   (message "Log mode is %s"
 	   (if org-agenda-show-log "on" "off")))
@@ -6316,7 +6309,6 @@ When called with a prefix argument, include all archive files as well."
   (interactive "P")
   (setq org-agenda-archives-mode
 	(if with-files t (if org-agenda-archives-mode nil 'trees)))
-  (org-agenda-set-mode-name)
   (org-agenda-redo)
   (message
    "%s"
@@ -6335,7 +6327,6 @@ When called with a prefix argument, include all archive files as well."
   (org-agenda-check-type t 'agenda)
   (setq org-agenda-include-diary (not org-agenda-include-diary))
   (org-agenda-redo)
-  (org-agenda-set-mode-name)
   (message "Diary inclusion turned %s"
 	   (if org-agenda-include-diary "on" "off")))
 
@@ -6345,7 +6336,6 @@ When called with a prefix argument, include all archive files as well."
   (org-agenda-check-type t 'agenda)
   (setq org-agenda-include-deadlines (not org-agenda-include-deadlines))
   (org-agenda-redo)
-  (org-agenda-set-mode-name)
   (message "Deadlines inclusion turned %s"
 	   (if org-agenda-include-deadlines "on" "off")))
 
@@ -6355,7 +6345,6 @@ When called with a prefix argument, include all archive files as well."
   (org-agenda-check-type t 'agenda)
   (setq org-agenda-use-time-grid (not org-agenda-use-time-grid))
   (org-agenda-redo)
-  (org-agenda-set-mode-name)
   (message "Time-grid turned %s"
 	   (if org-agenda-use-time-grid "on" "off")))
 
@@ -6363,36 +6352,33 @@ When called with a prefix argument, include all archive files as well."
   "Set the mode name to indicate all the small mode settings."
   (setq mode-name
 	(list "Org-Agenda"
-	      (if (get 'org-agenda-files 'org-restrict) " []" "")
+	      '(:eval (when (get 'org-agenda-files 'org-restrict) " []"))
 	      " "
 	      '(:eval (org-agenda-span-name org-agenda-current-span))
-	      (if org-agenda-follow-mode     " Follow" "")
-	      (if org-agenda-entry-text-mode " ETxt"   "")
-	      (if org-agenda-include-diary   " Diary"  "")
-	      (if org-agenda-include-deadlines " Ddl"  "")
-	      (if org-agenda-use-time-grid   " Grid"   "")
-	      (if (and (boundp 'org-habit-show-habits)
-		       org-habit-show-habits) " Habit"   "")
-	      (if (consp org-agenda-show-log) " LogAll"
-		(if org-agenda-show-log " Log" ""))
-	      (if (or org-agenda-filter (get 'org-agenda-filter
-					     :preset-filter))
-		  (concat " {" (mapconcat
-				'identity
-				(append (get 'org-agenda-filter
-					     :preset-filter)
-					org-agenda-filter) "") "}")
-		"")
-	      (if org-agenda-archives-mode
-		  (if (eq org-agenda-archives-mode t)
-		      " Archives"
-		    (format " :%s:" org-archive-tag))
-		"")
-	      (if org-agenda-clockreport-mode
-		  (if (eq org-agenda-clockreport-mode 'with-filter)
-		      " Clock{}" " Clock")
-		"")))
-  (force-mode-line-update))
+	      '(org-agenda-follow-mode " Follow")
+	      '(org-agenda-entry-text-mode " ETxt")
+	      '(org-agenda-include-diary " Diary")
+	      '(org-agenda-include-deadlines " Ddl")
+	      '(org-agenda-use-time-grid " Grid")
+	      '(:eval (and (boundp 'org-habit-show-habits)
+			   org-habit-show-habits " Habit"))
+	      '(:eval (if (consp org-agenda-show-log) " LogAll"
+			(if org-agenda-show-log " Log" "")))
+	      '(:eval (when (or org-agenda-filter (get 'org-agenda-filter
+						       :preset-filter))
+			(concat " {" (mapconcat
+				      'identity
+				      (append (get 'org-agenda-filter
+						   :preset-filter)
+					      org-agenda-filter) "") "}")))
+	      '(:eval (when org-agenda-archives-mode
+			(if (eq org-agenda-archives-mode t)
+			    " Archives"
+			  (format " :%s:" org-archive-tag))))
+	      '(:eval (if org-agenda-clockreport-mode
+			  (if (eq org-agenda-clockreport-mode 'with-filter)
+			      " Clock{}"
+			    " Clock"))))))
 
 (defun org-agenda-post-command-hook ()
   (setq org-agenda-type
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] org-agenda: rewrite mode-line
  2010-12-06 15:41 [PATCH] org-agenda: rewrite mode-line Julien Danjou
@ 2010-12-12  8:32 ` Carsten Dominik
  2010-12-12 18:55   ` Julien Danjou
  2011-01-21  9:25 ` Carsten Dominik
  1 sibling, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2010-12-12  8:32 UTC (permalink / raw)
  To: Julien Danjou; +Cc: emacs-orgmode

Hi Julien,

what is the purpose of this patch, why is it needed?
I generally will not accept patches that lack this information.

- Carsten

On Dec 6, 2010, at 4:41 PM, Julien Danjou wrote:

> * org-agenda.el (org-agenda-filter-apply)
> (org-agenda-filter-by-tag-show-all) (org-agenda-change-time-span)
> (org-remove-subtree-entries-from-agenda) (org-agenda-entry-text-mode,
> org-agenda-clockreport-mode) (org-agenda-toggle-diary,
> org-agenda-archives-mode) (org-agenda-toggle-deadlines,
> org-agenda-toggle-time-grid): Stop calling org-agenda-set-mode-name.
> (org-agenda-set-mode-name): Rewrite mode-name value using dynamic
> evaluation with :eval and other advanced format.
>
> Signed-off-by: Julien Danjou <julien@danjou.info>
> ---
> lisp/org-agenda.el |   66 +++++++++++++++++++ 
> +-------------------------------
> 1 files changed, 26 insertions(+), 40 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 20c901a..7624348 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -5936,7 +5936,6 @@ If the line does not have an effort defined,  
> return nil."
>   (let (tags)
>     (setq org-agenda-filter filter
> 	  org-agenda-filter-form (org-agenda-filter-make-matcher))
> -    (org-agenda-set-mode-name)
>     (save-excursion
>       (goto-char (point-min))
>       (while (not (eobp))
> @@ -5973,8 +5972,7 @@ If the line does not have an effort defined,  
> return nil."
>   (mapc 'delete-overlay org-agenda-filter-overlays)
>   (setq org-agenda-filter-overlays nil)
>   (setq org-agenda-filter nil)
> -  (setq org-agenda-filter-form nil)
> -  (org-agenda-set-mode-name))
> +  (setq org-agenda-filter-form nil))
>
> (defun org-agenda-manipulate-query-add ()
>   "Manipulate the query by adding a search term with positive  
> selection.
> @@ -6164,7 +6162,6 @@ SPAN may be `day', `week', `month', `year'."
> 	  (list (car org-agenda-last-arguments) sd span t)))
>     (org-agenda-redo)
>     (org-agenda-find-same-or-today-or-agenda))
> -  (org-agenda-set-mode-name)
>   (message "Switched to %s view" span))
>
> (defun org-agenda-compute-starting-span (sd span &optional n)
> @@ -6258,7 +6255,6 @@ so that the date SD will be in that range."
>   "Toggle follow mode in an agenda buffer."
>   (interactive)
>   (setq org-agenda-follow-mode (not org-agenda-follow-mode))
> -  (org-agenda-set-mode-name)
>   (if (and org-agenda-follow-mode (org-get-at-bol 'org-marker))
>       (org-agenda-show))
>   (message "Follow mode is %s"
> @@ -6274,7 +6270,6 @@ so that the date SD will be in that range."
>        (let ((org-agenda-entry-text-maxlines
> 	      (if (integerp arg) arg org-agenda-entry-text-maxlines)))
> 	 (org-agenda-entry-text-show)))
> -  (org-agenda-set-mode-name)
>   (message "Entry text mode is %s.  Maximum number of lines is %d"
> 	   (if org-agenda-entry-text-mode "on" "off")
> 	   (if (integerp arg) arg org-agenda-entry-text-maxlines)))
> @@ -6288,7 +6283,6 @@ agenda filter."
>   (if with-filter
>       (setq org-agenda-clockreport-mode 'with-filter)
>     (setq org-agenda-clockreport-mode (not org-agenda-clockreport- 
> mode)))
> -  (org-agenda-set-mode-name)
>   (org-agenda-redo)
>   (message "Clocktable mode is %s"
> 	   (if org-agenda-clockreport-mode "on" "off")))
> @@ -6305,7 +6299,6 @@ With a double `C-u' prefix arg, show *only*  
> log items, nothing else."
> 	    'only
> 	  (if special '(closed clock state)
> 	    (not org-agenda-show-log))))
> -  (org-agenda-set-mode-name)
>   (org-agenda-redo)
>   (message "Log mode is %s"
> 	   (if org-agenda-show-log "on" "off")))
> @@ -6316,7 +6309,6 @@ When called with a prefix argument, include  
> all archive files as well."
>   (interactive "P")
>   (setq org-agenda-archives-mode
> 	(if with-files t (if org-agenda-archives-mode nil 'trees)))
> -  (org-agenda-set-mode-name)
>   (org-agenda-redo)
>   (message
>    "%s"
> @@ -6335,7 +6327,6 @@ When called with a prefix argument, include  
> all archive files as well."
>   (org-agenda-check-type t 'agenda)
>   (setq org-agenda-include-diary (not org-agenda-include-diary))
>   (org-agenda-redo)
> -  (org-agenda-set-mode-name)
>   (message "Diary inclusion turned %s"
> 	   (if org-agenda-include-diary "on" "off")))
>
> @@ -6345,7 +6336,6 @@ When called with a prefix argument, include  
> all archive files as well."
>   (org-agenda-check-type t 'agenda)
>   (setq org-agenda-include-deadlines (not org-agenda-include- 
> deadlines))
>   (org-agenda-redo)
> -  (org-agenda-set-mode-name)
>   (message "Deadlines inclusion turned %s"
> 	   (if org-agenda-include-deadlines "on" "off")))
>
> @@ -6355,7 +6345,6 @@ When called with a prefix argument, include  
> all archive files as well."
>   (org-agenda-check-type t 'agenda)
>   (setq org-agenda-use-time-grid (not org-agenda-use-time-grid))
>   (org-agenda-redo)
> -  (org-agenda-set-mode-name)
>   (message "Time-grid turned %s"
> 	   (if org-agenda-use-time-grid "on" "off")))
>
> @@ -6363,36 +6352,33 @@ When called with a prefix argument, include  
> all archive files as well."
>   "Set the mode name to indicate all the small mode settings."
>   (setq mode-name
> 	(list "Org-Agenda"
> -	      (if (get 'org-agenda-files 'org-restrict) " []" "")
> +	      '(:eval (when (get 'org-agenda-files 'org-restrict) " []"))
> 	      " "
> 	      '(:eval (org-agenda-span-name org-agenda-current-span))
> -	      (if org-agenda-follow-mode     " Follow" "")
> -	      (if org-agenda-entry-text-mode " ETxt"   "")
> -	      (if org-agenda-include-diary   " Diary"  "")
> -	      (if org-agenda-include-deadlines " Ddl"  "")
> -	      (if org-agenda-use-time-grid   " Grid"   "")
> -	      (if (and (boundp 'org-habit-show-habits)
> -		       org-habit-show-habits) " Habit"   "")
> -	      (if (consp org-agenda-show-log) " LogAll"
> -		(if org-agenda-show-log " Log" ""))
> -	      (if (or org-agenda-filter (get 'org-agenda-filter
> -					     :preset-filter))
> -		  (concat " {" (mapconcat
> -				'identity
> -				(append (get 'org-agenda-filter
> -					     :preset-filter)
> -					org-agenda-filter) "") "}")
> -		"")
> -	      (if org-agenda-archives-mode
> -		  (if (eq org-agenda-archives-mode t)
> -		      " Archives"
> -		    (format " :%s:" org-archive-tag))
> -		"")
> -	      (if org-agenda-clockreport-mode
> -		  (if (eq org-agenda-clockreport-mode 'with-filter)
> -		      " Clock{}" " Clock")
> -		"")))
> -  (force-mode-line-update))
> +	      '(org-agenda-follow-mode " Follow")
> +	      '(org-agenda-entry-text-mode " ETxt")
> +	      '(org-agenda-include-diary " Diary")
> +	      '(org-agenda-include-deadlines " Ddl")
> +	      '(org-agenda-use-time-grid " Grid")
> +	      '(:eval (and (boundp 'org-habit-show-habits)
> +			   org-habit-show-habits " Habit"))
> +	      '(:eval (if (consp org-agenda-show-log) " LogAll"
> +			(if org-agenda-show-log " Log" "")))
> +	      '(:eval (when (or org-agenda-filter (get 'org-agenda-filter
> +						       :preset-filter))
> +			(concat " {" (mapconcat
> +				      'identity
> +				      (append (get 'org-agenda-filter
> +						   :preset-filter)
> +					      org-agenda-filter) "") "}")))
> +	      '(:eval (when org-agenda-archives-mode
> +			(if (eq org-agenda-archives-mode t)
> +			    " Archives"
> +			  (format " :%s:" org-archive-tag))))
> +	      '(:eval (if org-agenda-clockreport-mode
> +			  (if (eq org-agenda-clockreport-mode 'with-filter)
> +			      " Clock{}"
> +			    " Clock"))))))
>
> (defun org-agenda-post-command-hook ()
>   (setq org-agenda-type
> -- 
> 1.7.2.3
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] org-agenda: rewrite mode-line
  2010-12-12  8:32 ` Carsten Dominik
@ 2010-12-12 18:55   ` Julien Danjou
  2010-12-13 14:49     ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Julien Danjou @ 2010-12-12 18:55 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 518 bytes --]

On Sun, Dec 12 2010, Carsten Dominik wrote:

> what is the purpose of this patch, why is it needed?
> I generally will not accept patches that lack this information.

Sorry, it seems quite obvious to me.

The purpose is to stop trying to guess where to call the function to
`org-agenda-set-mode-name' whenever one of the value change used in that
function changes.

This is probably one of the reason why :eval property has been invented,
I guess. :-)

-- 
Julien Danjou
❱ http://julien.danjou.info

[-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] org-agenda: rewrite mode-line
  2010-12-12 18:55   ` Julien Danjou
@ 2010-12-13 14:49     ` Carsten Dominik
  2010-12-21  7:36       ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2010-12-13 14:49 UTC (permalink / raw)
  To: Julien Danjou; +Cc: emacs-orgmode

XEmacs users, please read this.

On Dec 12, 2010, at 7:55 PM, Julien Danjou wrote:

> On Sun, Dec 12 2010, Carsten Dominik wrote:
>
>> what is the purpose of this patch, why is it needed?
>> I generally will not accept patches that lack this information.
>
> Sorry, it seems quite obvious to me.

Hi Julien,

even if it is more or less obvious on closer
study, I am trying to create a useful history of
the project by providing additional information
at commit time.  And knowing the intend of the author
speeds up classifying and judging the patch very much.
I have not spent some 20 Minutes looking at it and
writing to you and looking at it again....

The patch looks good to me, I am planning to accept
it after studying it closer.

Does anyone know if :eval in the mode line specification
is XEmacs compatible?

- Carsten

>
> The purpose is to stop trying to guess where to call the function to
> `org-agenda-set-mode-name' whenever one of the value change used in  
> that
> function changes.
>
> This is probably one of the reason why :eval property has been  
> invented,
> I guess. :-)
>
> -- 
> Julien Danjou
> ❱ http://julien.danjou.info

- Carsten

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] org-agenda: rewrite mode-line
  2010-12-13 14:49     ` Carsten Dominik
@ 2010-12-21  7:36       ` Carsten Dominik
  2010-12-21  8:53         ` Michael Sperber
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2010-12-21  7:36 UTC (permalink / raw)
  Cc: Julien Danjou, Michael Sperber, Org Mode

Hi XEmacs users

I am about to apply this patch, but I am still wondering
if :eval in the mode line is working on XEmacs?


- Carsten

On Dec 13, 2010, at 3:49 PM, Carsten Dominik wrote:

> XEmacs users, please read this.
>
> On Dec 12, 2010, at 7:55 PM, Julien Danjou wrote:
>
>> On Sun, Dec 12 2010, Carsten Dominik wrote:
>>
>>> what is the purpose of this patch, why is it needed?
>>> I generally will not accept patches that lack this information.
>>
>> Sorry, it seems quite obvious to me.
>
> Hi Julien,
>
> even if it is more or less obvious on closer
> study, I am trying to create a useful history of
> the project by providing additional information
> at commit time.  And knowing the intend of the author
> speeds up classifying and judging the patch very much.
> I have not spent some 20 Minutes looking at it and
> writing to you and looking at it again....
>
> The patch looks good to me, I am planning to accept
> it after studying it closer.
>
> Does anyone know if :eval in the mode line specification
> is XEmacs compatible?
>
> - Carsten
>
>>
>> The purpose is to stop trying to guess where to call the function to
>> `org-agenda-set-mode-name' whenever one of the value change used in  
>> that
>> function changes.
>>
>> This is probably one of the reason why :eval property has been  
>> invented,
>> I guess. :-)
>>
>> -- 
>> Julien Danjou
>> ❱ http://julien.danjou.info
>
> - Carsten
>
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] org-agenda: rewrite mode-line
  2010-12-21  7:36       ` Carsten Dominik
@ 2010-12-21  8:53         ` Michael Sperber
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Sperber @ 2010-12-21  8:53 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Julien Danjou, Org Mode


Carsten Dominik <carsten.dominik@gmail.com> writes:

> Hi XEmacs users
>
> I am about to apply this patch, but I am still wondering
> if :eval in the mode line is working on XEmacs?

Sorry, missed that one: XEmacs does not currently have :eval.  This
might be a good reason to add it to XEmacs, but it would probably take
me a few weeks - I'm totally swamped right now.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] org-agenda: rewrite mode-line
  2010-12-06 15:41 [PATCH] org-agenda: rewrite mode-line Julien Danjou
  2010-12-12  8:32 ` Carsten Dominik
@ 2011-01-21  9:25 ` Carsten Dominik
  2011-03-04 22:09   ` Bastien
  1 sibling, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2011-01-21  9:25 UTC (permalink / raw)
  To: Julien Danjou; +Cc: Michael Sperber, Org Mode

Hi Julien,

I like the patch, but since it is not critical it remains
on ice until :eval is supported by XEmacs.

Michael, it would be nice if you could put :eval into
XEmacs so that we can use this improved code for the
mode line.  Please make sure to let us know when this is done.

- Carsten

On Dec 6, 2010, at 4:41 PM, Julien Danjou wrote:

> * org-agenda.el (org-agenda-filter-apply)
> (org-agenda-filter-by-tag-show-all) (org-agenda-change-time-span)
> (org-remove-subtree-entries-from-agenda) (org-agenda-entry-text-mode,
> org-agenda-clockreport-mode) (org-agenda-toggle-diary,
> org-agenda-archives-mode) (org-agenda-toggle-deadlines,
> org-agenda-toggle-time-grid): Stop calling org-agenda-set-mode-name.
> (org-agenda-set-mode-name): Rewrite mode-name value using dynamic
> evaluation with :eval and other advanced format.
>
> Signed-off-by: Julien Danjou <julien@danjou.info>
> ---
> lisp/org-agenda.el |   66 +++++++++++++++++++ 
> +-------------------------------
> 1 files changed, 26 insertions(+), 40 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 20c901a..7624348 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -5936,7 +5936,6 @@ If the line does not have an effort defined,  
> return nil."
>   (let (tags)
>     (setq org-agenda-filter filter
> 	  org-agenda-filter-form (org-agenda-filter-make-matcher))
> -    (org-agenda-set-mode-name)
>     (save-excursion
>       (goto-char (point-min))
>       (while (not (eobp))
> @@ -5973,8 +5972,7 @@ If the line does not have an effort defined,  
> return nil."
>   (mapc 'delete-overlay org-agenda-filter-overlays)
>   (setq org-agenda-filter-overlays nil)
>   (setq org-agenda-filter nil)
> -  (setq org-agenda-filter-form nil)
> -  (org-agenda-set-mode-name))
> +  (setq org-agenda-filter-form nil))
>
> (defun org-agenda-manipulate-query-add ()
>   "Manipulate the query by adding a search term with positive  
> selection.
> @@ -6164,7 +6162,6 @@ SPAN may be `day', `week', `month', `year'."
> 	  (list (car org-agenda-last-arguments) sd span t)))
>     (org-agenda-redo)
>     (org-agenda-find-same-or-today-or-agenda))
> -  (org-agenda-set-mode-name)
>   (message "Switched to %s view" span))
>
> (defun org-agenda-compute-starting-span (sd span &optional n)
> @@ -6258,7 +6255,6 @@ so that the date SD will be in that range."
>   "Toggle follow mode in an agenda buffer."
>   (interactive)
>   (setq org-agenda-follow-mode (not org-agenda-follow-mode))
> -  (org-agenda-set-mode-name)
>   (if (and org-agenda-follow-mode (org-get-at-bol 'org-marker))
>       (org-agenda-show))
>   (message "Follow mode is %s"
> @@ -6274,7 +6270,6 @@ so that the date SD will be in that range."
>        (let ((org-agenda-entry-text-maxlines
> 	      (if (integerp arg) arg org-agenda-entry-text-maxlines)))
> 	 (org-agenda-entry-text-show)))
> -  (org-agenda-set-mode-name)
>   (message "Entry text mode is %s.  Maximum number of lines is %d"
> 	   (if org-agenda-entry-text-mode "on" "off")
> 	   (if (integerp arg) arg org-agenda-entry-text-maxlines)))
> @@ -6288,7 +6283,6 @@ agenda filter."
>   (if with-filter
>       (setq org-agenda-clockreport-mode 'with-filter)
>     (setq org-agenda-clockreport-mode (not org-agenda-clockreport- 
> mode)))
> -  (org-agenda-set-mode-name)
>   (org-agenda-redo)
>   (message "Clocktable mode is %s"
> 	   (if org-agenda-clockreport-mode "on" "off")))
> @@ -6305,7 +6299,6 @@ With a double `C-u' prefix arg, show *only*  
> log items, nothing else."
> 	    'only
> 	  (if special '(closed clock state)
> 	    (not org-agenda-show-log))))
> -  (org-agenda-set-mode-name)
>   (org-agenda-redo)
>   (message "Log mode is %s"
> 	   (if org-agenda-show-log "on" "off")))
> @@ -6316,7 +6309,6 @@ When called with a prefix argument, include  
> all archive files as well."
>   (interactive "P")
>   (setq org-agenda-archives-mode
> 	(if with-files t (if org-agenda-archives-mode nil 'trees)))
> -  (org-agenda-set-mode-name)
>   (org-agenda-redo)
>   (message
>    "%s"
> @@ -6335,7 +6327,6 @@ When called with a prefix argument, include  
> all archive files as well."
>   (org-agenda-check-type t 'agenda)
>   (setq org-agenda-include-diary (not org-agenda-include-diary))
>   (org-agenda-redo)
> -  (org-agenda-set-mode-name)
>   (message "Diary inclusion turned %s"
> 	   (if org-agenda-include-diary "on" "off")))
>
> @@ -6345,7 +6336,6 @@ When called with a prefix argument, include  
> all archive files as well."
>   (org-agenda-check-type t 'agenda)
>   (setq org-agenda-include-deadlines (not org-agenda-include- 
> deadlines))
>   (org-agenda-redo)
> -  (org-agenda-set-mode-name)
>   (message "Deadlines inclusion turned %s"
> 	   (if org-agenda-include-deadlines "on" "off")))
>
> @@ -6355,7 +6345,6 @@ When called with a prefix argument, include  
> all archive files as well."
>   (org-agenda-check-type t 'agenda)
>   (setq org-agenda-use-time-grid (not org-agenda-use-time-grid))
>   (org-agenda-redo)
> -  (org-agenda-set-mode-name)
>   (message "Time-grid turned %s"
> 	   (if org-agenda-use-time-grid "on" "off")))
>
> @@ -6363,36 +6352,33 @@ When called with a prefix argument, include  
> all archive files as well."
>   "Set the mode name to indicate all the small mode settings."
>   (setq mode-name
> 	(list "Org-Agenda"
> -	      (if (get 'org-agenda-files 'org-restrict) " []" "")
> +	      '(:eval (when (get 'org-agenda-files 'org-restrict) " []"))
> 	      " "
> 	      '(:eval (org-agenda-span-name org-agenda-current-span))
> -	      (if org-agenda-follow-mode     " Follow" "")
> -	      (if org-agenda-entry-text-mode " ETxt"   "")
> -	      (if org-agenda-include-diary   " Diary"  "")
> -	      (if org-agenda-include-deadlines " Ddl"  "")
> -	      (if org-agenda-use-time-grid   " Grid"   "")
> -	      (if (and (boundp 'org-habit-show-habits)
> -		       org-habit-show-habits) " Habit"   "")
> -	      (if (consp org-agenda-show-log) " LogAll"
> -		(if org-agenda-show-log " Log" ""))
> -	      (if (or org-agenda-filter (get 'org-agenda-filter
> -					     :preset-filter))
> -		  (concat " {" (mapconcat
> -				'identity
> -				(append (get 'org-agenda-filter
> -					     :preset-filter)
> -					org-agenda-filter) "") "}")
> -		"")
> -	      (if org-agenda-archives-mode
> -		  (if (eq org-agenda-archives-mode t)
> -		      " Archives"
> -		    (format " :%s:" org-archive-tag))
> -		"")
> -	      (if org-agenda-clockreport-mode
> -		  (if (eq org-agenda-clockreport-mode 'with-filter)
> -		      " Clock{}" " Clock")
> -		"")))
> -  (force-mode-line-update))
> +	      '(org-agenda-follow-mode " Follow")
> +	      '(org-agenda-entry-text-mode " ETxt")
> +	      '(org-agenda-include-diary " Diary")
> +	      '(org-agenda-include-deadlines " Ddl")
> +	      '(org-agenda-use-time-grid " Grid")
> +	      '(:eval (and (boundp 'org-habit-show-habits)
> +			   org-habit-show-habits " Habit"))
> +	      '(:eval (if (consp org-agenda-show-log) " LogAll"
> +			(if org-agenda-show-log " Log" "")))
> +	      '(:eval (when (or org-agenda-filter (get 'org-agenda-filter
> +						       :preset-filter))
> +			(concat " {" (mapconcat
> +				      'identity
> +				      (append (get 'org-agenda-filter
> +						   :preset-filter)
> +					      org-agenda-filter) "") "}")))
> +	      '(:eval (when org-agenda-archives-mode
> +			(if (eq org-agenda-archives-mode t)
> +			    " Archives"
> +			  (format " :%s:" org-archive-tag))))
> +	      '(:eval (if org-agenda-clockreport-mode
> +			  (if (eq org-agenda-clockreport-mode 'with-filter)
> +			      " Clock{}"
> +			    " Clock"))))))
>
> (defun org-agenda-post-command-hook ()
>   (setq org-agenda-type
> -- 
> 1.7.2.3
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] org-agenda: rewrite mode-line
  2011-01-21  9:25 ` Carsten Dominik
@ 2011-03-04 22:09   ` Bastien
  2011-03-05 10:12     ` Michael Sperber
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2011-03-04 22:09 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Julien Danjou, Org Mode, Michael Sperber

Hi,

Carsten Dominik <carsten.dominik@gmail.com> writes:

> I like the patch, but since it is not critical it remains
> on ice until :eval is supported by XEmacs.
>
> Michael, it would be nice if you could put :eval into
> XEmacs so that we can use this improved code for the
> mode line.  Please make sure to let us know when this is done.

Michael, did you had time to progress on this?  

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] org-agenda: rewrite mode-line
  2011-03-04 22:09   ` Bastien
@ 2011-03-05 10:12     ` Michael Sperber
  2011-03-05 10:50       ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Sperber @ 2011-03-05 10:12 UTC (permalink / raw)
  To: Bastien; +Cc: Julien Danjou, Org Mode, Carsten Dominik


Bastien <bzg@altern.org> writes:

> Hi,
>
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> I like the patch, but since it is not critical it remains
>> on ice until :eval is supported by XEmacs.
>>
>> Michael, it would be nice if you could put :eval into
>> XEmacs so that we can use this improved code for the
>> mode line.  Please make sure to let us know when this is done.
>
> Michael, did you had time to progress on this?  

Not yet.  But it is on my list.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [PATCH] org-agenda: rewrite mode-line
  2011-03-05 10:12     ` Michael Sperber
@ 2011-03-05 10:50       ` Bastien
  0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2011-03-05 10:50 UTC (permalink / raw)
  To: Michael Sperber; +Cc: Julien Danjou, Org Mode, Carsten Dominik

Hi Michael,

Michael Sperber <sperber@deinprogramm.de> writes:

>> Michael, did you had time to progress on this?  
>
> Not yet.  But it is on my list.

Good - thanks for the update!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-03-05 10:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-06 15:41 [PATCH] org-agenda: rewrite mode-line Julien Danjou
2010-12-12  8:32 ` Carsten Dominik
2010-12-12 18:55   ` Julien Danjou
2010-12-13 14:49     ` Carsten Dominik
2010-12-21  7:36       ` Carsten Dominik
2010-12-21  8:53         ` Michael Sperber
2011-01-21  9:25 ` Carsten Dominik
2011-03-04 22:09   ` Bastien
2011-03-05 10:12     ` Michael Sperber
2011-03-05 10:50       ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).