[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 8c39268: Fix minor issues with CEDET on MS-Windows
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master 8c39268: Fix minor issues with CEDET on MS-Windows |
Date: |
Mon, 04 May 2015 14:47:16 +0000 |
branch: master
commit 8c392682fc9938b2ee02cc2741bf6f680281b0c7
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
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.
---
lisp/cedet/semantic/bovine/gcc.el | 12 +++++-------
lisp/cedet/semantic/symref/grep.el | 28 ++++++++++++++++++++--------
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 19d1491..b186e7b 100644
--- a/lisp/cedet/semantic/bovine/gcc.el
+++ b/lisp/cedet/semantic/bovine/gcc.el
@@ -86,13 +86,11 @@ to give to the program."
(let ((chars (append line nil)))
(when (= 32 (nth 0 chars))
(let ((path (substring line 1)))
- (when (file-accessible-directory-p path)
- (when (if (memq system-type '(windows-nt))
- (/= ?/ (nth 1 chars))
- (= ?/ (nth 1 chars)))
- (add-to-list 'inc-path
- (expand-file-name (substring line 1))
- t)))))))))
+ (when (and (file-accessible-directory-p path)
+ (file-name-absolute-p path))
+ (add-to-list 'inc-path
+ (expand-file-name path)
+ t))))))))
inc-path))
diff --git a/lisp/cedet/semantic/symref/grep.el
b/lisp/cedet/semantic/symref/grep.el
index 981dab8..d57b50f 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."
;; We have grep-compute-defaults. Let's use it.
(grep-compute-defaults)
(let* ((grep-expand-keywords semantic-symref-grep-expand-keywords)
- (cmd (grep-expand-template grep-find-template
- greppattern
- filepattern
- rootdir)))
+ (cmd (grep-expand-template
+ (if (memq system-type '(windows-nt ms-dos))
+ ;; grep-find uses '--color=always' on MS-Windows
+ ;; because it wants the colorized output, to show
+ ;; it to the user. By contrast, here we don't show
+ ;; the output, and the SGR escapes get in the way
+ ;; of parsing the output.
+ (replace-regexp-in-string "--color=always" ""
+ grep-find-template t t)
+ grep-find-template)
+ greppattern
+ filepattern
+ rootdir)))
;; For some reason, my default has no <D> in it.
(when (string-match "find \\(\\.\\)" cmd)
(setq cmd (replace-match rootdir t t cmd 1)))
;;(message "New command: %s" cmd)
cmd))
-(defcustom semantic-symref-grep-shell "sh"
+(defcustom semantic-symref-grep-shell shell-file-name
"The shell command to use for executing find/grep.
This shell should support pipe redirect syntax."
:group 'semantic
@@ -140,7 +149,8 @@ This shell should support pipe redirect syntax."
(greppat (cond ((eq (oref tool :searchtype) 'regexp)
(oref tool searchfor))
(t
- (concat "'\\<" (oref tool searchfor) "\\>'"))))
+ (shell-quote-argument
+ (concat "\\<" (oref tool searchfor) "\\>")))))
;; Misc
(b (get-buffer-create "*Semantic SymRef*"))
(ans nil)
@@ -158,10 +168,12 @@ This shell should support pipe redirect syntax."
(let ((cmd (concat "find " default-directory " -type f " filepattern
" -print0 "
"| xargs -0 grep -H " grepflags "-e " greppat)))
;;(message "Old command: %s" cmd)
- (call-process semantic-symref-grep-shell nil b nil "-c" cmd)
+ (call-process semantic-symref-grep-shell nil b nil
+ shell-command-switch cmd)
)
(let ((cmd (semantic-symref-grep-use-template rootdir filepattern
grepflags greppat)))
- (call-process semantic-symref-grep-shell nil b nil "-c" cmd))
+ (call-process semantic-symref-grep-shell nil b nil
+ shell-command-switch cmd))
))
(setq ans (semantic-symref-parse-tool-output tool b))
;; Return the answer
diff --git a/lisp/cedet/semantic/symref/idutils.el
b/lisp/cedet/semantic/symref/idutils.el
index c22a6a3..655b000 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."
(when (re-search-forward "^\\([^ ]+\\) " nil t)
(match-string 1)))
(t
- (when (re-search-forward "^\\([^ :]+\\):+\\([0-9]+\\):" nil t)
+ (when (re-search-forward
"^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):" nil t)
(cons (string-to-number (match-string 2))
(expand-file-name (match-string 1) default-directory))
))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 8c39268: Fix minor issues with CEDET on MS-Windows,
Eli Zaretskii <=