[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs as a translator's tool
From: |
Eric Abrahamsen |
Subject: |
Re: Emacs as a translator's tool |
Date: |
Sun, 07 Jun 2020 15:24:50 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> Eric Abrahamsen wrote:
>
>> You don't need to delete the overlay and make it
>> again each time, just use `move-overlay'.
>
> Alrighty, how about this? Only highlight-sentence has
> changed...
>
> ;;; -*- lexical-binding: t -*-
> ;;;
> ;;; this file:
> ;;; http://user.it.uu.se/~embe8573/emacs-init/incal-ecat.el
> ;;; https://dataswamp.org/~incal/emacs-init/incal-ecat.el
>
> (defvar sentence-overlay nil)
>
> (defun remove-highlight ()
> (interactive)
> (when (overlayp sentence-overlay)
> (delete-overlay sentence-overlay) ))
>
> (defun highlight-sentence ()
> (interactive)
> (let ((beg (progn (forward-sentence) (point)))
> (end (progn (backward-sentence) (point))) )
> (if (overlayp sentence-overlay)
> (move-overlay sentence-overlay beg end)
> (let ((overlay (make-overlay beg end)))
> (overlay-put overlay 'face 'font-lock-function-name-face)
> (setq sentence-overlay overlay) ))))
>
> (defun highlight-sentence-next ()
> (interactive)
> (forward-sentence)
> (highlight-sentence) )
>
> (defun highlight-sentence-prev ()
> (interactive)
> (backward-sentence)
> (highlight-sentence) )
Looks good to me!
>> How do I know? Because this thread finally
>> motivated me to finish the translation environment
>> package I've been thinking of for a while, and
>> I just wrote pretty much the same code a couple of
>> days ago :)
>
> Well... OK :)
Maybe some merging can be done when everyone's finished their version...
- Re: Emacs as a translator's tool, (continued)
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/04
- Re: Emacs as a translator's tool, Jean-Christophe Helary, 2020/06/04
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/04
- Re: Emacs as a translator's tool, Jean-Christophe Helary, 2020/06/05
- Re: Emacs as a translator's tool, Marcin Borkowski, 2020/06/05
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/05
- Re: Emacs as a translator's tool, Marcin Borkowski, 2020/06/05
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/07
- Re: Emacs as a translator's tool, Eric Abrahamsen, 2020/06/07
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/07
- Re: Emacs as a translator's tool,
Eric Abrahamsen <=
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/07
- Re: Emacs as a translator's tool, Marcin Borkowski, 2020/06/08
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/08
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/08
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/08
- Re: Emacs as a translator's tool, Jean-Christophe Helary, 2020/06/08
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/09
- Re: Emacs as a translator's tool, Jean-Christophe Helary, 2020/06/09
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/09
- Re: Emacs as a translator's tool, Jean-Christophe Helary, 2020/06/09