From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: org-review-schedule Date: Fri, 25 Apr 2014 09:43:46 +0200 Message-ID: References: <877g6leltk.fsf@bzg.ath.cx> <87fvl1lx50.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wdap4-0004km-UI for emacs-orgmode@gnu.org; Fri, 25 Apr 2014 03:45:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wdaow-0005Fh-1C for emacs-orgmode@gnu.org; Fri, 25 Apr 2014 03:45:26 -0400 In-Reply-To: <87fvl1lx50.fsf@gmail.com> (Nicolas Goaziou's message of "Fri, 25 Apr 2014 08:51:39 +0200") 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: Nicolas Goaziou Cc: Bastien , emacs-orgmode Hi Nicolas, Thanks a lot for these very helpful comments. I'll take them into account. I have a couple questions of my own now. On 2014-04-25 08:51, Nicolas Goaziou writes: >> I would like to propose to add this to the contrib directory, but >> I don't know the procedure to submit this code. > > You simply copy the file in the contrib/lisp/ directory, edit > contrib/README and edit `org-modules' defcustom in "org.el". I guess I should have asked: who decides what goes in contrib? Is this mature/useful enough to be included? If so, I'll edit these as you suggest. >> ;; Example use. >> ;; > > Trailing whitespace. After this many violations, I've added #+begin_src emacs-lisp (setq-default show-trailing-whitespace t) #+end_src to my configuration ;-) >> (defun org-review-insert-last-review (&optional prompt) >> "Insert the current date as last review. If prefix argument: >> prompt the user for the date." >> (interactive "P") >> (let* ((ts (if prompt >> (concat "<" (org-read-date) ">") >> (format-time-string (car org-time-stamp-formats))))) >> (save-excursion > > I don't think this `save-excursion' is needed. Indeed. I copied this from org-expiry. Looking at the code for `org-entry-put', I see that it uses `org-with-point' that also uses save-excursion inside. >> (defun org-review-skip () >> "Skip entries that are not scheduled to be reviewed." >> (save-restriction >> (widen) >> (let ((next-headline (save-excursion (or (outline-next-heading) >> (point-max))))) >> (cond >> ((org-review-toreview-p) nil) >> (t next-headline))))) > > This function doesn't move point (so it skips nothing), is it > expected? It works, so I guess it's not supposed to move the point. It's to be used with `org-agenda-skip-function', which says: ,----------------------------------------------------------------------- | Function to be called at each match during agenda construction. | If this function returns nil, the current match should not be skipped. | Otherwise, the function must return a position from where the search | should be continued. `----------------------------------------------------------------------- Thanks again, Alan