[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs as a translator's tool
From: |
Emanuel Berg |
Subject: |
Re: Emacs as a translator's tool |
Date: |
Mon, 08 Jun 2020 22:44:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Marcin Borkowski wrote:
> What I want is this: I have the source in, say,
> buffer A, and I perform the translation in, say,
> buffer B. The overlay is in buffer A, and I want to
> move it to the next sentence (in buffer A) _without
> moving the point away from buffer B_.
Well, technically, there is a point in every buffer
(and window, so there can be several for one buffer
even), but I understand what you mean:
;;; -*- 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)
(defvar source-buffer nil)
(defun set-source-buffer ()
(interactive)
(setq source-buffer (current-buffer)) )
(defun remove-highlight ()
(interactive)
(when (overlayp sentence-overlay)
(delete-overlay sentence-overlay) ))
(defun highlight-sentence ()
(let ((beg (progn (forward-sentence) (point)))
(end (progn (forward-sentence -1) (point))) )
(if (overlayp sentence-overlay)
(move-overlay sentence-overlay beg end)
(let ((overlay (make-overlay beg end)))
(overlay-put overlay 'face 'font-lock-comment-face)
(setq sentence-overlay overlay) ))))
(defun highlight-sentence-move (next)
(if (bufferp source-buffer)
(with-current-buffer source-buffer
(forward-sentence (if next 1 -1))
(highlight-sentence) )
(error "source-buffer not set") ))
(defun highlight-sentence-next ()
(interactive)
(highlight-sentence-move t) )
(defun highlight-sentence-prev ()
(interactive)
(highlight-sentence-move nil) )
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
- Re: Emacs as a translator's tool, (continued)
- 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/10
- Re: Emacs as a translator's tool, Jean-Christophe Helary, 2020/06/10
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/10
- Re: Emacs as a translator's tool, Jean-Christophe Helary, 2020/06/10
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/10
- Re: Emacs as a translator's tool, Marcin Borkowski, 2020/06/08
- Re: Emacs as a translator's tool,
Emanuel Berg <=
- Re: Emacs as a translator's tool, Marcin Borkowski, 2020/06/09
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/09
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/09
- Re: Emacs as a translator's tool, tomas, 2020/06/10
- Re: Emacs as a translator's tool, tomas, 2020/06/10
- recentering another window (was: Re: Emacs as a translator's tool), Emanuel Berg, 2020/06/10
- Re: Emacs as a translator's tool, Marcin Borkowski, 2020/06/10
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/10
- Re: Emacs as a translator's tool, Marcin Borkowski, 2020/06/12
- Re: Emacs as a translator's tool, Emanuel Berg, 2020/06/12