all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Roberto Huelga <rhuelga@multinterior.com>
Subject: Re: Abbrevs and Comments
Date: Sun, 26 Jan 2003 18:44:35 +0100	[thread overview]
Message-ID: <D5C8B9D8-3155-11D7-B6FD-00039368DF30@multinterior.com> (raw)
In-Reply-To: <CF736008-26EF-11D7-9E10-00039368DF30@multinterior.com>


El lunes, 13 ener, 2003, a las 13:09 Europe/Madrid, Roberto Huelga 
escribió:

> Hello, and happy new year to every body (my first mail of the year).
>
> 	I recently modify my .emacs file to make use of abbrev and skeletons 
> in c-mode and c++-mode. I make that "if" expands to "if() { }" and all 
> is prefect. But When I'm writing a comment or a literal the abbrev 
> expands too. Is there a automatic way to don't expand in these 
> situations?.
>
	I finally develop a automatic way, may be not optimal but work great 
in my computer. I look the face in the current point and I modify the 
local-abbrev-table in consequence. Insert this in .emacs to try it

(add-hook 'pre-abbrev-expand-hook 'abbrev-literal-test)
(defun abbrev-literal-test()
   (let* ((face (get-text-property (point) 'face )))
     (if (or (equal face 'font-lock-comment-face)
	    (equal face 'font-lock-string-face)
	    (equal face 'font-lock-warning-face))
	(setq local-abbrev-table nil)
       (setq local-abbrev-table (eval
				(car
				 (read-from-string
				  (format "%s-abbrev-table" major-mode)))))
       )))

	If someone optimise this or found a better way, please tell me.

  reply	other threads:[~2003-01-26 17:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-13 12:09 Abbrevs and Comments Roberto Huelga
2003-01-26 17:44 ` Roberto Huelga [this message]
2003-02-03 11:16   ` gebser
     [not found] <mailman.211.1042460105.21513.help-gnu-emacs@gnu.org>
2003-01-13 12:32 ` Romain FRANCOISE

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=D5C8B9D8-3155-11D7-B6FD-00039368DF30@multinterior.com \
    --to=rhuelga@multinterior.com \
    /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.