[Top][All Lists]

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

Re: Insert appropriate line-end character (like ';' for C*)

From: Thien-Thi Nguyen
Subject: Re: Insert appropriate line-end character (like ';' for C*)
Date: Wed, 11 Jun 2008 22:20:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

() Josh <address@hidden>
() Wed, 11 Jun 2008 12:09:58 -0700 (PDT)

   I don't know how to programatically
   determine what the correct character is.

That depends on the programming language, which in the
context of Emacs is largely tied to its major mode.

Thus, you might get by w/ something like:

(defvar finish-statement-character
  '((c-mode . ";")
    (c++-mode . ";"))
  "Alist mapping major mode to a \"finish statement\" character.")

(defun finish-statement-and-start-another ()
  (let ((s (cdr (assq major-mode finish-statement-character))))
    (when s (insert s)))

You can then extend finish-statement-character to DTRT, over time.


reply via email to

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