From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Defining functions on the fly Date: Mon, 15 Jun 2015 13:52:27 +0200 Message-ID: <87r3pdqjd0.fsf@gnu.org> References: <87wpz5uweg.fsf@kuiper.lan.informatimago.com> <557EB52E.5000602@easy-emacs.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1434369354 2856 80.91.229.3 (15 Jun 2015 11:55:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Jun 2015 11:55:54 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Andreas =?utf-8?Q?R=C3=B6hler?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 15 13:55:46 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z4SzR-0005QE-Eu for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Jun 2015 13:55:45 +0200 Original-Received: from localhost ([::1]:33600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4SzQ-0004oD-Ga for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Jun 2015 07:55:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4SwL-0000TP-QZ for help-gnu-emacs@gnu.org; Mon, 15 Jun 2015 07:52:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4SwG-0005qm-NW for help-gnu-emacs@gnu.org; Mon, 15 Jun 2015 07:52:33 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:40919) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4SwG-0005qE-HF for help-gnu-emacs@gnu.org; Mon, 15 Jun 2015 07:52:28 -0400 Original-Received: from thinkpad-t440p (dhcp148.uni-koblenz.de [141.26.71.148]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id AC7981A834D; Mon, 15 Jun 2015 13:52:27 +0200 (CEST) Mail-Followup-To: Andreas =?utf-8?Q?R=C3=B6hler?= , help-gnu-emacs@gnu.org In-Reply-To: <557EB52E.5000602@easy-emacs.de> ("Andreas \=\?utf-8\?Q\?R\=C3\=B6h\?\= \=\?utf-8\?Q\?ler\=22's\?\= message of "Mon, 15 Jun 2015 13:21:18 +0200") User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.15 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104947 Archived-At: Andreas R=C3=B6hler writes: > It's not about duplication, but derivation. The original DTRT in most > cases. > > Point of interest are the exceptions - see for example in Elixir > > https://github.com/elixir-lang/emacs-elixir/issues/185 > > "\"foo\"" |> String.strip(?") > > Where the doublquote after question mark makes Emacs think it's a > string-start - which isn't. String recognition in emacs is usually done using syntax tables, so get the elixir syntax table right and then you don't need any workarounds. In this case, it seems plain syntax tables aren't enough, though, so the elisp docs explain how to override certain characters' syntax on demand. ,----[ (info "(elisp)Syntax Properties") ] | When the syntax table is not flexible enough to specify the syntax of a | language, you can override the syntax table for specific character | occurrences in the buffer, by applying a =E2=80=98syntax-table=E2=80=99 t= ext property. | *Note Text Properties::, for how to apply text properties. `---- So basically, you (or elixir-mode) will want to define a `syntax-propertize-function' which finds occurrences of ?" and gives "/" (character quote) syntax to the ? in which the usual "\"" (string quotes) syntax of `"' would be ineffective for this single double quote. ,----[ (info "(elisp)Syntax Class Table") ] | Character quotes: =E2=80=98/=E2=80=99 | Characters used to quote the following character so that it loses | its normal syntactic meaning. This differs from an escape | character in that only the character immediately following is ever | affected. |=20 | Characters in this class count as part of words if | =E2=80=98words-include-escapes=E2=80=99 is non-=E2=80=98nil=E2=80=99= . *Note Word Motion::. `---- Bye, Tassilo