emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Lazy load of org-protocol
Date: Wed, 9 Feb 2022 11:22:47 -0800	[thread overview]
Message-ID: <1dd55e54-7677-2764-1b6d-eda0a278bc3f@gmail.com> (raw)
In-Reply-To: <su0r54$f42$1@ciao.gmane.io>

On 2/9/2022 8:46 AM, Max Nikulin wrote:
> It is not a problem to implement --apply in addition to --arg.
[snip]

For the purposes of this issue, I think either solution would probably 
work. It probably depends on what people think on emacs-devel.

>> On a related note, there is still an issue with `--eval' in some 
>> cases. It fails to work with emacsclient when invoking an alternate 
>> editor:
>>
>>    emacsclient --alternate-editor emacs --eval '(message "hi")'
>>
>> If Emacs isn't already running, that will open a new buffer named 
>> '(message "hi")'. I think that's just a bug in how emacsclient handles 
>> `--eval', though fixing it would make org-protocol links work more 
>> reliably (if they used `--eval' as proposed, that is).
> 
>      emacsclient --alternate-editor '' --eval '(message "hi")'
> 
> But it makes it harder to use it during debugging when -Q -L 
> ~/src/org-mode/lisp options are required.

Right, invoking the main Emacs instance as a daemon (i.e. when 
--alternate-editor is the empty string) works pretty differently from 
invoking the main Emacs instance directly (i.e. when --alternate-editor 
is "emacs" or somesuch). In the former case, emacsclient starts "emacs 
--daemon" and then tries to reconnect to the daemon; in the latter, it 
just takes the arguments passed to emacsclient and forwards them (well, 
some of them) to emacs. The end result is that it runs "emacs '(message 
"hi")'", which isn't correct.

It'd be nice to fix the behavior of "--alternate-editor emacs" so it 
passes the --eval flag along too. This might be tricky though, since the 
semantics of --eval aren't quite the same for emacs and emacsclient. For 
emacs, --eval means that just the next argument is Lisp code; for 
emacsclient, --eval means that *all* subsequent (positional) arguments 
are Lisp code.

In practice though, I don't think fixing this is actually *required* to 
fix the issue of how org-protocol is handled. It only causes issues for 
the subset of people who use "--alternate-editor emacs" or something 
similar.

- Jim


  reply	other threads:[~2022-02-09 19:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05 11:54 Lazy load of org-protocol Max Nikulin
2022-02-05 18:27 ` Jim Porter
2022-02-06 16:42   ` Max Nikulin
2022-02-06 19:40     ` Jim Porter
2022-02-07 14:57       ` Max Nikulin
2022-02-07 19:06         ` Jim Porter
2022-02-09 16:46           ` Max Nikulin
2022-02-09 19:22             ` Jim Porter [this message]
2022-02-10 14:44               ` Max Nikulin
2022-02-08 10:44         ` Emacs-orgmode Digest, Vol 192, Issue 8 Tianshu Wang
     [not found] <mailman.61.1644253327.32758.emacs-orgmode@gnu.org>
2022-02-08 19:02 ` [PATCH] lisp/org-capture.el: Add hook & hook options to org-capture (Valentin Herrmann) No Wayman
2022-02-09  4:10   ` Ihor Radchenko
2022-02-09  7:11     ` No Wayman
2022-03-20 10:43       ` Ihor Radchenko
2022-02-10 19:32   ` Greg Minshall

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=1dd55e54-7677-2764-1b6d-eda0a278bc3f@gmail.com \
    --to=jporterbugs@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).