emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daimrod <daimrod@gmail.com>
To: phcrama.ebiz@gmx.com
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-contacts.el: Catch 'nextfile in org-contacts-db
Date: Wed, 01 Jul 2015 17:39:53 +0200	[thread overview]
Message-ID: <87ioa3opiu.fsf@gmail.com> (raw)
In-Reply-To: <395DF5E7-3C6F-4CDD-8A88-8D1525BBE5AC@gmx.com> (phcrama ebiz's message of "Thu, 25 Jun 2015 13:01:56 +0200")

[-- Attachment #1: Type: text/plain, Size: 2574 bytes --]

phcrama.ebiz@gmx.com writes:

> Hi Nicolas and Greg,

Hi Philippe, sorry for the late reply :(

> Thank you for applying my initial patch.
>
> Inspired by Greg's improvements to my patch, I'd like to propose the attached (presumptuously named) better-patch that I believe fixes the TODO of my initial patch.
>
> Sorry it isn't quite in the format of the previous one/recommended by the project but I'm not on my main machine now.

> --- org.el	Fri Jun 19 12:07:26 2015
> +++ org-modif.el	Wed Jun 24 09:13:10 2015
> @@ -18097,17 +18097,28 @@
>  (defun org-file-menu-entry (file)
>    (vector file (list 'find-file file) t))
>  
> -(defun org-check-agenda-file (file)
> -  "Make sure FILE exists.  If not, ask user what to do."
> +(defun org-check-agenda-file-1 (file)
> +  "Make sure FILE exists.  If not, ask user what to do.
> +
> +Possible outcomes:
> +1. File exists -> return NIL.
> +2. File doesn't exist and user requests to remove it -> throws 'nextfile.
> +3. File doesn't exist and user requests to remove it -> raise error \"Abort\".
> +
> +You probably want `org-check-agenda-file'."
>    (when (not (file-exists-p file))
>      (message "Non-existent agenda file %s.  [R]emove from list or [A]bort?"
>  	     (abbreviate-file-name file))
>      (let ((r (downcase (read-char-exclusive))))
>        (cond
>         ((equal r ?r)
> -	(org-remove-file file)
>  	(throw 'nextfile t))
>         (t (error "Abort"))))))

The 3. item looks wrong to me. I think it should be:
3. File doesn't exist and user requests to abort -> raise error \"Abort\".

> +(defun org-check-agenda-file (file)
> +  "Make sure FILE exists, else if user agrees, remove FILE from `org-agenda-files'."
> +  (when (catch 'nextfile (org-check-agenda-file-1 file))
> +    (org-remove-file file)))
>  
>  (defun org-get-agenda-file-buffer (file)
>    "Get a buffer visiting FILE.  If the buffer needs to be created, add
> 
> 
> --- org-contacts.el	Fri Jun 19 12:07:20 2015

Moreover, I'm not sure about changing the behaviour of an existing
function. Though the change looks good to me, it is very likely users
(or maybe even other parts of org-mode, I'haven't check) rely on it, and
expect to catch exceptions.

> +++ org-contacts-modif.el	Wed Jun 24 09:13:56 2015
> [snip]

I agree with the modifications of org-contacts.el.


Maybe org-contacts.el should have its own version of
`org-check-agenda-file' (e.g. named `org-contacts-check-contacts-file')
until we find a better solution...

WDYT?


Best,

-- 
Daimrod/Greg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

  reply	other threads:[~2015-07-01 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <trinity-55a13834-abf3-4572-9c5a-fd0b5f8c5cd6-1435130389011@3capp-mailcom-bs13>
2015-06-25 11:01 ` [PATCH] org-contacts.el: Catch 'nextfile in org-contacts-db phcrama.ebiz
2015-07-01 15:39   ` Daimrod [this message]
2015-07-04 21:12     ` phcrama.ebiz
2015-06-10  9:25 Philippe Crama
2015-06-21 16:14 ` Daimrod
2015-06-23 21:49 ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ioa3opiu.fsf@gmail.com \
    --to=daimrod@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=phcrama.ebiz@gmx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).