From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Highlighting parentheses when matching parentheses resides outside visible window Date: Wed, 26 Oct 2022 19:50:09 +0200 Message-ID: <87k04ma2zy.fsf@dataswamp.org> References: <835yg8p1w9.fsf@gnu.org> <83eduuon7o.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26218"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:zIxvXYPpt2csiw/umXUhw5PN3fY= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 26 21:10:51 2022 Return-path: Envelope-to: geh-help-gnu-emacs@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 1onlnf-0006fL-JF for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 26 Oct 2022 21:10:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onllw-00038K-Bv; Wed, 26 Oct 2022 15:09:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onkXj-00087U-NP for help-gnu-emacs@gnu.org; Wed, 26 Oct 2022 13:50:19 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onkXi-0004qM-1q for help-gnu-emacs@gnu.org; Wed, 26 Oct 2022 13:50:19 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1onkXg-0004qS-1f for help-gnu-emacs@gnu.org; Wed, 26 Oct 2022 19:50:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 26 Oct 2022 15:09:02 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "help-gnu-emacs" Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:140410 Archived-At: Heime wrote: > I use the arrow keys do a mouse scroll up. With mouse scroll > up, the position of the cursor moves as the window > gets updated. M-i and M-k one line at a time ... Civilized scrolling! Get up get down get high get no no no where ... https://www.youtube.com/watch?v=61nxcJ32mVg ;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/scroll.el (require 'cl-lib) (setq scroll-conservatively 10000) (setq auto-window-vscroll nil) ;; scroll the current window (defun scroll-up-1 () (interactive) (scroll-down 1) ) (defun scroll-down-1 () (interactive) (scroll-up 1) ) ;; automatic scrolling (defun start-automatic-scroll-down () (interactive) (let ((win)) (cl-loop do (setq win (window-end)) (scroll-down-1) (sleep-for 1) ; put speed here in seconds (redisplay) until (= win (window-end)) ))) ;; (start-automatic-scroll-down) ;; ^ test here; abort with C-g ;; scroll up/down the other window (defun scroll-up-other-window () (interactive) (scroll-other-window-down 1) ) (defun scroll-down-other-window () (interactive) (scroll-other-window 1) ) ;; scroll one pane of text (defun get-window-lines () (let*((edges (window-inside-edges)) (top (nth 1 edges)) (bottom (nth 3 edges)) (lines (- bottom top)) ) (if (member major-mode '(Buffer-menu-mode package-menu-mode w3m-mode)) (1- lines) lines) )) (defun scroll-up-pane () (interactive) (scroll-down (get-window-lines) )) (defun scroll-down-pane () (interactive) (scroll-up (get-window-lines)) ) ;; scroll horizontally (put 'scroll-left 'disabled nil) (put 'scroll-right 'disabled nil) (setq hscroll-margin 1) (setq hscroll-step 1) (defun scroll-left-1 () (interactive) (scroll-right 1 0) ) ; yes, "the opposite" here (defun scroll-right-1 () (interactive) (scroll-left 1 0) ) ; ditto (defun set-pane-scroll-keys (map) "Set MAP keys for vertical scrolling in panes." (define-key map "I" #'scroll-up-pane) (define-key map "K" #'scroll-down-pane) ) (defun set-scroll-keys (map &optional horizontally) "Set MAP keys for scrolling, vertically and HORIZONTALLY. Also invoke `set-pane-scroll-keys'." (when horizontally (define-key map "j" #'scroll-left-1) (define-key map "l" #'scroll-right-1) ) (define-key map "i" #'scroll-up-1) (define-key map "\M-i" #'scroll-up-1) (define-key map "k" #'scroll-down-1) (define-key map "\M-k" #'scroll-down-1) (set-pane-scroll-keys map) ) (defun set-vertical-keys (map &optional button n-and-p) (let*((keys (if button (list #'backward-button #'forward-button) (list #'previous-line #'forward-line) )) (up (car keys)) (down (cadr keys)) ) (define-key map "i" up) (define-key map "k" down) (when n-and-p (define-key map "p" up) (define-key map "n" down) ))) (provide 'scroll) -- underground experts united https://dataswamp.org/~incal