[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs as a translator's tool
From: |
Marcin Borkowski |
Subject: |
Re: Emacs as a translator's tool |
Date: |
Mon, 08 Jun 2020 08:04:53 +0200 |
User-agent: |
mu4e 1.1.0; emacs 27.0.50 |
Thanks, but this won't work in this form, as you don't move the point to
the overlay before. But the idea LGTM. As I said, I wrote my code in
a hurry and spent more time thinking how to wrap it in a minor mode than
how to make the commands themselves better.
Best,
On 2020-06-07, at 23:15, Emanuel Berg via Users list for the GNU Emacs text
editor <help-gnu-emacs@gnu.org> wrote:
> Marcin Borkowski wrote:
>
>> If you find a good way to refactor it so that it is
>> more DRY, I'd love to see it.
>
> ;;; -*- 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)
> (remove-highlight)
> (let ((overlay (make-overlay (progn (forward-sentence) (point))
> (progn (backward-sentence) (point)) )))
> (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) )
--
Marcin Borkowski
http://mbork.pl
- Re: Emacs as a translator's tool, (continued)
- 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, 2020/06/07
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/07
- Re: Emacs as a translator's tool,
Marcin Borkowski <=
- 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
- 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