all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Alexandre Oberlin" <email_through@migo.info>
To: help-gnu-emacs@gnu.org
Subject: [SOLVED] Re: Enriched mode: avoid removing my manual indents
Date: Sat, 15 Feb 2014 18:30:01 +0100	[thread overview]
Message-ID: <op.xbb2wbushcorn8@eucalyptus> (raw)
In-Reply-To: mailman.475.1369680957.22516.help-gnu-emacs@gnu.org

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


  parent reply	other threads:[~2014-02-15 17:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24 12:42 Enriched mode: avoid removing my manual indents Alexandre Oberlin
2013-05-27 12:59 ` Alexandre Oberlin
2013-05-27 13:25   ` Drew Adams
     [not found]   ` <mailman.458.1369661162.22516.help-gnu-emacs@gnu.org>
2013-05-27 14:15     ` Alexandre Oberlin
2013-05-27 18:55       ` Stefan Monnier
     [not found]       ` <mailman.475.1369680957.22516.help-gnu-emacs@gnu.org>
2013-05-28 11:50         ` Alexandre Oberlin
2013-06-04 11:52         ` Alexandre Oberlin
2014-02-15 17:30         ` Alexandre Oberlin [this message]
2014-02-15 17:30         ` [SOLVED] " Alexandre Oberlin
2014-02-15 17:32         ` Alexandre Oberlin

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=op.xbb2wbushcorn8@eucalyptus \
    --to=email_through@migo.info \
    --cc=help-gnu-emacs@gnu.org \
    /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.