Update the list of editors for lilypond-invoke-editor + doc improvement (issue 357720043 by fedelogy@gmail.com)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Update the list of editors for lilypond-invoke-editor + doc improvement (issue 357720043 by fedelogy@gmail.com)

Federico Bruni
Reviewers: ,

Message:
This is a patch following up the discussion here:
https://lists.gnu.org/archive/html/bug-lilypond/2018-06/msg00058.html


Description:
Update the list of editors for lilypond-invoke-editor + doc improvement

I've split it in two commits:

2nd commit
Doc: explain better how to set editors for lilypond-invoke-editor


1st commit
fix gedit command for lilypond-invoke-editor

Add also more editors (Atom, Geany, Kate) and
sort the list alphabetically.

Please review this at https://codereview.appspot.com/357720043/

Affected files (+33, -28 lines):
   M Documentation/usage/external.itely
   M scm/editor.scm


Index: Documentation/usage/external.itely
diff --git a/Documentation/usage/external.itely  
b/Documentation/usage/external.itely
index  
659abd27ba934d002216b614cc92573bddb07db9..789a68ccd8732a3f53e5f0799deba6c97a4cbe3e  
100644
--- a/Documentation/usage/external.itely
+++ b/Documentation/usage/external.itely
@@ -54,40 +54,42 @@ supplied with LilyPond.

  The program @file{lilypond-invoke-editor} is a small helper
  program.  It will invoke an editor for the special @code{textedit}
-URIs, and run a web browser for others.  It tests the environment
-variable @code{EDITOR} for the following patterns,
+URIs, and run a web browser for others.  It looks up the environment
+variables @code{EDITOR} and @code{LYEDITOR} to find out and launch the
+favorite editor to use.  @code{LYEDITOR} will have priority over
+@code{EDITOR}, so we recommend using the former especially if you want
+to use one editor in the terminal and another editor for LilyPond point
+and click.
+
+Every editor may have a different syntax to open a file in a specific line
+and column.  For user's convenience, LilyPond comes with ready commands
+for several editors, listed in @file{scm/editor.scm}.  This means that
+you can simply write the editor binary name, e.g.:

-@table @code
-@item emacs
-  this will invoke
-@example
-emacsclient --no-wait +@var{line}:@var{column} @var{file}
-@end example
-@item gvim
-  this will invoke
  @example
-gvim --remote +:@var{line}:norm@var{column} @var{file}
+export LYEDITOR=atom
  @end example

-@item nedit
-this will invoke
+@noindent
+and this will invoke
  @example
-  nc -noask +@var{line} @var{file}'
+atom %(file)s:%(line)s:%(column)s
  @end example
-@end table

-The environment variable @code{LYEDITOR} is used to override this.  It
-contains the command line to start the editor, where @code{%(file)s},
-@code{%(column)s}, @code{%(line)s} is replaced with the file, column
-and line respectively.  The  setting
+where @code{%(file)s}, @code{%(line)s} and @code{%(column)s} are replaced  
with
+the file, line and column respectively.
+
+In order to use an editor not listed in @file{scm/editor.scm}, you should
+find its specific syntax and assign the full command to @code{LYEDITOR}.
+Here's an example for Visual Studio Code editor:

  @example
-emacsclient --no-wait +%(line)s:%(column)s %(file)s
+export LYEDITOR="code --goto %(file)s:%(line)s:%(column)s"
  @end example

-@noindent
-for @code{LYEDITOR} is equivalent to the standard emacsclient
-invocation.
+@warning{If you choose Emacs, an extra configuration is needed.  You should
+add the line @code{(server-start)} to your @file{~/.emacs} file, otherwise
+every click on an object in the PDF will open a new Emacs window.}

  @menu
  * Using Xpdf for point and click::
Index: scm/editor.scm
diff --git a/scm/editor.scm b/scm/editor.scm
index  
f0132a03d2980c64b09035fa3405c1c437ee73bd..2289a0fbf01eb09be8126eb6eee473ca113ee7b0  
100644
--- a/scm/editor.scm
+++ b/scm/editor.scm
@@ -135,14 +135,17 @@ See Info node `(elisp)Security Considerations'."


  (define editor-command-template-alist
-  '(("emacs" .  "emacsclient --no-wait +%(line)s:%(column)s %(file)s ||  
(emacs +%(line)s:%(column)s %(file)s&)")
+  '(("atom" . "atom %(file)s:%(line)s:%(column)s")
+    ("emacs" .  "emacsclient --no-wait +%(line)s:%(column)s %(file)s ||  
(emacs +%(line)s:%(column)s %(file)s&)")
+    ("geany" . "geany --line %(line)s --column %(column)s %(file)s")
+    ("gedit" . "gedit --wait %(file)s +%(line)s:%(column)s")
      ("gvim" . "gvim --remote +:%(line)s:norm%(column)s %(file)s")
-    ("uedit32" . "uedit32 %(file)s -l%(line)s -c%(char)s")
-    ("nedit" . "nc -noask +%(line)s %(file)s")
-    ("gedit" . "gedit +%(line)s %(file)s")
      ("jedit" . "jedit -reuseview %(file)s +line:%(line)s")
+    ("kate" . "kate --block --line %(line)s --column %(column)s %(file)s")
+    ("lilypad" . "lilypad +%(line)s:%(char)s %(file)s")
+    ("nedit" . "nc -noask +%(line)s %(file)s")
      ("syn" . "syn -line %(line)s -col %(char)s %(file)s")
-    ("lilypad" . "lilypad +%(line)s:%(char)s %(file)s")))
+    ("uedit32" . "uedit32 %(file)s -l%(line)s -c%(char)s")))

  (define (get-command-template alist editor)
    (define (get-command-template-helper)



_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel