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

  • SEARCH
  • Home
  • 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 6209547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:00:21+00:00 2026-05-24T06:00:21+00:00

I am using the openwith package in emacs. I would like to open .fig

  • 0

I am using the openwith package in emacs. I would like to open .fig files with xfig with some additional options, for example:

xfig -specialtext -latexfont -startlatexFont default file.fig

openwith is working for me with other file associations where I don’t need to pass additional options. I tried the following in my .emacs file

(setq
 openwith-associations 
 '(("\\.fig\\'" "xfig" (file))))

which works, but

(setq
 openwith-associations 
 '(("\\.fig\\'" "xfig -specialtext -latexfont -startlatexFont default" (file))))

does not work (error: Wrong type argument: arrayp, nil), also

(setq
 openwith-associations 
 '(("\\.fig\\'" "xfig" (" -specialtext -latexfont -startlatexFont default " file))))

does not work, although here I don’t get any error. It says “Opened file.fig in external program” but nothing happens. In this case, I notice that there is an xfig process running with all these options.

Could someone let me know how to fix this?

Thanks for the help.

  • 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-24T06:00:22+00:00Added an answer on May 24, 2026 at 6:00 am

    I have no clue how this works, so I just document how one can figure it by reading the code:

    The important code in openwith.el is the call to start-process in:

    (dolist (oa openwith-associations)
      (let (match)
        (save-match-data
          (setq match (string-match (car oa) (car args))))
        (when match
          (let ((params (mapcar (lambda (x)
                      (if (eq x 'file)
                      (car args)
                      (format "%s" x))) (nth 2 oa))))
        (apply #'start-process "openwith-process" nil
               (cadr oa) params))
          (kill-buffer nil)
          (throw 'openwith-done t))))
    

    The in your case oa would have the following structure, and the cadr is “xfig”:

    (cadr '("\.fig\'" "xfig" (file))) ;; expands to => xfig
    

    This is the definition and doc of start-process:

    Function: start-process name buffer-or-name program &rest args
    http://www.gnu.org/software/emacs/elisp/html_node/Asynchronous-Processes.html

     args, are strings that specify command line arguments for the program.
    

    An example:

    (start-process "my-process" "foo" "ls" "-l" "/user/lewis/bin")
    

    Now we need to figure out how params is constructed. With your example the argument to the mapcar is:

    (nth 2 '("\.fig\'" "xfig" (file))) ;=> (file)
    

    By the way you can write such lines in the scratch buffer in emacs and run them with C-M-x.

    The (car args) refers to the parameter you give to openwith-association, note how the occurance of ‘file in (nth 2 oa) is replaced by that. I’ll just replace it with “here.txt” for now:

    (mapcar (lambda (x)
          (if (eq x 'file)
              "here.txt"
              (format "%s" x))) (nth 2 '("\.fig\'" "xfig" (file)))) ;=> ("here.txt")
    

    Okay, now we see how the argument should be constructed:

    (mapcar (lambda (x)
          (if (eq x 'file)
              "here.txt"
              (format "%s" x))) 
        (nth 2 '("\.fig\'" "xfig" 
             ("-specialtext" "-latexfont" "-startlatexFont" "default" file))))
    ; => ("-specialtext" "-latexfont" "-startlatexFont" "default" "here.txt")
    

    Try this:

    (setq openwith-associations 
     '(("\\.fig\\'" "xfig" ("-specialtext" "-latexfont" "-startlatexFont" "default" file))))
    

    You have to supply each word as a single string in the list of parameters.

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

Sidebar

Related Questions

I'm using Visual Studio 2008 and SQL Server 2008. I would like .sql files
I would like to safely be able to simulate open with O_CREAT | O_WRONLY
I made an AIR application that parses some specific files. I am using flex
I would like to try open file without extension. When I try to open
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I'd like to see if I can reduce VM latencies by using Mono's AOT
Using Google Maps, I am trying to have an info window open with tabs
I'm using Ruby's CSV library to parse some CSV. I have a seemingly well-formed
When I open a file using fopen($filename, 'w+') (that is, reading and writing), it

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.