Thank you very much, Andrew, for this guide! It works! My pdf viewer is
Foxit Reader so after installing the gnome-open program and checking it
works, I didn't have to follow any other steps. I wish this guide can be
merged with the current guide in the Usage Manual. Just one small
suggestion to make this guide even more idiot-proof (at least for the steps
I did) would be to make this step a bit more verbose: "Create the file
'lilypond-invoke-editor.desktop' *f. ex. in your home folder*". The next
command assumes that you created the file via terminal and you moved to
that location with the terminal. In the case that you created that file
using GEdit (like I did) and followed the instructions in the Usage Manual
(where it mentions /tmp as folder), the next command won't really work
unless you're already there in the terminal (where I wasn't, since a
terminal opens by default with the home directory). This might be obvious
for people who do everything via terminal, but not for people who prefer
using graphical applications like GEdit. Is it maybe possible to create a
script that automates all this? Perhaps the Gvim and Evince parts can be
left out of it, but I have the feeling that what I just had to do can be
made into a script. I already can do some scripting in Python, but such a
script would need the user to have Python installed. So a Bash script from
someone acquainted with Bash would be very welcome.

Atom works very well even with large files, however there's a small lag
with point & click (even with small files). Since Frescobaldi doesn't have
this Point & Click problem even with large files, I assume this small lag
has more to do with the fact that there are two applications involved (Atom
and Foxit) rather than one (Frescobaldi). Am I right? This Point & Click
penalty is something that I'm willing to trade for the moment: it's less
than Frescobaldi hanging while trying to move the cursor, let alone for
trying to edit a large file. I hope this performance issue can be fixed in
Frescobaldi eventually (although Atom has other advantages like Column
Selection...).

Cheers,
Martín.

Am So., 1. Nov. 2020 um 05:13 Uhr schrieb Andrew Bernard <
andrew.bern...@gmail.com>:

> [A slightly older screed. Stil works for Ubunto 20. Using Atom is matter
> of simple substitution.]
>
>
>
> The Guide to getting Point and Click going with Gvim under Ubuntu 18
>
> --------------------------------------------------------------------------------------------------
>
> The NR leaves out some important information about how to configure a
> Ubuntu
> system to use Gvim for point and click from Lilypond PDF files. Where
> the NR is
> substantially correct, that information is copied here.
>
>
> Requirements
> ------------
>
> Ubuntu 18.10
> Document Viewer (evince)
> gvim version 8.0 (vim-gtk3 package)
> [assumes bash shell]
>
>
> Setting the EDITOR variable
> ---------------------------
>
> Lilypond uses the environment variable EDITOR to select which editor to
> use to
> display point and click links. For gvim, simply use the value 'gvim':
>
> export EDITOR=gvim
>
> Setting LYEDITOR is not required.
>
> You can start evince from a terminal command to view a PDF. But if you
> want to
> click on a PDF in GNOME Nautilus to view it then just exporting this
> variable
> from the various bash startup files is inadequate. Gnome is started by
> Xsession
> in X11 before terminals and shells. Therefore it is unable to see
> environment
> variables set in .bashrc (or .bash_profile, etc). To resolve this matter,
> recall that Xsession uses the startup file $HOME/.xsessionrc. For
> environment
> variables that are to be shared between GNOME applications and terminal
> shells,
> do the following. Create a file for variable declarations, of arbitrary
> name.
> Add the EDITOR setting to that file:
>
>   $ echo 'export EDITOR=gvim' > ~/.my_env_vars
>
> Then edit ~/.xsessionrc to contain:
>
> if [ -f ~/.my_env_vars ]; then
>      . ~/.my_env_vars
> fi
>
> Now also add these same lines to ~/.bashrc. Some like to use
> .bash_profile or
> other mechanisms, but the principle is the same. Manage any shared
> variables
> that Nautilus and a bash shell both need in this third file. To make
> this take
> effect, logout and login again so that a new Xsession is started.
>
>
> Installing Gvim
> ---------------
>
> Gvim is in the following package, not a package called gvim.
>
> # apt install vim-gtk3
>
>
> Configuring the GNOME 3 Desktop
> -------------------------------
>
> Create the file 'lilypond-invoke-editor.desktop':
>
> [Desktop Entry]
> Version=1.0
> Name=lilypond-invoke-editor
> GenericName=Textedit URI handler
> Comment=URI handler for textedit:
> Exec=lilypond-invoke-editor %u
> Terminal=false
> Type=Application
> MimeType=x-scheme-handler/textedit;
> Categories=Editor
> NoDisplay=true
>
> Run:
>
> $ xdg-desktop-menu install ./lilypond-invoke-editor.desktop
> $ xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit
>
> Check that this works. Install the gnome-open program:
>
> $ sudo apt install libgnome2-bin
>
> Then:
>
> $ gnome-open textedit:///etc/issue:1:0:0
>
> If all is correct lilypond-invoke-editor will run and display the file.
>
>
> Configuring Ubuntu Apparmor for Evince
> --------------------------------------
>
> The Ubuntu mandatory access control system called Apparmor particular
> gaurds
> with some ferocity the actions of Evince, so as to prevent malicious
> PDF's from
> causing damage to the system. The apparmor configuration file for evince
> needs
> to be modified. [The NR is lacking some crucial information here, which can
> waste a lot of time as most people are not au fait with apparmor.]
>
> As root, edit '/etc/apparmor.d/local/usr.bin.evince' to have the following
> lines (it will most likely be an empty file):
>
> # For Textedit links
> #/usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,
> /home/andro/bin/lilypond-invoke-editor Cx -> sanitized_helper,
>
> Note the comma on the end - this is not an error. Adjust the path as per
> the
> exmaples to where your lilypond is installed.
>
> Next, edit '/etc/apparmor.d/usr.bin.evince' and uncomment the line:
>
>    # Site-specific additions and overrides. See local/README for details.
>    include <local/usr.bin.evince>
>
> [It's right at the end.] The local files provide for extending and adding
> information to the base apparmor files without interfering with them, and
> making system upgrades easier.
>
> Reconfigure evince apparmor:
>
> # apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince
>
> To update apparmor:
>
> # systemctl reload apparmor
>
> Many people are confused by this step so it's important to get it exactly
> right, and be aware of which apparmor file is which - there are two files
> involved.
>
>
> Configuring Gvim
> ----------------
>
> Not all users see this problem, but if you do, it is hard to solve if
> you don't
> know. On a plain new gvim install, every time you click on a lilypond grob
> under the setup described here, the following rather daunting error
> message is
> shown, and you have to press ENTER to continue, each time.
>
> :if !exists('+acd')||!&acd|if haslocaldir()|cd -|lcd -|elseif getcwd()
> ==# '/home/andro'|cd -|endif|endif
> ::1898:norm3|cal foreground()|if &im|star|en|redr|f
>
> And also 'Press ENTER or type command to continue'.
>
> The solution to this is to change the size of the message display in
> gvim. Add
> the following to ~/.gvimrc:
>
> if exists('+cmdheight') && (&ch < 2)
>    set ch=2
> endif
>
> You may need to set the height to 3, depending on various sizes.
>
> [As for why some people do not see this issue, I am unclear.]
>
>
> A Personal Preference
> ---------------------
>
> Because gvim comes by default with mouse enabled, and this is a useful
> feature,
> if you click in the window after lilypond-invoke-editgor has set the cursor
> position in the file, the cursor will move to the mouse click. You can
> either
> disable mouse in gvim, or do what I prefer which is to use the GNOME Tweaks
> tool in Ubuntu and change the window behaviour to be 'focus on hover'.
> This is
> a personal matter.
>
>
> Running Gvim and Evince
> -----------------------
>
> Run gvim in server mode by doing - exactly nothing! Simply running gvim
> will
> start the process in a new window. From the terminal this suffixes:
>
> $ gvim
>
> By default gvim will respond to remote requests such as from
> lilypond-invoke-editor. There is no need to use the --servername option
> as the
> name defaults to GVIM (and you can see this in the title bar). By default
> lilypond sends point and click requests to the gvim server named GVIM.
>
> Run evince from the shell or by clicking on a PDF file in Nautilus. Now
> clicking on a grob will take you to the line and column where that
> object is in
> the lilypond source file.
>
>
>
>

-- 
www.martinrinconbotero.com

Reply via email to