8

The default kile version (Kile 2.9.91) shipped with kubuntu 18.04 does not behave as expected. In older versions this

$ kile myfile.tex

would open myfile.tex for editing. However, in the current version this tries and fails to open http://myfile.tex. The error message I get is "http://myfile.tex Host not found", which is not too surprising. I tried to wrap the filename in quotes, use kile ./myfile.tex and kile file://myfile.tex. The first did not change anything, the second and third resulted in a segfault.

What is the right way to open files using the command line in Kile 2.9.91?

What works, what doesn't?

$ kile myfile.tex                         -> Error: http://myfile.tex
$ kile "myfile.tex"                       -> Error: http://myfile.tex
$ kile myfile.txt                         -> Error: http://myfile.txt
$ kile myfile                             -> Error: http://myfile
$ kile Documents/myfile.tex               -> Error: http://documents/myfile.tex

$ kile ~/Documents/myfile.tex             -> Works!
$ kile /home/user/Documents/myfile.tex    -> Works!
$ kile $(realpath myfile.tex)             -> Works!

$ kile ./myfile.tex                       -> segfault
$ kile file://myfile.tex                  -> segfault
m00am
  • 616

2 Answers2

2

Dirty workaround time: write a function into your .bashrc/ .zshrc (others might work these two are the only ones I tested) that calls realpath to get the absolute path of the input file:

function kile-open {
    kile $(realpath $1)
}

To regain the intended behavior (for one file at a time, not working with any other parameters, this can easily be improved with some bash knowledge). This is by no means a solution, just a way to mimic the intended behavior for now.

m00am
  • 616
1

Inspired by @m00am solution, in bash you can add the following to the .bashrc:

kile() { command kile $(realpath "$@") }

The command kile myfile.tex will then work. Personnally, I even redirect the output to /dev/null and release the command:

kile() { command kile $(realpath "$@") > /dev/null 2>&1 & }
xiawi
  • 131