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

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

Re: simple editor required


From: Kai Großjohann
Subject: Re: simple editor required
Date: Fri, 20 Jun 2003 16:40:50 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

"Paul Edwards" <kerravon@nosppaam.w3.to> writes:

> If I am at the beginning of the "cccc" line and I hit enter,
> emacs is inspired to indent cccc to be under bbbb.  I don't
> want that, I want cccc to stay where it is.  If I wanted cccc
> to be indented I would do something, e.g. press tab or hit
> spaces.

Okay, so if the previous line exists and is not blank, then indent
the new line to the previous line after RET.

Yeah, I'm afraid you'll have to write your own indentation function.
Maybe this one?

(defun pe-indent-relative ()
  "Like `indent-relative' but don't indent after blank line."
  (when (save-excursion
          (and (zerop (forward-line -1))
               (not (looking-at "\s-*$"))))
    (indent-relative-maybe)))

(defun pe-text-setup ()
  (setq indent-line-function 'pe-indent-relative))

(add-hook 'text-mode-hook 'pe-text-setup)

Maybe it works, but I haven't tested it.
-- 
This line is not blank.


reply via email to

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