From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: Movable position registers? Date: Mon, 12 Sep 2016 13:52:56 -0700 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1473713722 21674 195.159.176.226 (12 Sep 2016 20:55:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Sep 2016 20:55:22 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 12 22:55:18 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjYFz-0004dI-L5 for geh-help-gnu-emacs@m.gmane.org; Mon, 12 Sep 2016 22:55:11 +0200 Original-Received: from localhost ([::1]:45160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjYFx-0001fo-Mz for geh-help-gnu-emacs@m.gmane.org; Mon, 12 Sep 2016 16:55:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjYFW-0001fg-PY for help-gnu-emacs@gnu.org; Mon, 12 Sep 2016 16:54:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjYFT-00052X-JO for help-gnu-emacs@gnu.org; Mon, 12 Sep 2016 16:54:42 -0400 Original-Received: from mail-qk0-f182.google.com ([209.85.220.182]:34520) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjYFT-0004yT-Et for help-gnu-emacs@gnu.org; Mon, 12 Sep 2016 16:54:39 -0400 Original-Received: by mail-qk0-f182.google.com with SMTP id h8so67714875qka.1 for ; Mon, 12 Sep 2016 13:54:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wZC3DQrESyy1bShcXHqF6iECtUUPVsMupBFtlCHZiVs=; b=mfUDCbDUIb3rIu48qPZCota78JFglEV0h2Qpcue5H18SOCXQT84hYRvaPBrE2yBz9O 0slBY8B3xahwMFfFJM1S+vM40+5uHyX6eIPZ45srRQX1kAtXQ42H/Rt9sHbraLzt4wYs GPFTkNR6dPvMc1exMqshxI2RdXqiuBTMy5Ax6HDVj+UoG/GAE3muXNu3ODn1rymBTXYT +fQBpzgHGvq9dxLLTc4Ny+PI0/G/kLWTt6vhjk+NjxpGHIg5DNyV5X2/jKzwLb3tKQCn 9kwQXQhzu6e47J+jQP3nm2pn26Z6WlWLDEKomqVzPjAEZMkzDDNMC3DLjGvK0lQ7uSYr wNSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wZC3DQrESyy1bShcXHqF6iECtUUPVsMupBFtlCHZiVs=; b=YUTi8I6KHRhcSdhBNh1JJsc2LAOnaYJs/AGmRg/SJe4GQBCJ3PhqGBw7OufXqqP0dD 78QSJFHwXKGSaXkEaZ47WXkFKdHLHvTMQl9opUwv0Tir3qyh3w6avtGJRWeYisLANXP8 fD+Hv+BC+Di8nB9CLrPixTCjLpMzqt4MRdawPE0/pbaWvFsDxVU693p+NBcYy9z3JNop npUGRFWzWGSBOhZiKcEKtNxjkNuB3DQ1Qe7R1dYRg3mdqjChgC20fahEI8oGG3H5LU3P 7QNvjNY4jPG9POGdZvqBH6LWsbDlYh3YVP2c3VnK7b2Gt8a3bTFBoFfe1klyrY3wZFHh kq0A== X-Gm-Message-State: AE9vXwOCtR6zVK4pVz63WRsOhCIew2gvqB7hITa6TnyQL3bm+0rKXpvWJz+zMdeKCw0OwPnQHaN9PUTCVO+oGw== X-Received: by 10.55.24.194 with SMTP id 63mr23020292qky.30.1473713597475; Mon, 12 Sep 2016 13:53:17 -0700 (PDT) Original-Received: by 10.237.33.46 with HTTP; Mon, 12 Sep 2016 13:52:56 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.182 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111335 Archived-At: Nikolay Kudryavtsev wrote: > From time to time I have this question, but always forget to ask. > > Is there a way to put the position of comint input into a register, so > whenever its position changes, the register moves with it? So I can use > registers for irc buffers, sql buffers and shell buffers without the need > for an extra end-of-buffer command. If I understand correctly, I think perhaps you just need to use `set-marker-insertion-type' so that the marker moves when text is inserted at its position. Here's an example of a modified/simplified version of `point-to-register' that does so: (defun my-point-to-register-with-insertion-type-t (register) (interactive (list (register-read-with-preview "Point to register: "))) (add-hook 'kill-buffer-hook 'register-swap-out nil t) (let ((marker (copy-marker (point)))) (set-marker-insertion-type marker t) (set-register register marker))) Hope that helps John