7

After a recent update, kate seems to exec a copy of itself, presumably with some parameter which prevents an endless recursion, and then exits. Presumably this was intended to help users who run kate with a command in a command window and don't want the command window blocked until the kate window is closed.

However this breaks things like git commit and sudoedit, since these wait for kate to exit and then check to see if the file was changed. Now that the original kate process exits immediately, the file hasn't changed. How can I stop kate from exec'ing itself?

The only way that I can think of is to move the real /usr/bin/kate to something like /usr/bin/realkate, and create a tiny shell script at /usr/bin/kate which does something like /usr/bin/realkate -b $*, but this will get overwritten on the next upgrade.

I tried alias kate='kate -b' in my .bashrc, but this only works if I run kate from the command line, not when git commit or sudoedit runs it.

Possibly this could be fixed in katerc, but there doesn't seem to be any documentation for that.

2
  • only looked in here to see if there were humorous responses, given the title.... jipped.
    – ron
    Commented 18 hours ago
  • /usr/bin/realkate -b $* will not be overwritten by any upgrades, but as a matter of principle, you should create it in /usr/local/bin instead (see unix.stackexchange.com/questions/8656/…). Commented 6 hours ago

1 Answer 1

9

From the Kate manual (which you evidently are already aware of):

kate -b --block
If using an already running Kate instance, block until it exits, if URLs given to open.

You can use Kate with this option as editor for typing in commit messages for version control systems like Git or Subversion. These systems expect to block the editor till you have entered your message, because they then open the temporary file, which would be empty if Kate immediately returned to the caller.

This option is also needed with KIO (KDE Input/Output), if you open a remote file (which has been downloaded to a temporary) and should be reuploaded, after you saved it.

So, use kate -b or kate --block as your Git commit message editor. You would do this by setting the VISUAL or EDITOR environment variable to the editor command, possibly in your ~/.bashrc (or equivalent) file:

export VISUAL='kate -b'

Both git commit and visudo use these environment variables (with VISUAL having precedence over EDITOR), but you can also define the editors for each separately:

export SUDO_EDITOR='kate -b'
export GIT_EDITOR='kate -b'

(Both these have higher precedence than the more general VISUAL variable.)

See, e.g., the visudo(8), git-commit(1), and git-var(1) manuals. The manuals will also let you know that you can set the editor in the system-wide configuration of sudo and in your personal git configuration, as an alternative to using environment variables.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.