From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.devel Subject: Re: Temporarily select-window, without updating mode-line face and cursor fill? Date: Sat, 1 May 2021 18:17:46 -0400 Message-ID: <904A57C8-C268-412F-815F-782017F47D5D@gmail.com> References: <56F746A2-B842-421E-8FBF-EA5E93EA26CE@gmail.com> <83pmya8d49.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21904"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 02 00:18:43 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lcxwh-0005b7-60 for ged-emacs-devel@m.gmane-mx.org; Sun, 02 May 2021 00:18:43 +0200 Original-Received: from localhost ([::1]:32808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcxwg-0006Qb-91 for ged-emacs-devel@m.gmane-mx.org; Sat, 01 May 2021 18:18:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcxvr-000617-Cl for emacs-devel@gnu.org; Sat, 01 May 2021 18:17:51 -0400 Original-Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]:40843) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcxvp-0004sd-P8; Sat, 01 May 2021 18:17:51 -0400 Original-Received: by mail-qk1-x72d.google.com with SMTP id q136so1737491qka.7; Sat, 01 May 2021 15:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8cOMRHancdyCRoCtoDyoFjPz+9NG/+fSjIh0pf3nM0s=; b=CmvzPvj2EZCkiUqYsMCxtjEFd/QFNgFj8CFb8FA85sPEr70qrg557uLYEgTJbNQ1we NO8ea4nc9Ee2H62hjuNgvQtZ+ojgGJ4UTXRiqvD4Aiw275fPY9k2Td54k3m008Ki/Jam nYSP0n7oKNc6Mo558mVdCpy8il/7kIZmoBLCDmiTDG+LqotbFQWjoWabDxSgq5yQl3ap mYRVpO8P2Ywy1QnWA25xNg+cD0QIK9KcGS7deM4tMwn8E0RWXrOFQWcwYqcBvO/+uUXg JPUP9dBVf2z9nMQRhJ/m7l7A2u/bWjkr1w5T9edF9u6SU2u+3cNCkk0f97blaptEoia+ umNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8cOMRHancdyCRoCtoDyoFjPz+9NG/+fSjIh0pf3nM0s=; b=dmibYpmjb2NfcH5DkSzzD13RAhse3gYiCyo9/+e0l98VvbuptzYALFCugriaQAe6VJ bGJGpZSry5sLTG0jEjCZt2qSiFo7Prv/3m1Aq/dy4pwM9StbdtiK0GKYPTxO+0CQhcgm mBH09n5h1OoGHMvjIifphpOCipGUmTRv/kyP3khOM7tCE1WMhRn6jlQSBqxNx8F52d3H cTQuzpeLS8A9i2T8xusYUzpWcM8oSSC8lt0GSiqlQTTo3ZmNABfn1HFbp0P0wFOv0Lnt g+6tpcJKk5W6AD3tofIZ9wPiM8JtA/Ym5HyVh5BHExUZVa/889LXjROh527icYD3NwGx h70w== X-Gm-Message-State: AOAM533qCiuu0mRz2U3BiRuI1GOChtwnbqDkrtDp6oBFVeYTNVjv0NJi GVVgD1NFe6bWJan6wgjt4i0sfZdesRXc5g== X-Google-Smtp-Source: ABdhPJwkskU0XxDnTL/0jEx5Z815GmZtycOSUhBlilOULSaGqmpYj5Q2MXg3OCEdY84s3mhqu31eSw== X-Received: by 2002:a05:620a:448e:: with SMTP id x14mr10237518qkp.10.1619907468038; Sat, 01 May 2021 15:17:48 -0700 (PDT) Original-Received: from smtpclient.apple (cm-134-228-25-135.buckeyecom.net. [134.228.25.135]) by smtp.gmail.com with ESMTPSA id p6sm4856903qkk.30.2021.05.01.15.17.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 May 2021 15:17:47 -0700 (PDT) In-Reply-To: <83pmya8d49.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.80.0.2.43) Received-SPF: pass client-ip=2607:f8b0:4864:20::72d; envelope-from=jdtsmith@gmail.com; helo=mail-qk1-x72d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:268739 Archived-At: > Please explain in more detail why do you think you need to select the > window. What are those "line offsets", and why "move within it" > requires to select the window? Update: I managed to avoid selecting the window by using a somewhat more = complex line move, based on set-window-start: (when (/=3D targ start) (set-window-start win (with-current-buffer (window-buffer win) (save-excursion (goto-char wstart) (forward-line (- targ start)) (point))))) Here wstart is the window start in the target window. I presume = with-current-buffer in the same buffer and set-window-start in the = selected window is pretty efficient. I also modified my fast line = number function to work with a non-selected window as well (also = somewhat convoluted, feedback welcome): (defun mlscroll-fast-line-number-at-pos (pos &optional win) "Line number at position. Compute line number at position POS. Uses fast mode-line formatting. If WIN is non-nil, find line number at position within that window." (string-to-number (if win (let ((old (window-point win))) (set-window-point win pos) (prog1 (format-mode-line "%l" 0 win) (set-window-point win old))) (save-excursion (goto-char pos) (format-mode-line "%l" 0)))))=