I have a similar demand that I implemented through the following and it is currently working well.
(defadvice server-execute (before enable-org-protocol activate) (unless (featurep 'org-protocol) (require 'org-protocol))) emacs-orgmode-requ...@gnu.org writes: > Send Emacs-orgmode mailing list submissions to > emacs-orgmode@gnu.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.gnu.org/mailman/listinfo/emacs-orgmode > or, via email, send a message with subject or body 'help' to > emacs-orgmode-requ...@gnu.org > > You can reach the person managing the list at > emacs-orgmode-ow...@gnu.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Emacs-orgmode digest..." > > > Today's Topics: > > 1. Re: [BUG] loading ol-gnus returns an error [9.5 > (release_9.5-194-gdb302d @ > /home/oub/emacs/site-lisp/packages/org/)] (Ihor Radchenko) > 2. [SOLVED] (was: [BUG] loading ol-gnus returns an error [9.5 > (release_9.5-194-gdb302d @ > /home/oub/emacs/site-lisp/packages/org/)]) (Uwe Brauer) > 3. Re: [BUG] org-bibtex-yank does not recognise bibtex entry > [9.6 (9.6-??-e7ea951 ] (Ihor Radchenko) > 4. Re: Problem with org-babel and geiser (Ihor Radchenko) > 5. Lazy load of org-protocol (Max Nikulin) > 6. Re: Shell SRC blocks under Windows (H. Dieter Wilhelm) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 05 Feb 2022 17:37:01 +0800 > From: Ihor Radchenko <yanta...@gmail.com> > To: Uwe Brauer <o...@mat.ucm.es> > Cc: emacs-orgmode@gnu.org > Subject: Re: [BUG] loading ol-gnus returns an error [9.5 > (release_9.5-194-gdb302d @ /home/oub/emacs/site-lisp/packages/org/)] > Message-ID: <87tudd64ea.fsf@localhost> > Content-Type: text/plain > > Uwe Brauer <o...@mat.ucm.es> writes: > >> Running a more or less recent master commit of org-mode and GNU emacs >> when loading the ol-gnus file I receive the following error >> >> >> Debugger entered--Lisp error: (void-variable file) >> (load file "/home/oub/emacs/site-lisp/packages/org/ol-gnus.el") >> eval((load file "/home/oub/emacs/site-lisp/packages/org/ol-gnus.el") nil) >> elisp--eval-last-sexp(nil) >> eval-last-sexp(nil) >> funcall-interactively(eval-last-sexp nil) >> call-interactively(eval-last-sexp nil nil) >> command-execute(eval-last-sexp) > > When does the error occur? Judging from the backtrace, you tried to > evaluate some kind of elisp expression manually with eval-last-sexp. The > expression appears to be > (load file "/home/oub/emacs/site-lisp/packages/org/ol-gnus.el") > > Indeed, file is undefined. I am not sure what Org has to do with the > error. > > Best, > Ihor > > > > ------------------------------ > > Message: 2 > Date: Sat, 05 Feb 2022 11:30:08 +0100 > From: Uwe Brauer <o...@mat.ucm.es> > To: emacs-orgmode@gnu.org > Subject: [SOLVED] (was: [BUG] loading ol-gnus returns an error [9.5 > (release_9.5-194-gdb302d @ /home/oub/emacs/site-lisp/packages/org/)]) > Message-ID: <87y22pk3m7.fsf...@mat.ucm.es> > Content-Type: text/plain; charset="utf-8" > >>>> "IR" == Ihor Radchenko <yanta...@gmail.com> writes: > >> Uwe Brauer <o...@mat.ucm.es> writes: >>> Running a more or less recent master commit of org-mode and GNU emacs >>> when loading the ol-gnus file I receive the following error >>> >>> >>> Debugger entered--Lisp error: (void-variable file) >>> (load file "/home/oub/emacs/site-lisp/packages/org/ol-gnus.el") >>> eval((load file "/home/oub/emacs/site-lisp/packages/org/ol-gnus.el") nil) >>> elisp--eval-last-sexp(nil) >>> eval-last-sexp(nil) >>> funcall-interactively(eval-last-sexp nil) >>> call-interactively(eval-last-sexp nil nil) >>> command-execute(eval-last-sexp) > >> When does the error occur? Judging from the backtrace, you tried to >> evaluate some kind of elisp expression manually with eval-last-sexp. The >> expression appears to be >> (load file "/home/oub/emacs/site-lisp/packages/org/ol-gnus.el") > > Shame on me: it should be load-file > > I am very sorry. Forget it > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: smime.p7s > Type: application/pkcs7-signature > Size: 5673 bytes > Desc: not available > URL: > <https://lists.gnu.org/archive/html/emacs-orgmode/attachments/20220205/d40c7d0c/attachment.bin> > > ------------------------------ > > Message: 3 > Date: Sat, 05 Feb 2022 19:22:59 +0800 > From: Ihor Radchenko <yanta...@gmail.com> > To: Günter Lichtenberg <m...@guenterlichtenberg.de> > Cc: emacs-orgmode@gnu.org > Subject: Re: [BUG] org-bibtex-yank does not recognise bibtex entry > [9.6 (9.6-??-e7ea951 ] > Message-ID: <87r18h5zho.fsf@localhost> > Content-Type: text/plain; charset=utf-8 > > Günter Lichtenberg <m...@guenterlichtenberg.de> writes: > >> In short: >> Expected: Bibtex text is yanked as an orgmode entry >> Actually Happening: Error thrown, nothing yanked > > Thanks for the report! > Fixed on bugfix via 7543da99. > > Best, > Ihor > > > > ------------------------------ > > Message: 4 > Date: Sat, 05 Feb 2022 19:39:16 +0800 > From: Ihor Radchenko <yanta...@gmail.com> > To: Bob Heffernan <bob.heffer...@gmail.com> > Cc: emacs-orgmode@gnu.org > Subject: Re: Problem with org-babel and geiser > Message-ID: <87o83l5yqj.fsf@localhost> > Content-Type: text/plain; charset="utf-8" > > Bob Heffernan <bob.heffer...@gmail.com> writes: > >> Thank you for your response. >> The patch you linked does seem to be intended to fix this issue. >> >> However, I have no experience with applying a patch (to Emacs or anything >> else). >> On my system, ob-scheme.el.gz can be found at >> /usr/share/emacs/27.2/lisp/org >> can I uncompress the file, patch that, then compress again? >> >> Or, would I need to download the Emacs source, apply the patch and then >> recompile? > > It's not a good idea to modify Org packaged together with Emacs. For > testing, you can just use the attached version of ob-scheme.el. Load > your Emacs and Org mode, open the attached ob-scheme.el, and run M-x > eval-buffer. That should be sufficient to test the proposed patch on > your side. > > If the patch solves the problem you are experiencing, let us know. I > will then apply the proposed patch upstream. > > Note that even if I apply the patch, it will only be available on the > latest version of Org mode (Org 9.5.2). It is _not_ what is shipped > together with your Emacs. You will need to upgrade your Org mode using > M-x package-install. See > https://orgmode.org/manual/Installation.html#Installation for details. > > Best, > Ihor > > -------------- next part -------------- > An embedded and charset-unspecified text was scrubbed... > Name: ob-scheme.el > URL: > <https://lists.gnu.org/archive/html/emacs-orgmode/attachments/20220205/50e255a6/attachment.ksh> > > ------------------------------ > > Message: 5 > Date: Sat, 5 Feb 2022 18:54:37 +0700 > From: Max Nikulin <maniku...@gmail.com> > To: emacs-orgmode@gnu.org > Subject: Lazy load of org-protocol > Message-ID: <stlohv$17d8$1...@ciao.gmane.io> > Content-Type: text/plain; charset=UTF-8; format=flowed > > Hi. > > I would prefer to avoid > (require 'org-protocol) > in emacs init file and to postpone loading till invocation of > emacsclient with org-protocol URI. > > The problem is a hack in org-protocol. URIs are actually treated as > (relative) file names and magic is achieved in an advice for > `server-visit-files' function. So the advice must be installed in advance. > > My first idea was to avoid such magic and to create autoload function > org-protocol-from-argv with body similar to that advice. If it were > possible to get arguments from `command-line-args-left' then invocation > would look like > > emacsclient --eval '(org-protocol-from-argv)' > 'org-protocol:/store-link?url=u1&title=t1' > > Unfortunately it is against design of emacs server protocol. If --eval > option is given than everything other is considered as independent > expressions. At the lower level there is no way to transfer `argv` as a > list from client to server process. > > It seems, it works if I add another advice to init.el that loads > org-protocol on demand: > > (defadvice server-visit-files (before org-protocol-lazy-load activate) > (and (not (featurep 'org-protocol)) > (memq nil > (mapcar (lambda (loc) > ;; loc: (file-name . (line . column)) > (not (string-match-p "\\(?:^\\|[/\\\\]\\)org-protocol:" > (car > loc)))) > (ad-get-arg 0))) > (progn > (require 'org-protocol) > ;; copy of org-protocol-detect-protocol-server advice, > ;; move to a dedicated function > (let ((flist (if org-protocol-reverse-list-of-files > (reverse (ad-get-arg 0)) > (ad-get-arg 0))) > (client (ad-get-arg 1))) > (catch 'greedy > (dolist (var flist) > ;; `\' to `/' on windows. FIXME: could this be done any better? > (let ((fname (expand-file-name (car var)))) > (setq fname (org-protocol-check-filename-for-protocol > fname (member var flist) client)) > (if (eq fname t) ;; greedy? We need the t return value. > (progn > (ad-set-arg 0 nil) > (throw 'greedy t)) > (if (stringp fname) ;; probably filename > (setcar var fname) > (ad-set-arg 0 (delq var (ad-get-arg 0)))))))))))) > > I hope, copy of original advice may be avoided by moving its body to a > separate function in org-protocol. > > Do you have have better ideas how to avoid eager loading of org-protocol > from init file? > > > > > ------------------------------ > > Message: 6 > Date: Sat, 05 Feb 2022 16:48:02 +0100 > From: "H. Dieter Wilhelm" <die...@duenenhof-wilhelm.de> > To: Michael Powe <po...@ctpowe.net> > Cc: emacs-orgmode@gnu.org > Subject: Re: Shell SRC blocks under Windows > Message-ID: <xm46pmo1gvrh....@duenenhof-wilhelm.de> > Content-Type: text/plain > > Michael Powe <po...@ctpowe.net> writes: > >> On 2/4/2022 15:15, H. Dieter Wilhelm wrote: >>> Hello >>> >>> I installed the software distribution MSYS2 https://www.msys2.org/. And >>> I'd like to call its various shells in org src blocks. First I tried to >>> set explicit-shell-file-name but then my LaTeX exports don't work any >>> longer. >>> >>> Is is it possible to extend org-mode's src blocks with >>> org-babel-shell-names to use either MSYS2 or MinGW shells (instead of >>> cmd.exe)? Unfortunately ob-shell.el doesn't guide me further and I >>> can't find examples or the respective lisp files on how to define the >>> execution functions. >>> >>> GNU Emacs 28.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, >>> cairo version 1.15.10) of 2022-01-14 >>> >>> Org mode version 9.4.6 (9.4.6-13-g4be129-elpaplus @ >>> /home/dieter/.emacs.d/elpa/org-plus-contrib-20210920/) >> >> I'm not aware that I did anything special to get these results, except >> add `(shell . t)` to `org-babel-load-languages`. I mean, it is entirely >> possible that I did, in some other context. I think it's just a matter >> of having bash in your path. > > Yes, you are right, when using > >> #+begin_src sh > > It seems that I'm also running some bash shell! :-) Previously I was > using the src block in this way: > > #+begin_src shell > > and here the shell seems to be com.exe. > > But I'm not sure if I'm halfway there with "sh"? I need to run the > following MSYS2 command AND switch between two arguments (for building > Emacs). > > \MSYS2\msys2_shell.cmd -mingw64 > > and > > \MSYS2\msys2_shell.cmd -msys. > > How could I achieve this within a src block? > > Thanks > > > > End of Emacs-orgmode Digest, Vol 192, Issue 6 > ********************************************* -- Tianshu Wang