diff options
| author | Eli Zaretskii | 2015-05-04 17:46:30 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-05-04 17:46:30 +0300 |
| commit | 8c392682fc9938b2ee02cc2741bf6f680281b0c7 (patch) | |
| tree | a7f9d2820d72e43fd77d18299cb88b7701ae420a | |
| parent | 5d3940a3b9144efbc4db4a7b76a3331cebc64165 (diff) | |
| download | emacs-8c392682fc9938b2ee02cc2741bf6f680281b0c7.tar.gz emacs-8c392682fc9938b2ee02cc2741bf6f680281b0c7.zip | |
Fix minor issues with CEDET on MS-Windows
* lisp/cedet/semantic/symref/idutils.el
(semantic-symref-parse-tool-output-one-line): Fix the search
regexp to match MS-Windows file names with drive letters.
(Bug#19468)
* lisp/cedet/semantic/symref/grep.el
(semantic-symref-grep-use-template): Remove "--color=always" from
Grep switches on MS-Windows.
(semantic-symref-grep-shell): Use shell-file-name as the default
value, so this works not only on Posix platforms.
(semantic-symref-perform-search): Use shell-quote-argument instead
of literal '..' for portable quoting of Grep command-line
argument. Use shell-command-switch instead of a literal "-c".
* lisp/cedet/semantic/bovine/gcc.el
(semantic-gcc-get-include-paths): Use file-name-absolute-p to test
for an absolute file name in a portable way.
| -rw-r--r-- | lisp/cedet/semantic/bovine/gcc.el | 12 | ||||
| -rw-r--r-- | lisp/cedet/semantic/symref/grep.el | 28 | ||||
| -rw-r--r-- | lisp/cedet/semantic/symref/idutils.el | 2 |
3 files changed, 26 insertions, 16 deletions
diff --git a/lisp/cedet/semantic/bovine/gcc.el b/lisp/cedet/semantic/bovine/gcc.el index 19d149112c6..b186e7bd6ee 100644 --- a/lisp/cedet/semantic/bovine/gcc.el +++ b/lisp/cedet/semantic/bovine/gcc.el | |||
| @@ -86,13 +86,11 @@ to give to the program." | |||
| 86 | (let ((chars (append line nil))) | 86 | (let ((chars (append line nil))) |
| 87 | (when (= 32 (nth 0 chars)) | 87 | (when (= 32 (nth 0 chars)) |
| 88 | (let ((path (substring line 1))) | 88 | (let ((path (substring line 1))) |
| 89 | (when (file-accessible-directory-p path) | 89 | (when (and (file-accessible-directory-p path) |
| 90 | (when (if (memq system-type '(windows-nt)) | 90 | (file-name-absolute-p path)) |
| 91 | (/= ?/ (nth 1 chars)) | 91 | (add-to-list 'inc-path |
| 92 | (= ?/ (nth 1 chars))) | 92 | (expand-file-name path) |
| 93 | (add-to-list 'inc-path | 93 | t)))))))) |
| 94 | (expand-file-name (substring line 1)) | ||
| 95 | t))))))))) | ||
| 96 | inc-path)) | 94 | inc-path)) |
| 97 | 95 | ||
| 98 | 96 | ||
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 981dab8a8b5..d57b50fb98f 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el | |||
| @@ -105,17 +105,26 @@ GREPPATTERN is the pattern used by grep." | |||
| 105 | ;; We have grep-compute-defaults. Let's use it. | 105 | ;; We have grep-compute-defaults. Let's use it. |
| 106 | (grep-compute-defaults) | 106 | (grep-compute-defaults) |
| 107 | (let* ((grep-expand-keywords semantic-symref-grep-expand-keywords) | 107 | (let* ((grep-expand-keywords semantic-symref-grep-expand-keywords) |
| 108 | (cmd (grep-expand-template grep-find-template | 108 | (cmd (grep-expand-template |
| 109 | greppattern | 109 | (if (memq system-type '(windows-nt ms-dos)) |
| 110 | filepattern | 110 | ;; grep-find uses '--color=always' on MS-Windows |
| 111 | rootdir))) | 111 | ;; because it wants the colorized output, to show |
| 112 | ;; it to the user. By contrast, here we don't show | ||
| 113 | ;; the output, and the SGR escapes get in the way | ||
| 114 | ;; of parsing the output. | ||
| 115 | (replace-regexp-in-string "--color=always" "" | ||
| 116 | grep-find-template t t) | ||
| 117 | grep-find-template) | ||
| 118 | greppattern | ||
| 119 | filepattern | ||
| 120 | rootdir))) | ||
| 112 | ;; For some reason, my default has no <D> in it. | 121 | ;; For some reason, my default has no <D> in it. |
| 113 | (when (string-match "find \\(\\.\\)" cmd) | 122 | (when (string-match "find \\(\\.\\)" cmd) |
| 114 | (setq cmd (replace-match rootdir t t cmd 1))) | 123 | (setq cmd (replace-match rootdir t t cmd 1))) |
| 115 | ;;(message "New command: %s" cmd) | 124 | ;;(message "New command: %s" cmd) |
| 116 | cmd)) | 125 | cmd)) |
| 117 | 126 | ||
| 118 | (defcustom semantic-symref-grep-shell "sh" | 127 | (defcustom semantic-symref-grep-shell shell-file-name |
| 119 | "The shell command to use for executing find/grep. | 128 | "The shell command to use for executing find/grep. |
| 120 | This shell should support pipe redirect syntax." | 129 | This shell should support pipe redirect syntax." |
| 121 | :group 'semantic | 130 | :group 'semantic |
| @@ -140,7 +149,8 @@ This shell should support pipe redirect syntax." | |||
| 140 | (greppat (cond ((eq (oref tool :searchtype) 'regexp) | 149 | (greppat (cond ((eq (oref tool :searchtype) 'regexp) |
| 141 | (oref tool searchfor)) | 150 | (oref tool searchfor)) |
| 142 | (t | 151 | (t |
| 143 | (concat "'\\<" (oref tool searchfor) "\\>'")))) | 152 | (shell-quote-argument |
| 153 | (concat "\\<" (oref tool searchfor) "\\>"))))) | ||
| 144 | ;; Misc | 154 | ;; Misc |
| 145 | (b (get-buffer-create "*Semantic SymRef*")) | 155 | (b (get-buffer-create "*Semantic SymRef*")) |
| 146 | (ans nil) | 156 | (ans nil) |
| @@ -158,10 +168,12 @@ This shell should support pipe redirect syntax." | |||
| 158 | (let ((cmd (concat "find " default-directory " -type f " filepattern " -print0 " | 168 | (let ((cmd (concat "find " default-directory " -type f " filepattern " -print0 " |
| 159 | "| xargs -0 grep -H " grepflags "-e " greppat))) | 169 | "| xargs -0 grep -H " grepflags "-e " greppat))) |
| 160 | ;;(message "Old command: %s" cmd) | 170 | ;;(message "Old command: %s" cmd) |
| 161 | (call-process semantic-symref-grep-shell nil b nil "-c" cmd) | 171 | (call-process semantic-symref-grep-shell nil b nil |
| 172 | shell-command-switch cmd) | ||
| 162 | ) | 173 | ) |
| 163 | (let ((cmd (semantic-symref-grep-use-template rootdir filepattern grepflags greppat))) | 174 | (let ((cmd (semantic-symref-grep-use-template rootdir filepattern grepflags greppat))) |
| 164 | (call-process semantic-symref-grep-shell nil b nil "-c" cmd)) | 175 | (call-process semantic-symref-grep-shell nil b nil |
| 176 | shell-command-switch cmd)) | ||
| 165 | )) | 177 | )) |
| 166 | (setq ans (semantic-symref-parse-tool-output tool b)) | 178 | (setq ans (semantic-symref-parse-tool-output tool b)) |
| 167 | ;; Return the answer | 179 | ;; Return the answer |
diff --git a/lisp/cedet/semantic/symref/idutils.el b/lisp/cedet/semantic/symref/idutils.el index c22a6a3b7fb..655b000ccdd 100644 --- a/lisp/cedet/semantic/symref/idutils.el +++ b/lisp/cedet/semantic/symref/idutils.el | |||
| @@ -60,7 +60,7 @@ Moves cursor to end of the match." | |||
| 60 | (when (re-search-forward "^\\([^ ]+\\) " nil t) | 60 | (when (re-search-forward "^\\([^ ]+\\) " nil t) |
| 61 | (match-string 1))) | 61 | (match-string 1))) |
| 62 | (t | 62 | (t |
| 63 | (when (re-search-forward "^\\([^ :]+\\):+\\([0-9]+\\):" nil t) | 63 | (when (re-search-forward "^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):" nil t) |
| 64 | (cons (string-to-number (match-string 2)) | 64 | (cons (string-to-number (match-string 2)) |
| 65 | (expand-file-name (match-string 1) default-directory)) | 65 | (expand-file-name (match-string 1) default-directory)) |
| 66 | )))) | 66 | )))) |