From: Peter Vasil <mailing_lists@petervasil.net>
To: Bart Schaefer <schaefer@brasslantern.com>, zsh-workers@zsh.org
Subject: Re: edit-command-line problem with emacsclient
Date: Tue, 22 Sep 2015 09:10:45 +0200 [thread overview]
Message-ID: <5600FEF5.1010608@petervasil.net> (raw)
In-Reply-To: <150921153124.ZM609@torch.brasslantern.com>
Hi Bart,
Looks really good. I can confirm that your patch works for both emacs
and emacsclient.
Thanks so much!
Cheers,
Peter
On 09/22/2015 12:31 AM, Bart Schaefer wrote:
> On Sep 21, 9:16pm, Daniel Shahaf wrote:
> }
> } I wrote that. Sorry for the bug. I'm a vim user, and I sanity-tested
> } the emacs case, but I don't actually speak emacs lisp, so I'm not
> } surprised the patch was complete but not sound. I see now I forgot to
> } state in the patch mail that the emacs codepath needed extra review :-/
>
> S'ok, I think this should do it:
>
> diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
> index 2c7f34b..103a1c1 100644
> --- a/Functions/Zle/edit-command-line
> +++ b/Functions/Zle/edit-command-line
> @@ -11,13 +11,16 @@
>
> # Compute the cursor's position in bytes, not characters.
> setopt localoptions nomultibyte
> - integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 ))
>
> # Open the editor, placing the cursor at the right place if we know how.
> local editor=${${VISUAL:-${EDITOR:-vi}}}
> case $editor in
> - (*vim*) ${=editor} -c "normal! ${byteoffset}go" -- $1;;
> - (*emacs*) ${=editor} $1 -eval "(goto-char ${byteoffset})";;
> + (*vim*)
> + integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 ))
> + ${=editor} -c "normal! ${byteoffset}go" -- $1;;
> + (*emacs*)
> + local lines=( ${(f):-"$PREBUFFER$LBUFFER"} )
> + ${=editor} +${#lines}:$((${#lines[-1]} + 1)) $1;;
> (*) ${=editor} $1;;
> esac
>
prev parent reply other threads:[~2015-09-22 7:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-20 11:46 Peter Vasil
2015-09-20 15:32 ` Bart Schaefer
[not found] ` <55FF3CE5.9070604@petervasil.net>
2015-09-21 4:06 ` Bart Schaefer
[not found] ` <56004B05.9000703@petervasil.net>
[not found] ` <150921120017.ZM426@torch.brasslantern.com>
2015-09-21 19:09 ` Peter Vasil
2015-09-21 21:16 ` Daniel Shahaf
2015-09-21 22:31 ` Bart Schaefer
2015-09-22 7:10 ` Peter Vasil [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5600FEF5.1010608@petervasil.net \
--to=mailing_lists@petervasil.net \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.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.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).