From: Drew Adams <drew.adams@oracle.com>
To: Dan Hitt <dan.hitt@gmail.com>, Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: RE: [External] : How can i search for lines which wrap?
Date: Sat, 10 Jul 2021 01:20:14 +0000 [thread overview]
Message-ID: <SJ0PR10MB5488E29AA3A17EAF378F1907F3179@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <CAOphizL+AeqJN+TorS9CG5yQ8b3zG_hX0W1O1Px5qtGOXjTSiA@mail.gmail.com>
> So what i was missing was an easy way to search to
> the end of the next line with 80 or more characters.
There are a few ways to do what you request. Here are a couple.
1. You can make use of command `goto-long-line' from library
`misc-cmds.el'. That prompts you for a line length and
then goes to the next line that's at least that long.
To do that during Isearch for lines at least 80 chars,
define a command such as this, which uses `goto-long-line':
(defun goto-line>79-chars ()
"Go to next line at least 80 chars long."
(interactive)
(goto-long-line 80 t))
Then bind that command to a key in `isearch-mode-map'.
Use it during Isearch anytime to go to the next line
that's 80 chars or longer.
(define-key isearch-mode-map (kbd "C-e") 'goto-line>79-chars)
Library `misc-cmds.el' is here:
https://www.emacswiki.org/emacs/download/misc-cmds.el
2. You can set `isearch-filter-predicate' to a function that
returns non-nil only for a single-line search hit that ends
past column 79. Then regexp-search for a regexp such as `.$'.
(defun line>79-p (beg end)
"Return non-nil if END is past column 79."
(save-excursion (goto-char end) (> (current-column) 79)))
;; (setq ORIG-isearch-filter-predicate isearch-filter-predicate)
(setq isearch-filter-predicate 'line>79-p)
;; (setq isearch-filter-predicate ORIG-isearch-filter-predicate)
(You can use the commented out code to get back to the default filter.)
Note that you can't just regexp-search for `$', because
`isearch-filter-predicate' isn't used for empty matches.
next prev parent reply other threads:[~2021-07-10 1:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-09 4:39 How can i search for lines which wrap? Dan Hitt
2021-07-09 5:12 ` 2QdxY4RzWzUUiLuE
2021-07-09 6:36 ` Eli Zaretskii
2021-07-09 6:35 ` Eli Zaretskii
2021-07-10 1:20 ` Drew Adams [this message]
2021-07-12 17:16 ` [External] : " Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SJ0PR10MB5488E29AA3A17EAF378F1907F3179@SJ0PR10MB5488.namprd10.prod.outlook.com \
--to=drew.adams@oracle.com \
--cc=dan.hitt@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).