[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-recutils] [bug #44957] `rec-cmd-compile' fails with file paths cont
From: |
Thom |
Subject: |
[bug-recutils] [bug #44957] `rec-cmd-compile' fails with file paths containing spaces |
Date: |
Wed, 29 Apr 2015 05:18:36 +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 |
URL:
<http://savannah.gnu.org/bugs/?44957>
Summary: `rec-cmd-compile' fails with file paths containing
spaces
Project: GNU recutils
Submitted by: thomq
Submitted on: Wed 29 Apr 2015 05:18:35 AM GMT
Category: rec-mode
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
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':
http://www.gnu.org/software/emacs/manual/html_node/elisp/Shell-Arguments.html
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."
(interactive)
(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:
<http://savannah.gnu.org/bugs/?44957>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug-recutils] [bug #44957] `rec-cmd-compile' fails with file paths containing spaces,
Thom <=