1 ;;; tinypage.el --- Handling ^L pages, select, cut, copy, head renumber.
3 ;; This file is not part of Emacs
7 ;; Copyright (C) 1996-2007 Jari Aalto
10 ;; Maintainer: Jari Aalto
12 ;; To get information on this program, call M-x tinypage-version.
13 ;; Look at the code with folding.el.
17 ;; This program is free software; you can redistribute it and/or modify it
18 ;; under the terms of the GNU General Public License as published by the Free
19 ;; Software Foundation; either version 2 of the License, or (at your option)
22 ;; This program is distributed in the hope that it will be useful, but
23 ;; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 ;; You should have received a copy of the GNU General Public License
28 ;; along with program; see the file COPYING. If not, write to the
29 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
30 ;; Boston, MA 02110-1301, USA.
32 ;; Visit <http://www.gnu.org/copyleft/gpl.html> for more information
37 ;; ....................................................... &t-install ...
38 ;; Put this file on your Emacs-Lisp load path, add following into your
39 ;; ~/.emacs startup file
41 ;; (require 'tinypage)
43 ;; or use this; your .emacs loads quicker. Preferred.
45 ;; (global-set-key "\C-cmp" 'tinypage-mode) ;; "m" for minor modes
46 ;; (autoload 'tinypage-mode "tinypage" "" t)
48 ;; If you make any changes to keybindings, always run command
50 ;; M-x tinypage-mode-install
52 ;; to see what this mode offers, look at the mode description
57 ;; If you have any questions, use this function
59 ;; M-x tinypage-submit-bug-report ,send bug report
66 ;; ..................................................... &t-commentary ...
71 ;; I had found paged.el by Michelangelo Grigni <mic@mathcs.emory.edu>
72 ;; one year or so ago and had liked it very much. Unfortunately
73 ;; it used narrowing and didn't offer easy page select, copy, cut
74 ;; actions which belong to basic page editing.
76 ;; Paged.el has one nice feature: It can renumber pages and make summary
77 ;; out of them. If I have time I will include those features to
80 ;; Overview of features
82 ;; o Copy, cut, paste, yank (after/before current page) ^L pages.
83 ;; o Show page-nbr/page-count/page-size in modeline.
84 ;; o Can renumber numbered header levels, where last level is indicated
85 ;; with number. Eg. "A.1 A.2" or "1.2.1.1 "1.2.1.2"
86 ;; o Shows popup in X to jump to headings
87 ;; o Create table of contents.
89 ;; About making pages -- basics
91 ;; If you're totally unfamiliar to the concept of page: you make
92 ;; pages in emacs by adding the linefeed marker in the text, normally
93 ;; on its own line, just before your topics or headings.
97 ;; That inserts the ^L character in the buffer. That is where your
98 ;; page starts. The layout of your doc may look like this:
102 ;; txt txt txt txt txt txt txt txt
103 ;; txt txt txt txt txt txt txt txt
107 ;; txt txt txt txt txt txt ..
111 ;; txt txt txt txt txt txt txt txt
112 ;; txt txt txt txt txt txt txt ...
117 ;; This package offers simple renumbering features, but it
118 ;; won't do everything for you! Let's first tell what it won't
119 ;; do. Renumbering these is piece of cake:
137 ;; tsk-tsk, before you say anything... It went all right.
138 ;; Now you see what it won't do for you.
140 ;; . It can't know that the 1.7.1.5 belongs under previous 1.1,
141 ;; because no back tracking is done. I won't even try!
142 ;; [write a separate package if you want that...I won't do it]
144 ;; . Same goes here, it can't know that the 1.5.4.1 should actually
145 ;; start from 1.5.1.1
147 ;; The thumb rule is, that you _go_ and make sure all the _first_
148 ;; level headings (those that end to X.X.1.1) are right before doing
149 ;; renumbering. In the above case, you should have done these before
150 ;; calling M-x tinypage-renumber-forward.
153 ;; . --> 1.5.1.1 _AND_ do replace M-% 1.5.4 with 1.5.1
155 ;; Then all the renumberin would have gone just fine.
156 ;; Little handy work and this package helps you to number your doc easily.
159 ;; Renumbering -- be cautious
161 ;; If you have index section in you file, you have a little problem,
162 ;; because this package does not know nothing about such things.
163 ;; If the Index section is at the beginning, just go past it and
166 ;; M-x tinypage-renumber-forward
170 ;; M-x tinypage-renumber-buffer
172 ;; Would be disaster. It can only be used for non-index buffers.
176 ;; After you have renumbered all, your old index section is useless,
177 ;; Just call function
181 ;; And copy the showed buffer in place of the old index.
185 ;; Since the numbering is done according to regexp, there is
186 ;; no way to avoid the following false hit:
189 ;; This is highly technical document concerning the latest
190 ;; NASA ultrawave reflective shield technique. You should
195 ;; Where the Daddy-Cool portable sondium emission detector is
196 ;; described in full...
198 ;; The Number 1.5 is unfortunately renumbered to 1.2, and possibly
199 ;; causing headache in the NASA and in the spying countries...
200 ;; If you know elegant way to prevent these false hits, please
201 ;; drop me a mail. At this time I haven't much payed attention to this.
205 ;; The renumbering used here uses brute force, so the execution time
206 ;; is O(n2). If you have more that 30-40 sections, the renumbering
207 ;; might take 15-40 minutes. If you care to send me more pleasant
208 ;; numbering I'd be very gratefull and you're name would be carved to
209 ;; this module. For now, I'm just too lazy to change anything.
224 (or (load "overlay" 'noerr)
226 tinypage: ** you need XEmacs overlay.el library.
227 ** TinyPage may not work correctly without it."))))
229 (eval-when-compile (ti::package-use-dynamic-compilation))
231 (ti::package-defgroup-tiny TinyPage tinypage-: tools
232 "Minor mode for Handling ^L delimeted text rerions (pages).
234 o Copy, cut, paste, yank (after/before current page) ^L pages.
235 o Show page-nbr/page-count/page-size in modeline.
236 o Can renumber numbered header levels, where last level is indicated
237 with number. Eg. \"A.1 A.2\" or \"1.2.1.1\" \"1.2.1.2\"
238 o Shows popup in X to jump to headings
239 o Create table of contents.")
244 (defcustom tinypage-:load-hook nil
245 "*Hook that is run when package is loaded."
250 ;;{{{ setup: private variables
252 (defvar tinypage-:post-command-wakeup-counter nil
253 "Updated by program.")
255 (make-variable-buffer-local 'tinypage-:post-command-wakeup-counter)
257 (defvar tinypage-:buffer-toc "*toc*"
258 "Where to create index.")
261 ;;{{{ setup: public, user configurable
263 (defcustom tinypage-:register ?p
264 "*Register used for clipboard."
268 ;;; This is _not_ one char "^L", it is two chars "^" + "L"
270 (defcustom tinypage-:mode-name-string " ^L"
271 "*Minor mode name. User variable."
275 (defcustom tinypage-:post-command-wakeup-count 40
276 "*How often to wake up to update modeline info.
277 Don't put too low value, since it slows down Emacs."
281 (defcustom tinypage-:x-coord 170
282 "*Default X menu coordinate."
286 (defcustom tinypage-:y-coord 170
287 "*Default Y menu coordinate."
291 (defcustom tinypage-:x-popup-line-len 35
292 "*Maximum line length in popup."
296 ;; Do not change this ! Unless you know what you do...
298 (defcustom tinypage-:renumber-format
299 '( "^[ \t]*\\([0-9.]+\\.\\)\\([0-9]+\\)" 1 2)
300 "*Regexp for renumbered lines.
304 (REGEXP SAME-LEVEL RENUM-LEVEL),
306 where the match in RENUM-LEVEL match must return a valid number.
307 Value SAME-LEVEL is examined only once and the _dots_ that is holds
308 are counted. The dots tell which mail-level was picked.
309 Eg, when renumbering the following, only the last number is incremented.
311 1.2 Section one is here, this is picked first and examined.
312 1.2.1.1 This subsection is skipped, since it's not in the same level.
313 1.3 This level will be picked.
315 There _must_ be dots in the matched level string, because the section
316 level is calculated by counting the dots. The following
317 section numbers won't do:
322 (string :tag "Regexp")
323 (integer :tag "Submatch in regexp")
324 (integer :tag "Submatch in regexp"))
327 (defcustom tinypage-:modeline-function 'tinypage-update-mode-line
328 "*The modeline function that keep it up to date whenever called."
335 ;;;###autoload (autoload 'tinypage-version "tinypage" "Display commentary." t)
337 (ti::macrof-version-bug-report
341 "$Id: tinypage.el,v 2.47 2007/05/07 10:50:08 jaalto Exp $"
342 '(tinypage-:version-id
345 tinypage-:mode-define-keys-hook
352 tinypage-:mode-name-string
353 tinypage-:mode-menu-name
354 tinypage-:mode-prefix-key
355 tinypage-:post-command-wakeup-count
358 tinypage-:x-popup-line-len
359 tinypage-:modeline-function
360 tinypage-:renumber-format
361 tinypage-:post-command-wakeup-counter
362 tinypage-:version-id)))
367 ;;;###autoload (autoload 'tinypage-mode "tinypage" "" t)
368 ;;;###autoload (autoload 'turn-on-tinypage-mode "tinypage" "" t)
369 ;;;###autoload (autoload 'turn-off-tinypage-mode "tinypage" "" t)
370 ;;;###autoload (autoload 'tinypage-commentary "tinypage" "" t)
372 (defvar tinypage-:mode-name " ^L"
373 "Minor mode name. Changed by program. not user variable.")
375 (make-variable-buffer-local 'tinypage-:mode-name)
379 ;;; Prefix keys is "\" by default: this one
380 ;;; was nicely non-shifted and near HP-UX return key. You can Change it
381 ;;; prior loading the package with (setq tinypage-:pref
383 (ti::macrof-minor-mode-wizard
384 "tinypage-" " ^L" "\\" "Tpage" 'TinyPage "tinypage-:" ;1-6
386 "Paged minor mode. This mode allows you to handle ^L delimited
387 region as page: you can e.g. cut, copy, and select it.
389 The page counter is _not_ updated all the time in the modeline, because
390 it'd be too heavy task to monitor user constantly. Please use command
391 \\[tinypage-modeline] if you want up to date information.
393 To adjust the user tracking threshold, modify value:
395 `tinypage-:post-command-wakeup-count'
399 \\{tinypage-:mode-prefix-map}"
404 ;; Make sure it's there...
405 (or (assq 'tinypage-post-command post-command-hook)
406 (add-hook 'post-command-hook 'tinypage-post-command))
407 ;; - We could leave the hook there because it's no-op if
408 ;; the mode variable is nil.
409 ;; - But i think if user looks at post-command-hook's contents
410 ;; to spot some problems, he appreciates if there is no extra
411 ;; functions in the hook -- only those that need to active
412 ;; in the current buffer/modes.
413 (if (null tinypage-mode)
414 (remove-hook 'post-command-hook 'tinypage-post-command)
415 ;; Make sure it's there...
416 (or (assq 'tinypage-post-command post-command-hook)
417 (add-hook 'post-command-hook 'tinypage-post-command)))
419 (ti::compat-modeline-update))
422 tinypage-:mode-easymenu-name
423 ["Cut" tinypage-cut t]
424 ["Copy" tinypage-copy t]
425 ["Select" tinypage-select t]
426 ["Yank" tinypage-yank t]
427 ["Yank before page" tinypage-yank-before t]
428 ["Yank after page" tinypage-yank-after t]
430 ["Renumber buffer" tinypage-renumber-buffer t]
431 ["Renumber forward" tinypage-renumber-forward t]
432 ["Renumber Level forward" tinypage-renumber-level-forward t]
434 ["Index" tinypage-toc t]
435 ["Index occur" tinypage-toc-occur t]
436 ["Index popup" tinypage-toc-x-popup t]
438 ["Update modeline info" tinypage-modeline t]
439 ["Previous heading" tinypage-go-previous t]
440 ["Next heading" tinypage-go-next t]
441 ["Scroll down" scroll-down t]
442 ["Scroll up" scroll-up t]
444 ["Package version" tinypage-version t]
445 ["Package commentary" tinypage-commentary t]
446 ["Mode help" tinypage-mode-help t]
447 ["Mode off" tinypage-mode t])
449 (define-key map "?" 'tinypage-mode-off)
450 (define-key map "Hm" 'tinypage-mode-help)
451 (define-key map "Hc" 'tinypage-commentary)
452 (define-key map "Hv" 'tinypage-version)
453 ;; These are the DOS standard keys, mimic them
457 (define-key map "c" 'tinypage-copy)
458 (define-key map "t" 'tinypage-cut)
459 (define-key map "p" 'tinypage-yank)
460 (define-key map "s" 'tinypage-select)
461 ;; ....................................................... yanking ...
462 ;; Emacs users are more familiar with this
463 (define-key map "y" 'tinypage-yank)
464 ;; Some handy paste commands. Moving pages around
465 ;; See the keyboads: < > which mean before , after
466 ;; I don't want to use shift...
467 (define-key map "," 'tinypage-yank-before)
468 (define-key map "." 'tinypage-yank-after)
469 ;; ..................................................... numbering ...
470 ;; key "n" for numbering.
471 (define-key map "nl" 'tinypage-renumber-level-forward)
472 (define-key map "nf" 'tinypage-renumber-forward)
473 (define-key map "nb" 'tinypage-renumber-buffer)
474 ;; ......................................................... index ...
475 ;; key "i" for indexing
476 ;; I didn't pick "x" for X-popup because it's too far away
477 ;; from the "i" key. The "p" for "popup" is much closer.
478 (define-key map "ii" 'tinypage-toc)
479 (define-key map "io" 'tinypage-toc-occur)
480 (define-key map "ip" 'tinypage-toc-x-popup-keyboard)
481 ;; ...................................................... events ...
482 ;; Too bad the delete key is not standard, we have to define
484 (define-key map [(delete)] 'tinypage-cut)
485 (define-key map [(del)] 'tinypage-cut)
486 (define-key map [(deletechar)] 'tinypage-cut)
487 (define-key map [(hpDeleteChar)] 'tinypage-cut)
488 (define-key map [(backspace)] 'tinypage-copy)
489 (define-key map [(insert)] 'tinypage-yank)
490 (define-key map [(insertchar)] 'tinypage-yank)
491 (define-key map [(hpInsertChar)] 'tinypage-yank)
493 (define-key map [(mouse-1)] 'tinypage-toc-x-popup)
494 (define-key map [(button1up)] 'tinypage-toc-x-popup))
495 ;; .................................................... go, update ...
496 (define-key map "u" 'tinypage-modeline)
497 (define-key map [(prior)] 'tinypage-go-previous)
498 (define-key map [(next)] 'tinypage-go-next)
499 (define-key map [(control prior)] 'scroll-down)
500 (define-key map [(control next)] 'scroll-up))))
503 ;;{{{ misc, engine funcs
505 ;;; ----------------------------------------------------------------------
507 (defun tinypage-modeline ()
508 "Update modeline information."
510 (funcall tinypage-:modeline-function))
512 ;;; ----------------------------------------------------------------------
514 (defun tinypage-page-region (&optional verb)
515 "Return region (BEG . END) of page. VERB."
522 (if (looking-at "^[ \t]*\C-l")
524 (setq beg (tinypage-go-next 'back)))
525 (when (setq end (tinypage-go-next))
526 (goto-char end) ;adjust point, do not take ^L
530 (setq ret (cons beg end))
532 (message "Couldn't find region")))
535 ;;; ----------------------------------------------------------------------
537 (defun tinypage-count-pages ()
538 "Count page characters ^L."
542 (while (re-search-forward "^[ \t]*\C-l" nil t)
546 ;;; ----------------------------------------------------------------------
548 (defun tinypage-count-lines-in-page ()
550 (let* ((elt (tinypage-page-region))
555 (setq ret (count-lines beg end)))
558 ;;; ----------------------------------------------------------------------
560 (defun tinypage-current-page ()
563 (let* ((re "^[ \t]*\C-l")
568 (while (re-search-forward re p t)
574 ;;; ----------------------------------------------------------------------
576 (defun tinypage-update-mode-line ()
577 "Update modeline info."
579 (let* ((mode-string tinypage-:mode-name-string)
583 (setq pages (tinypage-count-pages))
584 (setq now (tinypage-current-page))
585 (setq lines (tinypage-count-lines-in-page))
586 (setq tinypage-:mode-name
587 (format " %s %s/%s/%s" mode-string now pages (or lines "-")))))
589 ;;; ----------------------------------------------------------------------
591 (defun tinypage-post-command ()
592 "Keep page info in modeline up to date."
593 (when tinypage-mode ;only now!
594 (if (not (integerp tinypage-:post-command-wakeup-counter))
595 (setq tinypage-:post-command-wakeup-counter 0))
596 (incf tinypage-:post-command-wakeup-counter)
598 (when (eq 0 (% tinypage-:post-command-wakeup-counter
599 tinypage-:post-command-wakeup-count))
600 (tinypage-modeline))))
602 ;;; ----------------------------------------------------------------------
604 (defun tinypage-overlay (act &optional beg end)
605 "If ACT is 'hide, hide overlay, otherwise highlight BEG END."
606 (let* ((ov (ti::compat-overlay-some)))
609 (ti::compat-overlay-move ov 1 1))
611 (ti::compat-overlay-move ov beg end)
612 (setq ov (symbol-value ov))
615 (ti::funcall 'overlay-start ov)
616 (ti::funcall 'extent-start-position ov))
620 (ti::funcall 'overlay-end ov)
621 (ti::funcall 'extent-end-position ov))
623 (setq this-command 'set-mark)))))
625 ;;; ----------------------------------------------------------------------
627 (defun tinypage-page-mark-region (beg end &optional act maybe)
628 "Mark region and do some command act.
634 ACT action name, default is 'copy. Can be also 'cut 'select
635 MAYBE flag to check is BEG END are valid: if not then do
636 nothing. If vallid; then select and do ACT.
646 (let* ((doit (if maybe
649 (reg tinypage-:register))
654 (tinypage-overlay 'show beg end)
657 (delete-region beg end)
659 ((memq act '(nil copy))
662 (ti::remove-properties (buffer-substring beg end)))))
667 ;;{{{ application functions
669 ;;; ----------------------------------------------------------------------
671 (defun tinypage-renumber-level-forward (&optional verb)
672 "Renumber current level starting from current line. VERB.
673 Only the last level number is incremented. Put cursor line above
674 the level and call this function
677 * <-- cursor here and it'll renumber level 1.2.1.x
682 `tinypage-:renumber-format'"
684 (let* ((data tinypage-:renumber-format)
696 (while (re-search-forward re nil t)
697 (setq level-string (match-string lev1))
699 (setq dots (count-char-in-string ?. level-string)))
700 (when (and (null dots-exact) ;do only once
702 (setq dots-exact dots
703 orig-level-string level-string))
704 (when (and dots-exact
705 (eq dots-exact dots) ;only same level accepted
706 ;; Must have same beginning "1.2.1.1" "1.2.1.x"
708 (string= orig-level-string level-string)
709 (setq nbr (match-string lev2)))
710 (if (null counter) ;first value ?
711 (setq counter (string-to-int nbr))
713 ;; Replace the last number with the right increment
714 (ti::replace-match lev2 (int-to-string counter))))))
718 (message "No matches."))
720 (message "Last heading was %s%s" orig-level-string counter))))
723 ;;; ----------------------------------------------------------------------
725 (defun tinypage-renumber-forward (&optional verb)
726 "Renumber all found headings forward. VERB."
728 (let* ((data tinypage-:renumber-format)
731 ;; Well, we do lot of extra work here, because the
732 ;; tinypage-renumber-level-forward goes alway to the bottom,
733 ;; but what the heck... it won't take long.
735 ;; And code is much cleaner this way.
737 (message "Renumbering..."))
738 (while (re-search-forward re nil t)
740 (tinypage-renumber-level-forward)
743 (message "Renumbering...done"))))
745 ;;; ----------------------------------------------------------------------
747 (defun tinypage-renumber-buffer ()
748 "Renumber all headings in buffer starting from `point-min'."
752 (tinypage-renumber-forward 'verb)))
754 ;;; ----------------------------------------------------------------------
756 (defsubst tinypage-get-index-list ()
757 "Return list of strings."
758 (let* ((list (ti::buffer-grep-lines (nth 0 tinypage-:renumber-format)))
761 (push (ti::string-remove-whitespace elt) ret))
764 ;;; ----------------------------------------------------------------------
766 (defun tinypage-toc (&optional ragged no-show)
767 "Create toc to temporary buffer.
768 Optional argument RAGGED makes the heading to 'hang'.
769 With nil RAGGED, the headings are lined up.
771 NO-SHOW doesn't show buffer after creating table of content.
776 (let* ((list (ti::buffer-grep-lines (nth 0 tinypage-:renumber-format)))
777 (buffer (ti::temp-buffer tinypage-:buffer-toc 'clear))
782 (with-current-buffer buffer
784 (setq elt (ti::string-remove-whitespace elt))
785 (setq heading (ti::string-match "^[^ \t]+" 0 elt))
786 (setq text (or (ti::string-match "^[^ \t]+[ \t]+\\(.*\\)" 1 elt)
787 "<no heading found>"))
788 ;; How to indent this line
789 (setq dots (count-char-in-string ?. heading))
792 (setq padd (make-string (* 2 (- dots 2)) ?\ )))
793 ;; Separate 1.0 topics
794 (if (string-match "0$" heading)
796 (setq heading (concat padd heading))
798 (insert heading " " text "\n")
799 (insert (format "%s %s\n" heading text)))))
801 ;; Display it, but do not select/go to it.
803 (display-buffer buffer)
804 (ti::save-excursion-macro
805 (select-window (get-buffer-window buffer))
806 (shrink-window-if-larger-than-buffer)))
809 ;;; ----------------------------------------------------------------------
811 (defun tinypage-toc-x-popup-keyboard ()
812 "Create index. Show it in X-popup."
814 (tinypage-toc-x-popup
815 (ti::compat-make-fake-event tinypage-:x-coord tinypage-:y-coord)))
817 ;;; ----------------------------------------------------------------------
819 (defun tinypage-toc-x-popup (event)
820 "Create index. Show it in X-popup with EVENT."
822 (let* ((len tinypage-:x-popup-line-len)
828 ((null (ti::compat-window-system))
829 (message "Sorry, Requires X to use X-popup"))
831 (setq list (tinypage-get-index-list))
835 (ti::string-left x len)))
837 (when (setq val (ti::compat-popup list event nil title))
838 ;; See if we can find the heading...
839 (ti::save-excursion-macro
841 (if (re-search-forward (regexp-quote val) nil t)
842 (setq point (line-beginning-position))
843 (message "Cannot find heading..."))))
845 (goto-char point))))))
847 ;;; ----------------------------------------------------------------------
849 (defun tinypage-toc-occur ()
850 "Create occur buffer for jumpig to Headings easily."
852 (occur (nth 0 tinypage-:renumber-format)))
855 ;;{{{ interactive funcs
857 ;;; ----------------------------------------------------------------------
860 (defun tinypage-region-action (act &optional verb)
861 "Execute action ACT. Return t or nil. VERB."
862 (let* ((elt (tinypage-page-region verb))
864 (end (cdr-safe elt)))
866 (tinypage-page-mark-region beg end act 'maybe)))
868 ;;; ----------------------------------------------------------------------
871 (defun tinypage-select (&optional verb)
872 "Select page. If sitting on page Marker, use page below. VERB."
875 (and (tinypage-region-action 'select verb)
877 (message "Page selected."))))
879 ;;; ----------------------------------------------------------------------
882 (defun tinypage-copy (&optional verb)
883 "Select page. If sitting on page Marker, use page below. VERB."
886 (and (tinypage-region-action 'copy verb)
888 (message "Page copied."))))
890 ;;; ----------------------------------------------------------------------
893 (defun tinypage-cut (&optional verb)
894 "Select page. If sitting on page Marker, use page below. VERB."
897 (tinypage-region-action 'cut verb))
899 ;;; ----------------------------------------------------------------------
902 (defun tinypage-yank (&optional verb)
903 "Yank page from register. VERB."
905 (insert-register tinypage-:register)
906 (tinypage-overlay 'hide))
908 ;;; ----------------------------------------------------------------------
911 (defun tinypage-yank-before (&optional verb)
912 "Yank page from register, but _before_ current page. VERB."
915 (tinypage-yank-after 'before "Yanked before this page." verb))
917 ;;; ----------------------------------------------------------------------
920 (defun tinypage-yank-after (&optional before msg verb)
921 "Yank page from register, but _after_ current page.
922 Optionally BEFORE with MSG and VERB."
924 (let* ((msg (or msg "Yanked after this page.")))
926 (ti::save-with-marker-macro
927 (when (tinypage-go-next before verb)
928 (insert-register tinypage-:register)
929 (tinypage-overlay 'hide)
933 ;;; ----------------------------------------------------------------------
936 (defun tinypage-go-previous (&optional verb)
937 "Go to previous page. VERB."
940 (tinypage-go-next 'back verb))
942 ;;; ----------------------------------------------------------------------
945 (defun tinypage-go-next (&optional back verb)
946 "Go to next page, optionally BACK. Return point if moved. VERB."
948 (let* ((point (point))
954 (setq func 're-search-backward)
957 (setq func 're-search-forward)
959 (unless (setq ret (funcall func "\C-l" nil t))
963 (if (and verb (null ret))
964 (message "No more page marks."))
969 (add-hook 'tinypage-:mode-define-keys-hook 'tinypage-mode-define-keys)
972 (run-hooks 'tinypage-:load-hook)
974 ;;; tinypage.el ends here