david-christiansen / helm-pages Goto Github PK
View Code? Open in Web Editor NEWA Helm data source for pages in the current buffer
License: GNU General Public License v3.0
A Helm data source for pages in the current buffer
License: GNU General Public License v3.0
There is an issue with the current value of POS
in helm-pages-get-pages
. According to the documentation, POS
is the beginning of a page. However, except for the first page, the value of POS
is actually the position before the page-delimiter
.
For example, suppose that ^L
is the page-delimiter, and we have a buffer as follows:
First page
Foo
^L
Second page
Bar
^L
Third page
Baz
Let (n)
be the position of the beginning of the nth page. Then I would expect:
(1)First page
Foo
^L
(2)Second page
Bar
^L
(3)Third page
Baz
Instead, we currently have:
(1)First page
Foo
(2)^L
Second page
Bar
(3)^L
Third page
Baz
The consequence of this inconsistency is that the helm-pages-goto-page
and helm-pages-narrow-to-page
functions have to call forward-line
to position the cursor as the the user would expect, but this causes the cursor for the first page to be positioned on the second line, not the first.
Try it: call helm-pages-goto-page
on First page
in the above example while using helm-pages
. Let (|)
indicate the cursor. Then I would expect:
(|)First page
Foo
^L
Second page
Bar
^L
Third page
Baz
Instead, we currently have:
First page
(|)Foo
^L
Second page
Bar
^L
Third page
Baz
helm-pages-get-pages
to:(defun helm-pages-get-pages ()
"Get a list of (POS . HEADER) pairs, where POS denotes the
beginning of a page and HEADER is the contents of the first
non-blank line in that page."
(with-helm-current-buffer
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(let ((pages (list (cons (point)
(helm-pages-get-next-header)))))
(while (re-search-forward page-delimiter nil t)
(forward-line)
(push (cons (point)
(helm-pages-get-next-header))
pages))
(nreverse pages))))))
forward-line
from helm-pages-goto-page
and helm-pages-narrow-to-page
.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.