CVSROOT: /cvsroot/lilypond
Module name: lilypond
Branch:
Changes by: Jan Nieuwenhuizen <[EMAIL PROTECTED]> 05/05/15 11:45:13
Modified files:
scripts : lilypond-invoke-editor.scm
scm : lily.scm editor.scm
. : ChangeLog
Log message:
* scm/editor.scm (slashify): New function.
(get-editor-command): Use it.
(get-command-template): Do not alter editor command if
environment value includes `%(file)s' magic.
* scripts/lilypond-invoke-editor.scm (unquote-uri): New function.
(dissect-uri): Use it.
(unquote-uri): Bugfix.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scripts/lilypond-invoke-editor.scm.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/lily.scm.diff?tr1=1.337&tr2=1.338&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/editor.scm.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3615&tr2=1.3616&r1=text&r2=text
Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3615 lilypond/ChangeLog:1.3616
--- lilypond/ChangeLog:1.3615 Sun May 15 00:24:33 2005
+++ lilypond/ChangeLog Sun May 15 11:45:13 2005
@@ -1,3 +1,14 @@
+2005-05-15 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
+
+ * scm/editor.scm (slashify): New function.
+ (get-editor-command): Use it.
+ (get-command-template): Do not alter editor command if
+ environment value includes `%(file)s' magic.
+
+ * scripts/lilypond-invoke-editor.scm (unquote-uri): New function.
+ (dissect-uri): Use it.
+ (unquote-uri): Bugfix.
+
2005-05-15 Han-Wen Nienhuys <[EMAIL PROTECTED]>
* Documentation/topdocs/README.texi (Top): remove note about
Index: lilypond/scm/editor.scm
diff -u lilypond/scm/editor.scm:1.4 lilypond/scm/editor.scm:1.5
--- lilypond/scm/editor.scm:1.4 Sat May 14 21:43:04 2005
+++ lilypond/scm/editor.scm Sun May 15 11:45:13 2005
@@ -22,11 +22,8 @@
(getenv "EDITOR")
"emacs"))
-(define (re-sub re sub string)
- (regexp-substitute/global #f re string 'pre sub 'post))
-
-(define-public (get-editor-command file-name line column)
- (define (get-command-template alist editor)
+(define (get-command-template alist editor)
+ (define (get-command-template-helper)
(if (null? alist)
(if (string-match "%\\(file\\)s" editor)
editor
@@ -34,12 +31,24 @@
(if (string-match (caar alist) editor)
(cdar alist)
(get-command-template (cdr alist) editor))))
+ (if (string-match "%\\(file\\)s" editor)
+ editor
+ (get-command-template-helper)))
+(define (re-sub re sub string)
+ (regexp-substitute/global #f re string 'pre sub 'post))
+
+(define (slashify x)
+ (if (string-index x #\/)
+ x
+ (re-sub "\\\\" "/" x)))
+
+(define-public (get-editor-command file-name line column)
(let* ((editor (get-editor))
(template (get-command-template editor-command-template-alist editor))
(command
(re-sub "%\\(file\\)s" (format #f "~S" file-name)
(re-sub "%\\(line\\)s" (format #f "~a" line)
(re-sub "%\\(column\\)s" (format #f "~a" column)
- template)))))
+ (slashify template))))))
command))
Index: lilypond/scm/lily.scm
diff -u lilypond/scm/lily.scm:1.337 lilypond/scm/lily.scm:1.338
--- lilypond/scm/lily.scm:1.337 Sat May 14 21:43:04 2005
+++ lilypond/scm/lily.scm Sun May 15 11:45:13 2005
@@ -97,7 +97,7 @@
(define (slashify x)
(if (string-index x #\/)
x
- (string-regexp-substitute "\\" "/" x)))
+ (string-regexp-substitute "\\\\" "/" x)))
;; FIXME: this prints a warning.
(define-public (ly-getcwd)
(slashify (native-getcwd))))
Index: lilypond/scripts/lilypond-invoke-editor.scm
diff -u lilypond/scripts/lilypond-invoke-editor.scm:1.2
lilypond/scripts/lilypond-invoke-editor.scm:1.3
--- lilypond/scripts/lilypond-invoke-editor.scm:1.2 Sat May 14 21:43:04 2005
+++ lilypond/scripts/lilypond-invoke-editor.scm Sun May 15 11:45:13 2005
@@ -1,4 +1,4 @@
[EMAIL PROTECTED]@ \
[EMAIL PROTECTED]@ \
-e main -s
!#
;;;; lilypond-invoke-editor.scm -- Invoke an editor in file:line:column mode
@@ -7,6 +7,9 @@
;;;;
;;;; (c) 2005 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
+;; gui debug helper
+;; (define (exit x) (system "sleep 10"))
+
(use-modules
(ice-9 getopt-long)
(ice-9 regex)
@@ -14,7 +17,7 @@
(srfi srfi-14))
(define PROGRAM-NAME "lilypond-invoke-editor")
-(define TOPLEVEL-VERSION "@TOPLEVEL_VERSION@")
+(define TOPLEVEL-VERSION "2.5.25")
(define DATADIR "@DATADIR@")
(define COMPILE-TIME-PREFIX
(format #f "~a/lilypond/~a" DATADIR TOPLEVEL-VERSION))
@@ -53,15 +56,26 @@
(show-version (current-error-port))
files))
+;;(define (re-sub re sub string)
+;; (let ((sub-string (if (string? sub) sub (sub re))))
+;; (regexp-substitute/global #f re string 'pre sub-string 'post)))
(define (re-sub re sub string)
(regexp-substitute/global #f re string 'pre sub 'post))
+;; FIXME: I'm going slowly but certainly mad, I really cannot find the
+;; scm library function for this.
+(define (unquote-uri uri)
+ (re-sub "%([A-Fa-f0-9]{2})"
+ (lambda (m)
+ (string (integer->char (string->number (match:substring m 1) 16))))
+ uri))
+
(define (dissect-uri uri)
(let* ((ri "textedit://")
(file-name:line:column (re-sub ri "" uri))
(match (string-match "(.*):([^:]+):(.*)$" file-name:line:column)))
(if match
- (list (match:substring match 1)
+ (list (unquote-uri (match:substring match 1))
(match:substring match 2)
(match:substring match 3))
(begin
_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs