Skip to content

Commit

Permalink
add new place holder %d that mean directory absolute path of source file
Browse files Browse the repository at this point in the history
  • Loading branch information
syohex committed Dec 18, 2011
1 parent d2ad7ab commit 410eb55
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion quickrun.el
Original file line number Diff line number Diff line change
Expand Up @@ -457,13 +457,14 @@ if you set your own language configuration.
;; Composing command
;;
(defconst quickrun/template-place-holders
'("%c" "%o" "%s" "%a" "%n" "%N" "%e" "%E")
'("%c" "%o" "%s" "%a" "%d" "%n" "%N" "%e" "%E")
"A list of place holders of each language parameter.
Place holders are beginning with '%' and replaced by:
%c: :command parameter
%o: command options
%s: source code
%a: program argument
%d: directory name
%n: abosolute path of source code without extension
%N: source code name without extension
%e: abosolute path of source code with exeutable extension(.exe, .out, .class)
Expand All @@ -477,13 +478,16 @@ Place holders are beginning with '%' and replaced by:

(defun quickrun/place-holder-info (cmd cmdopt src args)
(let* ((without-extension (file-name-sans-extension src))
(dirname (file-name-directory (expand-file-name src)))
(directory (substring dirname 0 (- (length dirname) 1)))
(executable-suffix (quickrun/executable-suffix cmd))
(executable-name (concat without-extension executable-suffix)))
`(("%c" . ,cmd)
("%o" . ,cmdopt)
("%s" . ,src)
("%n" . ,(expand-file-name without-extension))
("%N" . ,without-extension)
("%d" . ,directory)
("%e" . ,(expand-file-name executable-name))
("%E" . ,executable-name)
("%a" . ,args))))
Expand Down Expand Up @@ -711,6 +715,7 @@ by quickrun.el. But you can register your own command for some languages")
(defun quickrun/command-key (src)
(let ((file-type (quickrun/decide-file-type src)))
(or (and current-prefix-arg (quickrun/prompt))
(and quickrun-option-cmd-alist "_user_defined")
quickrun-option-cmdkey
(gethash file-type quickrun/command-key-table)
file-type
Expand Down

0 comments on commit 410eb55

Please sign in to comment.