Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 366407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:37:47+00:00 2026-05-12T13:37:47+00:00

I’ve got a Perl script that groks a bunch of log files looking for

  • 0

I’ve got a Perl script that groks a bunch of log files looking for “interesting” lines, for some definition of interesting. It generates an HTML file which consists of a table whose columns are a timestamp, a filename/linenum reference and the “interesting” bit. What I’d love to do is have the filename/linenum be an actual link that will bring up that file with the cursor positioned on that line number, in emacs.

emacsclientw will allow such a thing (e.g. emacsclientw +60 foo.log) but I don’t know what kind of URL/URI to construct that will let FireFox call out to emacsclientw. The original HTML file will be local, so there’s no problem there.

Should I define my own MIME type and hook in that way?

Firefox version is 3.5 and I’m running Windows, in case any of that matters. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:37:47+00:00Added an answer on May 12, 2026 at 1:37 pm

    Thanks for the pointer, p4bl0. Unfortunately, that only works on a real OS; Windows uses a completely different method. See http://kb.mozillazine.org/Register_protocol for more info.

    But, you certainly provided me the start I needed, so thank you very, very much!

    Here’s the solution for Windows:

    First you need to set up the registry correctly to handle this new URL type. For that, save the following to a file, edit it to suit your environment, save it and double click on it:

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\emacs]
    @="URL:Emacs Protocol"
    "URL Protocol"=""
    
    [HKEY_CLASSES_ROOT\emacs\shell]
    
    [HKEY_CLASSES_ROOT\emacs\shell\open]
    
    [HKEY_CLASSES_ROOT\emacs\shell\open\command]
    @="\"c:\\product\\emacs\\bin\\emacsclientw.exe\" --no-wait -e \"(emacs-uri-handler \\\"%1\\\")\""
    

    This is not as robust as p4bl0’s shell script, because it does not make sure that Emacs is running first. Then add the following to 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)))
              (with-current-buffer (find-file filename)
                (goto-line (string-to-number linenum))))
          (beep)
          (message "Unable to parse the URI <%s>"  uri))))
    

    The above code will not check to make sure the file exists, and the error handling is rudimentary at best. But it works!

    Then create an HTML file that has lines like the following:

    <a href="emacs://c:/temp/my.log/60">file: c:/temp/my.log, line: 60</a>
    

    and then click on the link.

    Post Script:

    I recently switched to Linux (Ubuntu 9.10) and here’s what I did for that OS:

    $ gconftool -s /desktop/gnome/url-handlers/emacs/command '/usr/bin/emacsclient --no-wait -e "(emacs-uri-handler \"%s\")"' --type String
    $ gconftool -s /desktop/gnome/url-handlers/emacs/enabled --type Boolean true
    

    Using the same emacs-uri-handler from above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
i got an object with contents of html markup in it, for example: string
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a JSP page retrieving data and when single or double quotes are
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.