2010-08-09 61 views
0

搜索filename . "myfile.txt"的elisp:搜索與不平衡報價字符串導致Lisp的錯誤

(regexp-quote "filename \. \"\\(.+\\)\"") 
"filename \\. \"\\\\(\\.\\+\\\\)\"" 

搜索filename . "myfile.txt(不包括最後一個引號)

(regexp-quote "filename \. \"\\(.+\\)") 
Debugger entered--Lisp error: (invalid-read-syntax ") or . in a vector") 
    read(#<buffer processing-files.el>) 
    preceding-sexp() 
    eval-last-sexp-1(t) 
    eval-last-sexp(t) 
    eval-print-last-sexp() 
    call-interactively(eval-print-last-sexp nil nil) 
+0

下面是另一個簡單的例子失敗

 (re-search-forward "\"" (point-max) t) Debugger entered--Lisp error: (scan-error "Unbalanced parentheses" 2308 1) scan-sexps(2309 -1) forward-sexp(-1) preceding-sexp() eval-last-sexp-1(nil) eval-last-sexp(nil) call-interactively(eval-last-sexp nil nil) 
我使用 GNU Emacs的24.0.50.1(I386 -mingw-nt6.1.7600)2010-08-04上 LENNART-69DE564 Windows 7 Ultimate – dericbytes 2010-08-09 09:14:28

+0

當emacs加載時沒有我的個人配置文件 – dericbytes 2010-08-09 09:27:20

+0

只是註釋掉你的配置文件的不同部分,直到你縮小它。 – phils 2010-08-09 21:52:41

回答

0

我認爲你誤解了正則表達式引號的意思是:

來自doc(Ch Cf regexp-quote RET)

返回一個正則表達式字符串,它完全匹配字符串,而不是其他字符串。

或者我誤解了你的問題。

無論如何,如果你想搜索有一些功能搜索向後正則表達式,搜索前進,正則表達式