From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: How to track down "No heading for this item in buffer or region."? Date: Thu, 24 Jan 2013 20:24:18 +0100 Message-ID: <87libipeot.fsf@bzg.ath.cx> References: <20130124123204.GB24543@boo.workgroup> <87y5fioimf.fsf@bzg.ath.cx> <20130124162311.GE24543@boo.workgroup> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TySPQ-0006W2-De for emacs-orgmode@gnu.org; Thu, 24 Jan 2013 14:24:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TySPM-0000a7-3A for emacs-orgmode@gnu.org; Thu, 24 Jan 2013 14:24:24 -0500 Received: from mail-wi0-f171.google.com ([209.85.212.171]:61018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TySPL-0000Zn-Qh for emacs-orgmode@gnu.org; Thu, 24 Jan 2013 14:24:19 -0500 Received: by mail-wi0-f171.google.com with SMTP id hn14so775264wib.4 for ; Thu, 24 Jan 2013 11:24:19 -0800 (PST) In-Reply-To: <20130124162311.GE24543@boo.workgroup> (Gregor Zattler's message of "Thu, 24 Jan 2013 17:23:11 +0100") 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 Cc: Carsten Dominik --=-=-= Content-Type: text/plain Hi Gregor, Gregor Zattler writes: > But alas, the message "No heading for this item in buffer or > region." still appears two times in my agenda -- for today. The attached patch fixes it. Carsten, was there any special reason for allowing to add an agenda entry before the first headline? The following patch prevent this. Thanks, --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=org-agenda-no-heading_maint.patch diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index f088e59..4236b0a 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5406,9 +5406,6 @@ Do we have a reason to ignore this TODO entry because it has a time stamp? \(fn &optional END)" nil nil) -(defconst org-agenda-no-heading-message - "No heading for this item in buffer or region.") - (defun org-agenda-get-timestamps (&optional deadline-results) "Return the date stamp information for agenda display." (let* ((props (list 'face 'org-agenda-calendar-event @@ -5488,7 +5485,7 @@ Do we have a reason to ignore this TODO entry because it has a time stamp? category-pos (get-text-property b0 'org-category-position)) (save-excursion (if (not (re-search-backward org-outline-regexp-bol nil t)) - (setq txt org-agenda-no-heading-message) + (throw :skip nil) (goto-char (match-beginning 0)) (if (and (eq t org-agenda-skip-timestamp-if-deadline-is-shown) (assoc (point) deadline-position-alist)) @@ -5724,7 +5721,7 @@ please use `org-class' instead." (and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ \t]*$") (match-string 1))))) (if (not (re-search-backward org-outline-regexp-bol nil t)) - (setq txt org-agenda-no-heading-message) + (throw :skip nil) (goto-char (match-beginning 0)) (setq hdmarker (org-agenda-new-marker) inherited-tags @@ -5941,7 +5938,7 @@ See also the user option `org-agenda-clock-consistency-checks'." warntime (get-text-property (point) 'org-appt-warntime) category-pos (get-text-property (point) 'org-category-position)) (if (not (re-search-backward "^\\*+[ \t]+" nil t)) - (setq txt org-agenda-no-heading-message) + (throw :skip nil) (goto-char (match-end 0)) (setq pos1 (match-beginning 0)) (setq inherited-tags @@ -6066,7 +6063,7 @@ FRACTION is what fraction of the head-warning time has passed." (setq category (org-get-category) category-pos (get-text-property (point) 'org-category-position)) (if (not (re-search-backward "^\\*+[ \t]+" nil t)) - (setq txt org-agenda-no-heading-message) + (throw :skip nil) (goto-char (match-end 0)) (setq pos1 (match-beginning 0)) (if habitp @@ -6167,7 +6164,7 @@ FRACTION is what fraction of the head-warning time has passed." (setq category (org-get-category) category-pos (get-text-property (point) 'org-category-position)) (if (not (re-search-backward org-outline-regexp-bol nil t)) - (setq txt org-agenda-no-heading-message) + (throw :skip nil) (goto-char (match-beginning 0)) (setq hdmarker (org-agenda-new-marker (point)) inherited-tags --=-=-= Content-Type: text/plain -- Bastien --=-=-=--