all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: jack-mac <duthen.mac@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: My humble additions to AUCTeX
Date: Mon, 13 Jan 2014 08:35:32 -0800 (PST)	[thread overview]
Message-ID: <0b7644c6-18c5-4b4c-b5c6-1c08fecd1918@googlegroups.com> (raw)
In-Reply-To: <mailman.11758.1389569313.10748.help-gnu-emacs@gnu.org>


Le lundi 13 janvier 2014 00:28:18 UTC+1, Marcin Borkowski a écrit :
> Also, I still consider myself an Elisp newbie, so it is well possible
> that I did violate some conventions ar good style...
> 
> http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski

In this file, you wrote:
(defun TeX+-letter (&optional at-is-letter)
  "Returns a character class matching letters (including \"@\" if
  AT-IS-LETTER is true)."
  (concat "a-zA-Z"
          (if at-is-letter "@")))

(defun TeX+-looking-at-letter (&optional at-is-letter)
  "Returns t if the point is at a letter (including \"@\" if
AT-IS-LETTER; default is not)."
  (looking-at (concat "[" (TeX+-letter at-is-letter) "]")))


These function create a new string each time they are called (even if at-is-letter is nil).

For efficiency purpose, I would suggest to "compile" them by hand into something like:

(defconst TeX+-letter-ccml        "a-zA-Z"
  "A character class matching letters")

(defconst TeX+-letter-and-at-ccml (concat TeX+-letter-ccml "@")
  "A character class matching letters including \"@\"")

(defconst TeX+-letter-re          (concat "[" TeX+-letter-ccml        "]")
  "A regexp for character class matching letters")

(defconst TeX+-letter-and-at-re   (concat "[" TeX+-letter-and-at-ccml "]")
  "A regexp for character class matching letters including \"@\"")

(defun TeX+-letter (&optional at-is-letter)
  "Returns a character class matching letters (including \"@\" if
  AT-IS-LETTER is true)."
  (if at-is-letter TeX+-letter-and-at-ccml TeX+-letter-ccml))


(defun TeX+-looking-at-letter (&optional at-is-letter)
  "Returns t if the point is at a letter (including \"@\" if
AT-IS-LETTER; default is not)."
  (looking-at (if at-is-letter TeX+-letter-and-at-re TeX+-letter-re)))

HTH

)jack(


       reply	other threads:[~2014-01-13 16:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.11758.1389569313.10748.help-gnu-emacs@gnu.org>
2014-01-13 16:35 ` jack-mac [this message]
2014-01-13 18:11   ` My humble additions to AUCTeX Marcin Borkowski
2014-01-12 23:28 Marcin Borkowski
2014-01-13 16:49 ` Nicolas Richard
2014-01-13 18:16   ` Marcin Borkowski
2014-01-13 20:47     ` Stefan Monnier
2014-01-14  9:57       ` Marcin Borkowski
2014-01-14 10:16         ` Marcin Borkowski
2014-01-15 13:26         ` Stefan Monnier
2015-01-20 15:25       ` Marcin Borkowski
2015-01-20 16:32         ` Artur Malabarba
2015-01-20 16:45           ` Marcin Borkowski
2015-01-20 18:42           ` Stefan Monnier
     [not found]           ` <mailman.18220.1421779378.1147.help-gnu-emacs@gnu.org>
2015-01-21  2:34             ` Rusi
2014-01-14 10:29     ` Nicolas Richard
2014-01-15 17:58       ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b7644c6-18c5-4b4c-b5c6-1c08fecd1918@googlegroups.com \
    --to=duthen.mac@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.