emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: Can't report org bugs when org-pomodoro is installed [8.2.1


From: Bastien
Subject: Re: [O] 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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Damien Cassou <address@hidden> writes:

> On Tue, Nov 5, 2013 at 5:53 PM, Bastien <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]