emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: Damien Cassou <damien.cassou@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: Can't report org bugs when org-pomodoro is installed [8.2.1 (8.2.1-15-ge5cecc-elpaplus @ /home/cassou/.emacs.d/.cask/24.3.1/elpa/org-plus-contrib-20131021/)]
Date: Tue, 05 Nov 2013 19:12:38 +0100	[thread overview]
Message-ID: <874n7qsoo9.fsf@bzg.ath.cx> (raw)
In-Reply-To: <CA+y5ggj-M1car-jsWJxgh4pkVSvaa16oJUS7=8NGOoisxZDMiA@mail.gmail.com> (Damien Cassou's message of "Tue, 5 Nov 2013 18:21:35 +0100")

Damien Cassou <damien.cassou@gmail.com> writes:

> On Tue, Nov 5, 2013 at 5:53 PM, Bastien <bzg@altern.org> wrote:
>>> However, I'm not sure I agree with you.
>>
>> What do you mean exactly?
>
> I'm not sure this is a bug of org-pomodoro. I think org-pomodoro is
> correct in its assumption that `load-file-name' is non-nil. 

Not in all circumstances.  

 -- Macro: defcustom option standard doc [keyword value]…
     This macro declares OPTION as a user option (i.e., a customizable
     variable).  You should not quote OPTION.

     The argument STANDARD is an expression that specifies the standard
     value for OPTION.  Evaluating the ‘defcustom’ form evaluates
     STANDARD, but does not necessarily install the standard value.  If
     OPTION already has a default value, ‘defcustom’ does not change it.
     If the user has saved a customization for OPTION, ‘defcustom’
     installs the user’s customized value as OPTION’s default value.  If
     neither of those cases applies, ‘defcustom’ installs the result of
     evaluating STANDARD as the default value.

     The expression STANDARD can be evaluated at various other times,
     too—whenever the customization facility needs to know OPTION’s
     standard value.  So be sure to use an expression which is harmless
     to evaluate at any time.

The last sentence is the one important here.

Maybe org-pomodoro should use something like this:

(defcustom org-pomodoro-sound
  "/resources/bell.wav"
  "The path to a sound file that´s to be played when a pomodoro was finished."
  :group 'org-pomodoro
  :initialize 'custom-initialize-set
  :set (lambda (var val)
	 (if load-file-name
	     (set-default
	      var (concat (file-name-directory load-file-name) "/resources/bell.wav"))
	   "/resources/bell.wav"))
  :type 'file)

That way (get 'org-pomodoro-sound 'standard-value) would *always*
return something, which is the whole point.

Feel free to point to this suggestion when following up on github.

Best,

-- 
 Bastien

      reply	other threads:[~2013-11-05 18:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 11:57 Bug: Can't report org bugs when org-pomodoro is installed [8.2.1 (8.2.1-15-ge5cecc-elpaplus @ /home/cassou/.emacs.d/.cask/24.3.1/elpa/org-plus-contrib-20131021/)] Damien Cassou
2013-11-05 16:30 ` Bastien
2013-11-05 16:36   ` Damien Cassou
2013-11-05 16:53     ` Bastien
2013-11-05 17:21       ` Damien Cassou
2013-11-05 18:12         ` Bastien [this message]

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=874n7qsoo9.fsf@bzg.ath.cx \
    --to=bzg@gnu.org \
    --cc=damien.cassou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).