emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-pdfview-open doesn't work anymore


From: Michael Brand
Subject: Re: [O] org-pdfview-open doesn't work anymore
Date: Fri, 5 Feb 2016 19:47:13 +0100

Hi Nicolas

On Fri, Feb 5, 2016 at 6:22 PM, Nicolas Goaziou <address@hidden> wrote:

> Michael Brand <address@hidden> writes:

>> +      ;; FIXME: Remove this check when most default installations of
>> +      ;; Emacs have at least Org 9.0.
>> +      (let ((arglist (help-function-arglist cmd)))
>> +     (when (or (memq '&optional arglist)
>> +               (memq '&rest arglist)
>> +               (/= 2 (length arglist)))
>> +       (user-error
>> +        (format
>> +         "%s%s%S"
>> +         "Please see Org News for version 9.0 about `org-file-apps', "
>> +         "this function signature is wrong: "
>> +         cmd))))
>
> I have the feeling there is some over-engineering involved there.

Also it should have allowed at least optional arguments

    (when (or (memq
               ;; Too complicated to parse regarding that such functions
               ;; are probably not useful here.
               '&rest
               arglist)
              (/= 2 (length (delete '&optional arglist))))
      (user-error

for e. g. a simple

    (add-to-list 'org-file-apps
                 (cons (concat org-player-file-extensions-regexp "$")
                       'org-player-play-file))

which refers to the existing

    (defun org-player-play-file (filename &optional pos)

> In any case, instead of relying on `help-function-arglist', I suggest to
> use something lightweight:
>
> (condition-case err
>     (funcall ...)
>   (wrong-number-of-arguments
>    (user-error "Please ..."))
>   (invalid-function
>    (user-error "Please ...")))

Of course. I didn't know about this possibility, remixed patch attached.

Michael

Attachment: 0001-org-file-apps-add-migration-hint-for-function-signat.patch
Description: Text Data


reply via email to

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