* scripts/lilypond-invoke-editor.scm (dissect-uri): add char.
2005-06-08 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * scm/editor.scm: add char argument.
+
+ * scripts/lilypond-invoke-editor.scm (dissect-uri): add char.
+
* ttftool/util.c (syserror): use errno for better error reporting.
* lily/source-file.cc (get_counts): new function. Calc column,
x
(re-sub "\\\\" "/" x)))
-(define-public (get-editor-command file-name line column)
+(define-public (get-editor-command file-name line char column)
(let* ((editor (get-editor))
(template (get-command-template editor-command-template-alist editor))
(command
(define (spawn-editor location)
(let* ((file-name (car location))
(line (cadr location))
- (column (caddr location))
- (command (get-editor-command file line column)))
+ (char (caddr location))
+ (column (cadddr location))
+ (command (get-editor-command file line char column)))
(debugf "spawning: ~s\n" command)
(if (= (primitive-fork) 0)
(let ((command-list (string-split command #\ )));; (get-ifs))))
(begin
;; ugh
(ly:stderr-redirect "foo" "r")
- (system (get-editor-command log-name 0 0))
+ (system (get-editor-command log-name 0 0 0))
(ly:error (_ "failed files: ~S") (string-join failed))
;; not reached?
(exit 1))
(let* ((ly (string-append (ly:effective-prefix) "/ly/"))
;; FIXME: soft-code, localize
(welcome-ly (string-append ly "Welcome_to_LilyPond.ly"))
- (cmd (get-editor-command welcome-ly 0 0)))
+ (cmd (get-editor-command welcome-ly 0 0 0)))
(ly:message (_ "Invoking `~a'...") cmd)
(system cmd)
(exit 1)))
(format port "~a (GNU LilyPond) ~a \n" PROGRAM-NAME TOPLEVEL-VERSION))
(define (show-help port)
- (format port (_ "Usage: lilypond-invoke-editor [textedit://]FILE:LINE:COLUMN
+ (format port (_ "Usage: lilypond-invoke-editor [textedit://]FILE:LINE:CHAR:COLUMN
Visit a file and position the cursor.
(define (dissect-uri uri)
(let* ((ri "textedit://")
- (file-name:line:column (re-sub ri "" uri))
- (match (string-match "(.*):([^:]+):(.*)$" file-name:line:column)))
+ (file-name:line:char:column (re-sub ri "" uri))
+ (match (string-match "(.*):([^:]+):([^:]+):(.*)$" file-name:line:char:column)))
(if match
(list (unquote-uri (match:substring match 1))
(match:substring match 2)
- (match:substring match 3))
+ (match:substring match 3)
+ (match:substring match 4))
(begin
;; FIXME: why be so strict wrt :LINE:COLUMN,
;; esp. considering omitting textedit:// is explicitly
;; allowed.
(format (current-error-port) (_ "invalid URI: ~a") uri)
(newline (current-error-port))
- (format (current-error-port) (_ "expect: ~aFILE:LINE:COLUMN") ri)
+ (format (current-error-port) (_ "expect: ~aFILE:LINE:CHAR:COLUMN") ri)
(newline (current-error-port))
(exit 1)))))