From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: [bug] org-habit-show-all-today undefined Date: Tue, 29 May 2012 13:07:31 +0930 Message-ID: <87likbslms.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZDFV-00034t-RZ for emacs-orgmode@gnu.org; Mon, 28 May 2012 23:37:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SZDFS-0007Mh-TA for emacs-orgmode@gnu.org; Mon, 28 May 2012 23:37:33 -0400 Received: from am1ehsobe001.messaging.microsoft.com ([213.199.154.204]:32096 helo=am1outboundpool.messaging.microsoft.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZDFS-0007Lt-Cn for emacs-orgmode@gnu.org; Mon, 28 May 2012 23:37:30 -0400 Received: from mail46-am1 (localhost [127.0.0.1]) by mail46-am1-R.bigfish.com (Postfix) with ESMTP id 677474A0249 for ; Tue, 29 May 2012 03:37:06 +0000 (UTC) Received: from AM1EHSMHS018.bigfish.com (unknown [10.3.201.236]) by mail46-am1.bigfish.com (Postfix) with ESMTP id D18CE4E008A for ; Tue, 29 May 2012 03:37:03 +0000 (UTC) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org With the most recent update to org, ,---- | Author: Max Mikhanosha | Date: Mon May 28 14:55:32 2012 -0400 |=20 | Add ability to show all (even unscheduled) habits on today agenda, by | setting `org-habit-show-all-today' to t. |=20=20=20=20=20 | * lisp/org-agenda.el (defvar org-habit-show-all-today): new variable | (org-agenda-get-scheduled): show all habits if user wants it | * lisp/org-habit.el (defcustom org-habit-show-all-today): new variable `---- 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) | (and todayp org-habit-show-all-today (setq did-habit-check-p t) (setq h= abitp (and (functionp (quote org-is-habit-p)) (org-is-habit-p)))) | (or (and (< diff 0) (< (abs diff) org-scheduled-past-days) (and todayp = (not org-agenda-only-exact-dates))) (=3D diff 0) (and todayp org-habit-show= -all-today (setq did-habit-check-p t) (setq habitp (and (functionp (quote o= rg-is-habit-p)) (org-is-habit-p))))) | (if (or (and (< diff 0) (< (abs diff) org-scheduled-past-days) (and tod= ayp (not org-agenda-only-exact-dates))) (=3D diff 0) (and todayp org-habit-= show-all-today (setq did-habit-check-p t) (setq habitp (and (functionp (quo= te org-is-habit-p)) (org-is-habit-p))))) (progn (save-excursion (setq donep= (member todo-state org-done-keywords)) (if (and donep (or org-agenda-skip-= scheduled-if-done (not (=3D diff 0)) (and (functionp ...) (org-is-habit-p))= )) (setq txt nil) (setq habitp (if did-habit-check-p habitp (and (functionp= ...) (org-is-habit-p)))) (setq category (org-get-category) org-category-po= s (get-text-property (point) (quote org-category-position))) (if (not (re-s= earch-backward "^\\*+[ ]+" nil t)) (setq txt org-agenda-no-heading-message= ) (goto-char (match-end 0)) (setq pos1 (match-beginning 0)) (if habitp (if = (or ... ...) (throw :skip nil)) (if (and ... ...) (throw :skip nil))) (setq= tags (org-get-tags-at)) (setq head (buffer-substring-no-properties (point)= (progn ... ...))) (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s) (se= tq timestr (concat ... " ")) (setq timestr (quote time))) (setq txt (org-ag= enda-format-item (if ... ... ...) head category tags (if ... nil timestr) n= il habitp)))) (when txt (setq face (cond ((and ... pastschedp) (quote org-s= cheduled-previously)) (todayp (quote org-scheduled-today)) (t (quote org-sc= heduled))) habitp (and habitp (org-habit-parse-todo))) (org-add-props txt p= rops (quote undone-face) face (quote face) (if donep (quote org-agenda-done= ) face) (quote org-marker) (org-agenda-new-marker pos) (quote org-hd-marker= ) (org-agenda-new-marker pos1) (quote type) (if pastschedp "past-scheduled"= "scheduled") (quote date) (if pastschedp d2 date) (quote priority) (if hab= itp (org-habit-get-priority habitp) (+ 94 (- 5 diff) (org-get-priority txt)= )) (quote org-category) category (quote org-category-position) org-category= -pos (quote org-habit-p) habitp (quote todo-state) todo-state) (push txt ee= ))))) | (when (or (and (< diff 0) (< (abs diff) org-scheduled-past-days) (and t= odayp (not org-agenda-only-exact-dates))) (=3D diff 0) (and todayp org-habi= t-show-all-today (setq did-habit-check-p t) (setq habitp (and (functionp (q= uote org-is-habit-p)) (org-is-habit-p))))) (save-excursion (setq donep (mem= ber todo-state org-done-keywords)) (if (and donep (or org-agenda-skip-sched= uled-if-done (not (=3D diff 0)) (and (functionp (quote org-is-habit-p)) (or= g-is-habit-p)))) (setq txt nil) (setq habitp (if did-habit-check-p habitp (= and (functionp (quote org-is-habit-p)) (org-is-habit-p)))) (setq category (= org-get-category) org-category-pos (get-text-property (point) (quote org-ca= tegory-position))) (if (not (re-search-backward "^\\*+[ ]+" nil t)) (setq = txt org-agenda-no-heading-message) (goto-char (match-end 0)) (setq pos1 (ma= tch-beginning 0)) (if habitp (if (or (not org-habit-show-habits) (and ... o= rg-habit-show-habits-only-for-today)) (throw :skip nil)) (if (and (or ... .= ..) (setq mm ...)) (throw :skip nil))) (setq tags (org-get-tags-at)) (setq = head (buffer-substring-no-properties (point) (progn (skip-chars-forward "^\= n") (point)))) (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s) (setq t= imestr (concat (substring s ...) " ")) (setq timestr (quote time))) (setq t= xt (org-agenda-format-item (if (=3D diff 0) (car org-agenda-scheduled-leade= rs) (format ... ...)) head category tags (if (not ...) nil timestr) nil hab= itp)))) (when txt (setq face (cond ((and (not habitp) pastschedp) (quote or= g-scheduled-previously)) (todayp (quote org-scheduled-today)) (t (quote org= -scheduled))) habitp (and habitp (org-habit-parse-todo))) (org-add-props tx= t props (quote undone-face) face (quote face) (if donep (quote org-agenda-d= one) face) (quote org-marker) (org-agenda-new-marker pos) (quote org-hd-mar= ker) (org-agenda-new-marker pos1) (quote type) (if pastschedp "past-schedul= ed" "scheduled") (quote date) (if pastschedp d2 date) (quote priority) (if = habitp (org-habit-get-priority habitp) (+ 94 (- 5 diff) (org-get-priority t= xt))) (quote org-category) category (quote org-category-position) org-categ= ory-pos (quote org-habit-p) habitp (quote todo-state) todo-state) (push txt= ee)))) | (catch :skip (org-agenda-skip) (setq s (match-string 1) txt nil pos (1-= (match-beginning 1)) todo-state (save-match-data (org-get-todo-state)) sho= w-all (or (eq org-agenda-repeating-timestamp-show-all t) (member todo-state= org-agenda-repeating-timestamp-show-all)) d2 (org-time-string-to-absolute = (match-string 1) d1 (quote past) show-all (current-buffer) pos) diff (- d2 = d1)) (setq pastschedp (and todayp (< diff 0))) (setq did-habit-check-p nil)= (when (or (and (< diff 0) (< (abs diff) org-scheduled-past-days) (and toda= yp (not org-agenda-only-exact-dates))) (=3D diff 0) (and todayp org-habit-s= how-all-today (setq did-habit-check-p t) (setq habitp (and (functionp (quot= e org-is-habit-p)) (org-is-habit-p))))) (save-excursion (setq donep (member= todo-state org-done-keywords)) (if (and donep (or org-agenda-skip-schedule= d-if-done (not (=3D diff 0)) (and (functionp ...) (org-is-habit-p)))) (setq= txt nil) (setq habitp (if did-habit-check-p habitp (and (functionp ...) (o= rg-is-habit-p)))) (setq category (org-get-category) org-category-pos (get-t= ext-property (point) (quote org-category-position))) (if (not (re-search-ba= ckward "^\\*+[ ]+" nil t)) (setq txt org-agenda-no-heading-message) (goto-= char (match-end 0)) (setq pos1 (match-beginning 0)) (if habitp (if (or ... = ...) (throw :skip nil)) (if (and ... ...) (throw :skip nil))) (setq tags (o= rg-get-tags-at)) (setq head (buffer-substring-no-properties (point) (progn = ... ...))) (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s) (setq times= tr (concat ... " ")) (setq timestr (quote time))) (setq txt (org-agenda-for= mat-item (if ... ... ...) head category tags (if ... nil timestr) nil habit= p)))) (when txt (setq face (cond ((and ... pastschedp) (quote org-scheduled= -previously)) (todayp (quote org-scheduled-today)) (t (quote org-scheduled)= )) habitp (and habitp (org-habit-parse-todo))) (org-add-props txt props (qu= ote undone-face) face (quote face) (if donep (quote org-agenda-done) face) = (quote org-marker) (org-agenda-new-marker pos) (quote org-hd-marker) (org-a= genda-new-marker pos1) (quote type) (if pastschedp "past-scheduled" "schedu= led") (quote date) (if pastschedp d2 date) (quote priority) (if habitp (org= -habit-get-priority habitp) (+ 94 (- 5 diff) (org-get-priority txt))) (quot= e org-category) category (quote org-category-position) org-category-pos (qu= ote org-habit-p) habitp (quote todo-state) todo-state) (push txt ee))))) | (while (re-search-forward regexp nil t) (catch :skip (org-agenda-skip) = (setq s (match-string 1) txt nil pos (1- (match-beginning 1)) todo-state (s= ave-match-data (org-get-todo-state)) show-all (or (eq org-agenda-repeating-= timestamp-show-all t) (member todo-state org-agenda-repeating-timestamp-sho= w-all)) d2 (org-time-string-to-absolute (match-string 1) d1 (quote past) sh= ow-all (current-buffer) pos) diff (- d2 d1)) (setq pastschedp (and todayp (= < diff 0))) (setq did-habit-check-p nil) (when (or (and (< diff 0) (< (abs = diff) org-scheduled-past-days) (and todayp (not org-agenda-only-exact-dates= ))) (=3D diff 0) (and todayp org-habit-show-all-today (setq did-habit-check= -p t) (setq habitp (and (functionp ...) (org-is-habit-p))))) (save-excursio= n (setq donep (member todo-state org-done-keywords)) (if (and donep (or org= -agenda-skip-scheduled-if-done (not ...) (and ... ...))) (setq txt nil) (se= tq habitp (if did-habit-check-p habitp (and ... ...))) (setq category (org-= get-category) org-category-pos (get-text-property (point) (quote org-catego= ry-position))) (if (not (re-search-backward "^\\*+[ ]+" nil t)) (setq txt = org-agenda-no-heading-message) (goto-char (match-end 0)) (setq pos1 (match-= beginning 0)) (if habitp (if ... ...) (if ... ...)) (setq tags (org-get-tag= s-at)) (setq head (buffer-substring-no-properties ... ...)) (if (string-mat= ch " \\([012]?[0-9]:[0-9][0-9]\\)" s) (setq timestr ...) (setq timestr ...)= ) (setq txt (org-agenda-format-item ... head category tags ... nil habitp))= )) (when txt (setq face (cond (... ...) (todayp ...) (t ...)) habitp (and h= abitp (org-habit-parse-todo))) (org-add-props txt props (quote undone-face)= face (quote face) (if donep (quote org-agenda-done) face) (quote org-marke= r) (org-agenda-new-marker pos) (quote org-hd-marker) (org-agenda-new-marker= pos1) (quote type) (if pastschedp "past-scheduled" "scheduled") (quote dat= e) (if pastschedp d2 date) (quote priority) (if habitp (org-habit-get-prior= ity habitp) (+ 94 ... ...)) (quote org-category) category (quote org-catego= ry-position) org-category-pos (quote org-habit-p) habitp (quote todo-state)= todo-state) (push txt ee)))))) | (let* ((props (list (quote org-not-done-regexp) org-not-done-regexp (qu= ote org-todo-regexp) org-todo-regexp (quote org-complex-heading-regexp) org= -complex-heading-regexp (quote done-face) (quote org-agenda-done) (quote mo= use-face) (quote highlight) (quote help-echo) (format "mouse-2 or RET jump = to org file %s" (abbreviate-file-name buffer-file-name)))) (regexp org-sche= duled-time-regexp) (todayp (org-agenda-todayp date)) (d1 (calendar-absolute= -from-gregorian date)) mm (deadline-position-alist (mapcar (lambda (a) (and= (setq mm (get-text-property 0 ... a)) (cons (marker-position mm) a))) dead= line-results)) d2 diff pos pos1 category org-category-pos tags donep ee txt= head pastschedp todo-state face timestr s habitp show-all did-habit-check-= p) (goto-char (point-min)) (while (re-search-forward regexp nil t) (catch := skip (org-agenda-skip) (setq s (match-string 1) txt nil pos (1- (match-begi= nning 1)) todo-state (save-match-data (org-get-todo-state)) show-all (or (e= q org-agenda-repeating-timestamp-show-all t) (member todo-state org-agenda-= repeating-timestamp-show-all)) d2 (org-time-string-to-absolute (match-strin= g 1) d1 (quote past) show-all (current-buffer) pos) diff (- d2 d1)) (setq p= astschedp (and todayp (< diff 0))) (setq did-habit-check-p nil) (when (or (= and (< diff 0) (< (abs diff) org-scheduled-past-days) (and todayp (not org-= agenda-only-exact-dates))) (=3D diff 0) (and todayp org-habit-show-all-toda= y (setq did-habit-check-p t) (setq habitp (and ... ...)))) (save-excursion = (setq donep (member todo-state org-done-keywords)) (if (and donep (or org-a= genda-skip-scheduled-if-done ... ...)) (setq txt nil) (setq habitp (if did-= habit-check-p habitp ...)) (setq category (org-get-category) org-category-p= os (get-text-property ... ...)) (if (not ...) (setq txt org-agenda-no-headi= ng-message) (goto-char ...) (setq pos1 ...) (if habitp ... ...) (setq tags = ...) (setq head ...) (if ... ... ...) (setq txt ...))) (when txt (setq face= (cond ... ... ...) habitp (and habitp ...)) (org-add-props txt props (quot= e undone-face) face (quote face) (if donep ... face) (quote org-marker) (or= g-agenda-new-marker pos) (quote org-hd-marker) (org-agenda-new-marker pos1)= (quote type) (if pastschedp "past-scheduled" "scheduled") (quote date) (if= pastschedp d2 date) (quote priority) (if habitp ... ...) (quote org-catego= ry) category (quote org-category-position) org-category-pos (quote org-habi= t-p) habitp (quote todo-state) todo-state) (push txt ee)))))) (nreverse ee)) | org-agenda-get-scheduled(nil) | (setq rtn (org-agenda-get-scheduled deadline-results)) | (cond ((and (eq arg :todo) (equal date (calendar-gregorian-from-absolut= e (org-today)))) (setq rtn (org-agenda-get-todos)) (setq results (append re= sults rtn))) ((eq arg :timestamp) (setq rtn (org-agenda-get-blocks)) (setq = results (append results rtn)) (setq rtn (org-agenda-get-timestamps deadline= -results)) (setq results (append results rtn))) ((eq arg :sexp) (setq rtn (= org-agenda-get-sexps)) (setq results (append results rtn))) ((eq arg :sched= uled) (setq rtn (org-agenda-get-scheduled deadline-results)) (setq results = (append results rtn))) ((eq arg :closed) (setq rtn (org-agenda-get-progress= )) (setq results (append results rtn))) ((eq arg :deadline) (setq rtn (org-= agenda-get-deadlines)) (setq deadline-results (copy-sequence rtn)) (setq re= sults (append results rtn)))) | (while (setq arg (pop args)) (cond ((and (eq arg :todo) (equal date (ca= lendar-gregorian-from-absolute (org-today)))) (setq rtn (org-agenda-get-tod= os)) (setq results (append results rtn))) ((eq arg :timestamp) (setq rtn (o= rg-agenda-get-blocks)) (setq results (append results rtn)) (setq rtn (org-a= genda-get-timestamps deadline-results)) (setq results (append results rtn))= ) ((eq arg :sexp) (setq rtn (org-agenda-get-sexps)) (setq results (append r= esults rtn))) ((eq arg :scheduled) (setq rtn (org-agenda-get-scheduled dead= line-results)) (setq results (append results rtn))) ((eq arg :closed) (setq= rtn (org-agenda-get-progress)) (setq results (append results rtn))) ((eq a= rg :deadline) (setq rtn (org-agenda-get-deadlines)) (setq deadline-results = (copy-sequence rtn)) (setq results (append results rtn))))) | (save-restriction (if org-agenda-restrict (narrow-to-region org-agenda-= restrict-begin org-agenda-restrict-end) (widen)) (while (setq arg (pop args= )) (cond ((and (eq arg :todo) (equal date (calendar-gregorian-from-absolute= (org-today)))) (setq rtn (org-agenda-get-todos)) (setq results (append res= ults rtn))) ((eq arg :timestamp) (setq rtn (org-agenda-get-blocks)) (setq r= esults (append results rtn)) (setq rtn (org-agenda-get-timestamps deadline-= results)) (setq results (append results rtn))) ((eq arg :sexp) (setq rtn (o= rg-agenda-get-sexps)) (setq results (append results rtn))) ((eq arg :schedu= led) (setq rtn (org-agenda-get-scheduled deadline-results)) (setq results (= append results rtn))) ((eq arg :closed) (setq rtn (org-agenda-get-progress)= ) (setq results (append results rtn))) ((eq arg :deadline) (setq rtn (org-a= genda-get-deadlines)) (setq deadline-results (copy-sequence rtn)) (setq res= ults (append results rtn)))))) | (save-excursion (save-restriction (if org-agenda-restrict (narrow-to-re= gion org-agenda-restrict-begin org-agenda-restrict-end) (widen)) (while (se= tq arg (pop args)) (cond ((and (eq arg :todo) (equal date (calendar-gregori= an-from-absolute ...))) (setq rtn (org-agenda-get-todos)) (setq results (ap= pend results rtn))) ((eq arg :timestamp) (setq rtn (org-agenda-get-blocks))= (setq results (append results rtn)) (setq rtn (org-agenda-get-timestamps d= eadline-results)) (setq results (append results rtn))) ((eq arg :sexp) (set= q rtn (org-agenda-get-sexps)) (setq results (append results rtn))) ((eq arg= :scheduled) (setq rtn (org-agenda-get-scheduled deadline-results)) (setq r= esults (append results rtn))) ((eq arg :closed) (setq rtn (org-agenda-get-p= rogress)) (setq results (append results rtn))) ((eq arg :deadline) (setq rt= n (org-agenda-get-deadlines)) (setq deadline-results (copy-sequence rtn)) (= setq results (append results rtn))))))) | (let ((case-fold-search nil)) (save-excursion (save-restriction (if org= -agenda-restrict (narrow-to-region org-agenda-restrict-begin org-agenda-res= trict-end) (widen)) (while (setq arg (pop args)) (cond ((and (eq arg :todo)= (equal date ...)) (setq rtn (org-agenda-get-todos)) (setq results (append = results rtn))) ((eq arg :timestamp) (setq rtn (org-agenda-get-blocks)) (set= q results (append results rtn)) (setq rtn (org-agenda-get-timestamps deadli= ne-results)) (setq results (append results rtn))) ((eq arg :sexp) (setq rtn= (org-agenda-get-sexps)) (setq results (append results rtn))) ((eq arg :sch= eduled) (setq rtn (org-agenda-get-scheduled deadline-results)) (setq result= s (append results rtn))) ((eq arg :closed) (setq rtn (org-agenda-get-progre= ss)) (setq results (append results rtn))) ((eq arg :deadline) (setq rtn (or= g-agenda-get-deadlines)) (setq deadline-results (copy-sequence rtn)) (setq = results (append results rtn)))))))) | (save-current-buffer (set-buffer buffer) (unless (derived-mode-p (quote= org-mode)) (error "Agenda file %s is not in `org-mode'" file)) (let ((case= -fold-search nil)) (save-excursion (save-restriction (if org-agenda-restric= t (narrow-to-region org-agenda-restrict-begin org-agenda-restrict-end) (wid= en)) (while (setq arg (pop args)) (cond ((and ... ...) (setq rtn ...) (setq= results ...)) ((eq arg :timestamp) (setq rtn ...) (setq results ...) (setq= rtn ...) (setq results ...)) ((eq arg :sexp) (setq rtn ...) (setq results = ...)) ((eq arg :scheduled) (setq rtn ...) (setq results ...)) ((eq arg :clo= sed) (setq rtn ...) (setq results ...)) ((eq arg :deadline) (setq rtn ...) = (setq deadline-results ...) (setq results ...))))))) results) | (with-current-buffer buffer (unless (derived-mode-p (quote org-mode)) (= error "Agenda file %s is not in `org-mode'" file)) (let ((case-fold-search = nil)) (save-excursion (save-restriction (if org-agenda-restrict (narrow-to-= region org-agenda-restrict-begin org-agenda-restrict-end) (widen)) (while (= setq arg (pop args)) (cond ((and ... ...) (setq rtn ...) (setq results ...)= ) ((eq arg :timestamp) (setq rtn ...) (setq results ...) (setq rtn ...) (se= tq results ...)) ((eq arg :sexp) (setq rtn ...) (setq results ...)) ((eq ar= g :scheduled) (setq rtn ...) (setq results ...)) ((eq arg :closed) (setq rt= n ...) (setq results ...)) ((eq arg :deadline) (setq rtn ...) (setq deadlin= e-results ...) (setq results ...))))))) results) | (if (not buffer) (list (format "ORG-AGENDA-ERROR: No such org-file %s" = file)) (with-current-buffer buffer (unless (derived-mode-p (quote org-mode)= ) (error "Agenda file %s is not in `org-mode'" file)) (let ((case-fold-sear= ch nil)) (save-excursion (save-restriction (if org-agenda-restrict (narrow-= to-region org-agenda-restrict-begin org-agenda-restrict-end) (widen)) (whil= e (setq arg (pop args)) (cond (... ... ...) (... ... ... ... ...) (... ... = ...) (... ... ...) (... ... ...) (... ... ... ...)))))) results)) | (let* ((org-startup-folded nil) (org-startup-align-all-tables nil) (buf= fer (if (file-exists-p file) (org-get-agenda-file-buffer file) (error "No s= uch file %s" file))) arg results rtn deadline-results) (if (not buffer) (li= st (format "ORG-AGENDA-ERROR: No such org-file %s" file)) (with-current-buf= fer buffer (unless (derived-mode-p (quote org-mode)) (error "Agenda file %s= is not in `org-mode'" file)) (let ((case-fold-search nil)) (save-excursion= (save-restriction (if org-agenda-restrict (narrow-to-region org-agenda-res= trict-begin org-agenda-restrict-end) (widen)) (while (setq arg ...) (cond .= .. ... ... ... ... ...))))) results))) | org-agenda-get-day-entries("~/s/notes/notes.org" (5 29 2012) :deadline = :scheduled :timestamp) `---- thanks, eric --=20 : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.1.50.1 + Ma Gnus v0.6