help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Abbrev , as ,_


From: Roberto Huelga
Subject: Re: Abbrev , as ,_
Date: Thu, 30 Oct 2003 15:46:56 +0100


El Jueves, 30 octubre, 2003, a las 05:27 AM, Dan Anderson escribió:

Out of curiosity, wouldn't that mean that typing in:

foo = "1,2,3,4,5";

Would create:

foo = "1, 2, 3, 4, 5";

And cause problems?  Granted many times commas and spaces go hand in
hand, but in scenarios like a CSV list it would be horribly wrong.

-Dan

Here is the solution, it don't expand in comments, strings and others contexts.

(define-key c-mode-map ","
  (lambda ()
    (interactive)
    (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)
            (equal face 'font-lock-doc-face))
        (insert ",")
        (insert ", ")
      ))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]