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

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

[SOLVED] Re: Enriched mode: avoid removing my manual indents


From: Alexandre Oberlin
Subject: [SOLVED] Re: Enriched mode: avoid removing my manual indents
Date: Sat, 15 Feb 2014 18:32:44 +0100
User-agent: Opera Mail/12.16 (Linux)

Hi all,

Old issue solved, just in case someone else uses enriched-mode, which I
personally find invaluable to highlight my notes with colours or styles.

Let’s recall the problem:
On Fri, 24 May 2013 14:42:12 +0200, Alexandre Oberlin
<email_through@migo.info> wrote:
I use enriched mode extensively but if I start a new line say on column 8, then why does enriched mode think that is an error and put it back to beginning of line as soon as I type return ?

On Mon, 27 May 2013 20:55:37 +0200, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
`enriched-mode' was the beginning of something that never materialized,
so it's no wonder it doesn't work exactly like you want.

It's not used very much as far as I know.  But I think Drew's point is
right, in that it would make sense to split enriched-mode into
sub-elements, such that the "save faces" part could be used separately.

Actually the annoyance was bigger than what I wrote in this thread, since
you are virtually stuck to one indentation column once it is set. However,
getting rid of this was in fact dirty simple.

Here’s what I did, while inside a buffer in enriched-mode:
1. Hit CTRL + h, k
2. Hit RETURN
3. Read the fine help:
#############################################
RET (translated from <return>) runs the command
reindent-then-newline-and-indent, which is an interactive Lisp
function in `simple.el'.

It is bound to RET.

(reindent-then-newline-and-indent)

Reindent current line, insert newline, then indent the new line.
Indentation of both lines is done according to the current major mode,
which means calling the current value of `indent-line-function'.
In programming language modes, this is the same as TAB.
In some text modes, where TAB inserts a tab, this indents to the
column specified by the function `current-left-margin'.

[back]
#############################################

Of course there are several solutions once you know the above.
A quick and dirty one is to overwrite the reindent-then-newline-and-indent
function’s definition by putting the following in your .emacs file:
(defun reindent-then-newline-and-indent ()
        "No thanks"
        (interactive "*")     
        (newline)       
        (indent-according-to-mode))

Modifying /usr/share/emacs/23.4/lisp/textmodes/enriched.el might be a
better solution, but it would take more time.

I wish I had this flexibility in a few other software programs...


Hope it helps,


Alexandre


reply via email to

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