Re: [PATCH] patch open-editor-at-top-line

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

 



Dmitry Monakhov <dmonakhov@xxxxxxxxxx> writes:

> When i use "guilt series -e" for realy long series file
> it is not confortable always search current top patch line.
> IMHO editor have to start at the top patch automaticaly.
> Btw: open_editor_at_line may be useful in other places
>
> +# usage: open_editor_at_line <editor> <filename> <line>
> +# try to open editor with "filename"" at "line"
> +# different editors use different syntax for start line parameter
> +# so the only thing we can do is just compare with known editiors
> +# and ignore line if editor is unknown.
> +open_editor_at_line()
> +{
> +	editor_name=$1
> +	file_name=$2
> +	line_pos=$3
> +	case "$editor_name" in
> +		"vi" |"vim")
> +			$editor_name $file_name +$line_pos;;
> +		"emacs")
> +			$editor_name $file_mame:$line_pos;;
                                     ^^^^^^^^^^^^^^^^^^^^^^

You have not actually tested this patch.

> +		*)
> +			# editor is unknown, line_pos is just ignored
> +			$editor_name $file_name;;
> +	esac
> +	return $?
> +}
> +

This does not make much sense.  Pretty much every editor that can be
placed into $EDITOR/$VISUAL will understand the

$EDITOR +line filename

line convention (and if they don't, the damage is small).  Certainly
Emacs does so.  I don't know the situation under Windows, but in Unix
this has been the state for editors for eternity.

It turns out that I recently patched the git_editor function in
git-setup-sh.sh to take multiple arguments, and this should come in
handy: just do

git_editor "+$line_pos" "$filename"

and this should open the desired editor at the right line number.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux