From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] org-agenda: rewrite mode-line Date: Sun, 12 Dec 2010 09:32:52 +0100 Message-ID: <82D9D8F0-A957-43BD-94C6-80F5620E7257@gmail.com> References: <1291650119-13804-1-git-send-email-julien@danjou.info> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=43289 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRhMa-0002fn-0o for emacs-orgmode@gnu.org; Sun, 12 Dec 2010 03:33:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PRhMY-0004wa-Fp for emacs-orgmode@gnu.org; Sun, 12 Dec 2010 03:32:59 -0500 Received: from mail-ey0-f177.google.com ([209.85.215.177]:44479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PRhMY-0004wP-7m for emacs-orgmode@gnu.org; Sun, 12 Dec 2010 03:32:58 -0500 Received: by eyd9 with SMTP id 9so4406434eyd.36 for ; Sun, 12 Dec 2010 00:32:57 -0800 (PST) In-Reply-To: <1291650119-13804-1-git-send-email-julien@danjou.info> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Julien Danjou Cc: emacs-orgmode@gnu.org 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 > --- > 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