From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: regex-opt does not accept 'symbol as second arg? Date: Sun, 12 Oct 2008 12:45:32 +1100 Organization: Rapt Technologies Message-ID: <87vdvy8u2r.fsf@lion.rapttech.com.au> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1223779248 30002 80.91.229.12 (12 Oct 2008 02:40:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Oct 2008 02:40:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 12 04:41:46 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Koqtt-00062w-JS for geh-help-gnu-emacs@m.gmane.org; Sun, 12 Oct 2008 04:41:45 +0200 Original-Received: from localhost ([127.0.0.1]:39446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Koqsp-0007A3-D7 for geh-help-gnu-emacs@m.gmane.org; Sat, 11 Oct 2008 22:40:39 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news.astraweb.com!border1.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:Y/7ZTxCj30vqLsyh0PspPoQ84pc= Original-Lines: 43 Original-NNTP-Posting-Host: 5b61bf8b.news.astraweb.com Original-X-Trace: DXC==\>`\KoG2kCDIol_\Lk[aFL?0kYOcDh@J; >GTR`=ZX:BoWjeWga8coG9ZI1Z0_R6kGccWRXDMd9OI Original-Xref: news.stanford.edu gnu.emacs.help:163359 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58702 Archived-At: Nikolaj Schumacher writes: > "Lennart Borgman" wrote: > >> On Sat, Oct 11, 2008 at 12:02 PM, Xah wrote: >>> the regexp-opt accept a second argument of "'word", but it doesn't >>> accept "'symbol"? >>> >>> Shouldn't it? > > Sure, why not. > >> Would not the semantics be exactly the same? > > No, "\\<\\(\\w\\|\\s_+\\)+" (word delimiters) doesn't match the entire > lisp symbol `-test'. In emacs 23, it appears to be working as it is supposed to. It does take an arbitrary symbol, but the symbol "'words" has special meaning over just a non-nil value e.g. ELISP> (regexp-opt '("This" "That" "Those")) "\\(?:Th\\(?:at\\|is\\|ose\\)\\)" ELISP> (regexp-opt '("This" "That" "Those") t) "\\(Th\\(?:at\\|is\\|ose\\)\\)" ELISP> (regexp-opt '("This" "That" "Those") 'words) "\\<\\(Th\\(?:at\\|is\\|ose\\)\\)\\>" ELISP> (regexp-opt '("This" "That" "Those") 'test) "\\(Th\\(?:at\\|is\\|ose\\)\\)" ELISP> (regexp-opt '("This" "That" "Those") 'symbol) "\\(Th\\(?:at\\|is\\|ose\\)\\)" ELISP> Note that the "special meaning" symbol is 'words and not 'word. Tim P.S. From memory, I think an older version of regexp-opt actually took an additional two symbols, one added the regexp grouping construct and the other added the word boundry \< and \>. -- tcross (at) rapttech dot com dot au