You are talking about insertion to open the file (I assume you mean the hint of the find file inside emacs), as well as doing something from the command line. If you want to copy and paste, you need to do something like what Ivan showed with a hyphen. If you want something from the command line, you can do the following. I adapted this from what I did a year ago, with the emacs: // URI handler (for use from Firefox):
Put this in your .emacs file:
(defun emacs-uri-handler (uri) "Handles emacs URIs in the form: emacs:///path/to/file/LINENUM" (save-match-data (if (string-match "emacs://\\(.*\\)/\\([0-9]+\\)$" uri) (let ((filename (match-string 1 uri)) (linenum (match-string 2 uri))) (while (string-match "\\(%20\\)" filename) (setq filename (replace-match " " nil t filename 1))) (with-current-buffer (find-file filename) (goto-line (string-to-number linenum)))) (beep) (message "Unable to parse the URI <%s>" uri))))
and then create a shell script in your path (I called my 'emacsat):
#!/bin/bash emacsclient --no-wait -e "(emacs-uri-handler \"emacs://$1/${2:-1}\")"
The DOS script package will be similar, but I do not know how to make the default values (although I am sure you can do this).
See How to configure firefox to run emacsclientw with specific links? for more instructions if you want to integrate with Firefox.
Joe Casadonte Jun 29 2018-10-06T00: 00Z
source share