Rens Oliemans <[email protected]> writes: >> I mean - throw an error if we have links that cannot be converted. >> That error will be visible during the build and can be quickly fixed by >> manually altering the problematic links. > > Clear. My goal is to send a message to stderr when --debug is passed and a > problematic link is found, so you can only look at stderr and easily view all > problematic links. However, just (message "...") already goes to stderr, so > the entire publish.sh output gets written to stderr, making it difficult to > see the relevant output. Do you know why?
See 43.17 Batch Mode section of Elisp manual. It is Emacs default to print message output to stderr. > Alternatively I can do (error "..."), which will stop the export process > immediately when a problematic link is seen (and --debug is given). > > Also, is --debug already a special flag for Emacs? I do not see it in man, but > if I do > > ./publish.sh --debug > > , an (error "...") call in my export hook properly errors and exits the > script. If I do > > ./publish.sh > > , my (error "...") call just outputs to stderr and publish.sh continues with > the next org file. I do not do anything with command-line arg parsing at the > moment. --debug flag is specific to publish.sh. See (defvar worg-publish-stop-on-error (member "--debug" command-line-args) publish.sh is a Elisp script and Elisp scripts have access to command line arguments via `command-line-args' variable. >>> +(push "./" load-path) >>> +(require 'rewrite-urls) >> >> We can simply use (load "rewrite-urls") >> Also, it is a good practice to use a non-generic prefix. Something like >> worg-urls. > > I can't get (load "...") to work, unless I do (push "./" load-path) > beforehand. From the docs of `load': > > ... > This function searches the directories in ‘load-path’. > > Am I missing something? Yeah. Need (load "./rewrite-urls") - path, not just file name. > See attached patch for incorporated changes. I don't have a lot of free time > to work on this so it's a bit slow and still WIP, I'm sending it now also to > show some progress. Since it's WIP you can ignore reviewing it if you want, > I'll improve on it myself. Current limitations: I will give some quick feedback on what you have below. > -Tony day [[http://mid.gmane.org/[email protected]][shared]] > [[https://gist.github.com/4343164][this gist]] to pick up a > +Tony day [[http://mid.gmane.org/[email protected]][shared]] > [[https://gist.github.com/tonyday567/4343164][this gist]] to pick up a > random task. Side note: gmane is down, so all links it gmane are broken. But they often refer to either our of emacs-devel mailing list, which can both be searched by message ID: https://list.orgmode.org/?q=m2zk19l1me.fsf%40gmail.com Christian, this is a heads up for you. > +(defun -get-libredirect-data () > + "Returns libredirect data from github" Here and in other places, should use prefix worg-urls-get-libredirect-data. Also, try M-x checkdoc on the file. You will see a lot of stylistic suggestions. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
