[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-recutils] [bug #44955] `rec-cmd-compile' fails with file paths cont

From: anonymous
Subject: [bug-recutils] [bug #44955] `rec-cmd-compile' fails with file paths containing spaces
Date: Wed, 29 Apr 2015 04:49:20 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.5.17 (KHTML, like Gecko) Version/8.0.5 Safari/600.5.17


                 Summary: `rec-cmd-compile' fails with file paths containing
                 Project: GNU recutils
            Submitted by: None
            Submitted on: Wed 29 Apr 2015 04:49:19 AM UTC
                Category: rec-mode
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any



In rec-mode for Emacs, using the "c" key-binding to check my files would give
a compilation error which mostly listed the --help from recfix. After staring
at the first couple of lines of output in the compilation buffer (which seemed
to have the command and argument) I finally realized the path to my files had
a directory with a space in the name.

The function description for `rec-mode' mentioned the "c" key-binding used
`rec-cmd-compile' in the "rec-mode.el" file. It uses `concat' to append the
command to the file path. Searching online I found `shell-quote-argument':

I added that in two places within `rec-cmd-compile', but I think I've only
tested the THEN option of the `if' but not its ELSE option (that is, not the
`with-temp-file' part). What I mean is, I changed the ELSE first (I chose it
first by accident) and that didn't have an effect. I then changed the THEN
part and that did work. I'm assuming both areas need addressing.

Here's the defun for it with the two changes indicated by a comment with
"HERE" on the line before. The change is to use `shell-quote-argument' with
the file path as its argument.

(defun rec-cmd-compile ()
  "Compile the current file with recfix."
  (let ((cur-buf (current-buffer))
        (cmd (concat rec-recfix " "))
        (tmpfile (make-temp-file "rec-mode-")))
    (if buffer-file-name
;; HERE (1/2)
        (setq cmd (concat cmd (shell-quote-argument buffer-file-name)))
      (with-temp-file tmpfile
        (insert-buffer-substring cur-buf))
;; HERE (2/2)
      (setq cmd (concat cmd (shell-quote-argument tmpfile))))
    (compilation-start cmd)))


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]