all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Text highlighter functiontionality
@ 2009-07-23 11:44 stephan.zimmer
  2009-07-23 12:25 ` Teemu Likonen
  0 siblings, 1 reply; 6+ messages in thread
From: stephan.zimmer @ 2009-07-23 11:44 UTC (permalink / raw)
  To: help-gnu-emacs

Is anyone aware of a text highlighter functionality in emacs? I would
like to highlight (possibly non-connected) portions of text in a
buffer in such a way, that the highlighting persists within one emacs
session (i.e., when I change the buffer and return to it again, the
highlighting should still be there).

(To avoid confusion: I do not mean the selection of text, the intended
highlighting is just for a better orientation while reading the text.)

Stephan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Text highlighter functiontionality
  2009-07-23 11:44 Text highlighter functiontionality stephan.zimmer
@ 2009-07-23 12:25 ` Teemu Likonen
  2009-07-23 12:47   ` Lennart Borgman
  0 siblings, 1 reply; 6+ messages in thread
From: Teemu Likonen @ 2009-07-23 12:25 UTC (permalink / raw)
  To: help-gnu-emacs

On 2009-07-23 04:44 (-0700), stephan zimmer wrote:

> Is anyone aware of a text highlighter functionality in emacs? I would
> like to highlight (possibly non-connected) portions of text in a
> buffer in such a way, that the highlighting persists within one emacs
> session (i.e., when I change the buffer and return to it again, the
> highlighting should still be there).

Sounds pretty much like "M-s h r" (highlight-regexp) to me.

But if you want to mark a region and highlight it you could use a simple
function to create an overlay. Here's an example function which
highlights current active region. You can remove the highlighting by
just editing text inside it.

--8<---------------cut here---------------start------------->8---
(defun my-overlay (beg end)
  "Create an overlay between BEG and END.
If called interactively BEG and END are the region."
  (interactive "r")
  (require 'hi-lock)
  (let ((ol (make-overlay beg end)))
    (dolist (prop '((modification-hooks (lambda (ol after &rest ignore)
                                          (when after
                                            (delete-overlay ol))))
                    (face . hi-yellow)
                    (evaporate . t)))
      (overlay-put ol (car prop) (cdr prop)))))
--8<---------------cut here---------------end--------------->8---


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Text highlighter functiontionality
  2009-07-23 12:25 ` Teemu Likonen
@ 2009-07-23 12:47   ` Lennart Borgman
  2009-07-23 16:18     ` Drew Adams
       [not found]     ` <mailman.3039.1248365904.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Lennart Borgman @ 2009-07-23 12:47 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: help-gnu-emacs

On Thu, Jul 23, 2009 at 2:25 PM, Teemu Likonen<tlikonen@iki.fi> wrote:
> On 2009-07-23 04:44 (-0700), stephan zimmer wrote:
>
>> Is anyone aware of a text highlighter functionality in emacs? I would
>> like to highlight (possibly non-connected) portions of text in a
>> buffer in such a way, that the highlighting persists within one emacs
>> session (i.e., when I change the buffer and return to it again, the
>> highlighting should still be there).
>
> Sounds pretty much like "M-s h r" (highlight-regexp) to me.

There are also markerpens:

    http://www.emacswiki.org/emacs/MarkerPens




^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Text highlighter functiontionality
  2009-07-23 12:47   ` Lennart Borgman
@ 2009-07-23 16:18     ` Drew Adams
       [not found]     ` <mailman.3039.1248365904.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2009-07-23 16:18 UTC (permalink / raw)
  To: 'Lennart Borgman', 'Teemu Likonen'; +Cc: help-gnu-emacs

> >> Is anyone aware of a text highlighter functionality in 
> >> emacs? I would like to highlight (possibly non-connected)
> >> portions of text in a buffer in such a way, that the
> >> highlighting persists within one emacs
> >> session (i.e., when I change the buffer and return to it again, the
> >> highlighting should still be there).
> >
> > Sounds pretty much like "M-s h r" (highlight-regexp) to me.
> 
> There are also markerpens:
> http://www.emacswiki.org/emacs/MarkerPens

That is not the generic page about this; it is only one of the libraries that
offers such a "marker-pen" or "highlighter" feature.

This is the generic page for this topic:
http://www.emacswiki.org/emacs/HighlightTemporarily

In particular, library highlight.el lets you highlight using a "marker pen", but
also in many other ways. This is its page:
http://www.emacswiki.org/emacs/HighLight. And its highlighting can be with
either text properties or overlays. AFAIK, it is the most flexible of the
various approaches available.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Text highlighter functiontionality
       [not found]     ` <mailman.3039.1248365904.2239.help-gnu-emacs@gnu.org>
@ 2009-07-24 15:44       ` stephan.zimmer
  2009-07-24 17:03         ` Thierry Volpiatto
  0 siblings, 1 reply; 6+ messages in thread
From: stephan.zimmer @ 2009-07-24 15:44 UTC (permalink / raw)
  To: help-gnu-emacs

Many thanks for all of your answers.

> But if you want to mark a region and highlight it you could use a simple
> function to create an overlay. Here's an example function which
> highlights current active region. You can remove the highlighting by
> just editing text inside it.

This sounds pretty much like what I need. Currently I'm slightly
extending Teemu's function in such a way that I can also deselect
parts of a selection. My ultimate plan is to add a toggle function,
which would allow to select and deselect arbitrary portions of text
with one function. If that turns out to be interesting for more of you
I will post the code.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Text highlighter functiontionality
  2009-07-24 15:44       ` stephan.zimmer
@ 2009-07-24 17:03         ` Thierry Volpiatto
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Volpiatto @ 2009-07-24 17:03 UTC (permalink / raw)
  To: help-gnu-emacs

Hi, i didn't follow this post, so i don't know really what you want.
But if you want to save a region anywhere in emacs and retrieve it at
every emacs session, you can use bookmark+.el.


"stephan.zimmer" <stephan.zimmer@googlemail.com> writes:

> Many thanks for all of your answers.
>
>> But if you want to mark a region and highlight it you could use a simple
>> function to create an overlay. Here's an example function which
>> highlights current active region. You can remove the highlighting by
>> just editing text inside it.
>
> This sounds pretty much like what I need. Currently I'm slightly
> extending Teemu's function in such a way that I can also deselect
> parts of a selection. My ultimate plan is to add a toggle function,
> which would allow to select and deselect arbitrary portions of text
> with one function. If that turns out to be interesting for more of you
> I will post the code.
>

-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-07-24 17:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-23 11:44 Text highlighter functiontionality stephan.zimmer
2009-07-23 12:25 ` Teemu Likonen
2009-07-23 12:47   ` Lennart Borgman
2009-07-23 16:18     ` Drew Adams
     [not found]     ` <mailman.3039.1248365904.2239.help-gnu-emacs@gnu.org>
2009-07-24 15:44       ` stephan.zimmer
2009-07-24 17:03         ` Thierry Volpiatto

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.