diff options
| author | Karl Fogel | 2010-01-01 23:36:17 -0500 |
|---|---|---|
| committer | Karl Fogel | 2010-01-01 23:36:17 -0500 |
| commit | aef053eb79200ade81c9d364db234f484246c11b (patch) | |
| tree | 83d2142ef5a7b46f5af741fbc50979019cc2f5e3 | |
| parent | d8c75479e9e93c78f2d12c43b4b4b5f1478d9b57 (diff) | |
| download | emacs-aef053eb79200ade81c9d364db234f484246c11b.tar.gz emacs-aef053eb79200ade81c9d364db234f484246c11b.zip | |
* lisp/bookmark.el: Improvements suggested by Drew Adams:
(bookmark-bmenu-ensure-position): New name for
`bookmark-bmenu-check-position'. Just ensure the position;
don't return any meaningful value.
(bookmark-bmenu-header-height, bookmark-bmenu-marks-width): New constants.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/bookmark.el | 234 |
2 files changed, 122 insertions, 121 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 75048032b67..74b4cc1dbca 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2010-01-02 Karl Fogel <kfogel@red-bean.com> | ||
| 2 | |||
| 3 | * bookmark.el: Improvements suggested by Drew Adams: | ||
| 4 | (bookmark-bmenu-ensure-position): New name for | ||
| 5 | `bookmark-bmenu-check-position'. Just ensure the position, | ||
| 6 | don't return any meaningful value. | ||
| 7 | (bookmark-bmenu-header-height, bookmark-bmenu-marks-width): | ||
| 8 | New constants. | ||
| 9 | |||
| 1 | 2010-01-02 Juanma Barranquero <lekktu@gmail.com> | 10 | 2010-01-02 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 11 | ||
| 3 | * bookmark.el (bookmarks-already-loaded): Doc fix (don't use `iff'). | 12 | * bookmark.el (bookmarks-already-loaded): Doc fix (don't use `iff'). |
diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 54a70621cf9..74d16c16fc6 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | 43 | ||
| 44 | ;; And much thanks to David Hughes <djh@harston.cv.com> for many small | 44 | ;; And much thanks to David Hughes <djh@harston.cv.com> for many small |
| 45 | ;; suggestions and the code to implement them (like | 45 | ;; suggestions and the code to implement them (like |
| 46 | ;; bookmark-bmenu-check-position, and some of the Lucid compatibility | 46 | ;; bookmark-bmenu-ensure-position, and some of the Lucid compatibility |
| 47 | ;; stuff). | 47 | ;; stuff). |
| 48 | 48 | ||
| 49 | ;; Kudos (whatever they are) go to Jim Blandy <jimb@red-bean.com> | 49 | ;; Kudos (whatever they are) go to Jim Blandy <jimb@red-bean.com> |
| @@ -174,6 +174,12 @@ recently set ones come first, oldest ones come last)." | |||
| 174 | :group 'bookmark) | 174 | :group 'bookmark) |
| 175 | 175 | ||
| 176 | 176 | ||
| 177 | (defconst bookmark-bmenu-header-height 2 | ||
| 178 | "Number of lines used for the *Bookmark List* header.") | ||
| 179 | |||
| 180 | (defconst bookmark-bmenu-marks-width 2 | ||
| 181 | "Number of columns (chars) used for the *Bookmark List* marks column.") | ||
| 182 | |||
| 177 | (defcustom bookmark-bmenu-file-column 30 | 183 | (defcustom bookmark-bmenu-file-column 30 |
| 178 | "Column at which to display filenames in a buffer listing bookmarks. | 184 | "Column at which to display filenames in a buffer listing bookmarks. |
| 179 | You can toggle whether files are shown with \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-toggle-filenames]." | 185 | You can toggle whether files are shown with \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-toggle-filenames]." |
| @@ -1727,32 +1733,21 @@ mainly for debugging, and should not be necessary in normal use." | |||
| 1727 | (forward-line 1)))))) | 1733 | (forward-line 1)))))) |
| 1728 | 1734 | ||
| 1729 | 1735 | ||
| 1730 | (defun bookmark-bmenu-check-position () | 1736 | (defun bookmark-bmenu-ensure-position () |
| 1731 | "If point is not on a bookmark line, move it to one. | 1737 | "If point is not on a bookmark line, move it to one. |
| 1732 | If before the first bookmark line, move it to the first. | 1738 | If before the first bookmark line, move to the first; if after the |
| 1733 | If after the last, move it to the last. | 1739 | last full line, move to the last full line. The return value is undefined." |
| 1734 | Return `bookmark-alist'." | 1740 | (cond ((< (count-lines (point-min) (point)) bookmark-bmenu-header-height) |
| 1735 | ;; FIXME: The doc string originally implied that this returns nil if | ||
| 1736 | ;; not on a bookmark, which is false. Is there any real reason to | ||
| 1737 | ;; return `bookmark-alist'? This seems to be called in a few places | ||
| 1738 | ;; as a check of whether point is on a bookmark line. Those | ||
| 1739 | ;; "checks" are in fact no-ops, since this never returns nil. | ||
| 1740 | ;; -dadams, 2009-10-10 | ||
| 1741 | (cond ((< (count-lines (point-min) (point)) 2) | ||
| 1742 | (goto-char (point-min)) | 1741 | (goto-char (point-min)) |
| 1743 | (forward-line 2) | 1742 | (forward-line bookmark-bmenu-header-height)) |
| 1744 | bookmark-alist) | ||
| 1745 | ((and (bolp) (eobp)) | 1743 | ((and (bolp) (eobp)) |
| 1746 | (beginning-of-line 0) | 1744 | (beginning-of-line 0)))) |
| 1747 | bookmark-alist) | ||
| 1748 | (t | ||
| 1749 | bookmark-alist))) | ||
| 1750 | 1745 | ||
| 1751 | 1746 | ||
| 1752 | (defun bookmark-bmenu-bookmark () | 1747 | (defun bookmark-bmenu-bookmark () |
| 1753 | "Return the bookmark for this line in an interactive bookmark list buffer." | 1748 | "Return the bookmark for this line in an interactive bookmark list buffer." |
| 1754 | (when (bookmark-bmenu-check-position) | 1749 | (bookmark-bmenu-ensure-position) |
| 1755 | (get-text-property (line-beginning-position) 'bookmark-name-prop))) | 1750 | (get-text-property (line-beginning-position) 'bookmark-name-prop)) |
| 1756 | 1751 | ||
| 1757 | 1752 | ||
| 1758 | (defun bookmark-show-annotation (bookmark) | 1753 | (defun bookmark-show-annotation (bookmark) |
| @@ -1796,44 +1791,44 @@ if an annotation exists." | |||
| 1796 | "Mark bookmark on this line to be displayed by \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-select]." | 1791 | "Mark bookmark on this line to be displayed by \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-select]." |
| 1797 | (interactive) | 1792 | (interactive) |
| 1798 | (beginning-of-line) | 1793 | (beginning-of-line) |
| 1799 | (if (bookmark-bmenu-check-position) | 1794 | (bookmark-bmenu-ensure-position) |
| 1800 | (let ((inhibit-read-only t)) | 1795 | (let ((inhibit-read-only t)) |
| 1801 | (delete-char 1) | 1796 | (delete-char 1) |
| 1802 | (insert ?>) | 1797 | (insert ?>) |
| 1803 | (forward-line 1) | 1798 | (forward-line 1) |
| 1804 | (bookmark-bmenu-check-position)))) | 1799 | (bookmark-bmenu-ensure-position))) |
| 1805 | 1800 | ||
| 1806 | 1801 | ||
| 1807 | (defun bookmark-bmenu-select () | 1802 | (defun bookmark-bmenu-select () |
| 1808 | "Select this line's bookmark; also display bookmarks marked with `>'. | 1803 | "Select this line's bookmark; also display bookmarks marked with `>'. |
| 1809 | You can mark bookmarks with the \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-mark] command." | 1804 | You can mark bookmarks with the \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-mark] command." |
| 1810 | (interactive) | 1805 | (interactive) |
| 1811 | (if (bookmark-bmenu-check-position) | 1806 | (bookmark-bmenu-ensure-position) |
| 1812 | (let ((bmrk (bookmark-bmenu-bookmark)) | 1807 | (let ((bmrk (bookmark-bmenu-bookmark)) |
| 1813 | (menu (current-buffer)) | 1808 | (menu (current-buffer)) |
| 1814 | (others ()) | 1809 | (others ()) |
| 1815 | tem) | 1810 | tem) |
| 1816 | (goto-char (point-min)) | 1811 | (goto-char (point-min)) |
| 1817 | (while (re-search-forward "^>" nil t) | 1812 | (while (re-search-forward "^>" nil t) |
| 1818 | (setq tem (bookmark-bmenu-bookmark)) | 1813 | (setq tem (bookmark-bmenu-bookmark)) |
| 1819 | (let ((inhibit-read-only t)) | 1814 | (let ((inhibit-read-only t)) |
| 1820 | (delete-char -1) | 1815 | (delete-char -1) |
| 1821 | (insert ?\s)) | 1816 | (insert ?\s)) |
| 1822 | (or (string-equal tem bmrk) | 1817 | (or (string-equal tem bmrk) |
| 1823 | (member tem others) | 1818 | (member tem others) |
| 1824 | (setq others (cons tem others)))) | 1819 | (setq others (cons tem others)))) |
| 1825 | (setq others (nreverse others) | 1820 | (setq others (nreverse others) |
| 1826 | tem (/ (1- (frame-height)) (1+ (length others)))) | 1821 | tem (/ (1- (frame-height)) (1+ (length others)))) |
| 1827 | (delete-other-windows) | 1822 | (delete-other-windows) |
| 1828 | (bookmark-jump bmrk) | 1823 | (bookmark-jump bmrk) |
| 1829 | (bury-buffer menu) | 1824 | (bury-buffer menu) |
| 1830 | (if others | 1825 | (if others |
| 1831 | (while others | 1826 | (while others |
| 1832 | (split-window nil tem) | 1827 | (split-window nil tem) |
| 1833 | (other-window 1) | 1828 | (other-window 1) |
| 1834 | (bookmark-jump (car others)) | 1829 | (bookmark-jump (car others)) |
| 1835 | (setq others (cdr others))) | 1830 | (setq others (cdr others))) |
| 1836 | (other-window 1))))) | 1831 | (other-window 1)))) |
| 1837 | 1832 | ||
| 1838 | 1833 | ||
| 1839 | (defun bookmark-bmenu-save (parg) | 1834 | (defun bookmark-bmenu-save (parg) |
| @@ -1848,51 +1843,50 @@ With a prefix arg, prompts for a file to save them in." | |||
| 1848 | (defun bookmark-bmenu-load () | 1843 | (defun bookmark-bmenu-load () |
| 1849 | "Load the bookmark file and rebuild the bookmark menu-buffer." | 1844 | "Load the bookmark file and rebuild the bookmark menu-buffer." |
| 1850 | (interactive) | 1845 | (interactive) |
| 1851 | (if (bookmark-bmenu-check-position) | 1846 | (bookmark-bmenu-ensure-position) |
| 1852 | (save-excursion | 1847 | (save-excursion |
| 1853 | (save-window-excursion | 1848 | (save-window-excursion |
| 1854 | ;; This will call `bookmark-bmenu-list' | 1849 | ;; This will call `bookmark-bmenu-list' |
| 1855 | (call-interactively 'bookmark-load))))) | 1850 | (call-interactively 'bookmark-load)))) |
| 1856 | 1851 | ||
| 1857 | 1852 | ||
| 1858 | (defun bookmark-bmenu-1-window () | 1853 | (defun bookmark-bmenu-1-window () |
| 1859 | "Select this line's bookmark, alone, in full frame." | 1854 | "Select this line's bookmark, alone, in full frame." |
| 1860 | (interactive) | 1855 | (interactive) |
| 1861 | (if (bookmark-bmenu-check-position) | 1856 | (bookmark-bmenu-ensure-position) |
| 1862 | (progn | 1857 | (bookmark-jump (bookmark-bmenu-bookmark)) |
| 1863 | (bookmark-jump (bookmark-bmenu-bookmark)) | 1858 | (bury-buffer (other-buffer)) |
| 1864 | (bury-buffer (other-buffer)) | 1859 | (delete-other-windows)) |
| 1865 | (delete-other-windows)))) | ||
| 1866 | 1860 | ||
| 1867 | 1861 | ||
| 1868 | (defun bookmark-bmenu-2-window () | 1862 | (defun bookmark-bmenu-2-window () |
| 1869 | "Select this line's bookmark, with previous buffer in second window." | 1863 | "Select this line's bookmark, with previous buffer in second window." |
| 1870 | (interactive) | 1864 | (interactive) |
| 1871 | (if (bookmark-bmenu-check-position) | 1865 | (bookmark-bmenu-ensure-position) |
| 1872 | (let ((bmrk (bookmark-bmenu-bookmark)) | 1866 | (let ((bmrk (bookmark-bmenu-bookmark)) |
| 1873 | (menu (current-buffer)) | 1867 | (menu (current-buffer)) |
| 1874 | (pop-up-windows t)) | 1868 | (pop-up-windows t)) |
| 1875 | (delete-other-windows) | 1869 | (delete-other-windows) |
| 1876 | (switch-to-buffer (other-buffer)) | 1870 | (switch-to-buffer (other-buffer)) |
| 1877 | (let ((bookmark-automatically-show-annotations nil)) ;FIXME: needed? | 1871 | (let ((bookmark-automatically-show-annotations nil)) ;FIXME: needed? |
| 1878 | (bookmark--jump-via bmrk 'pop-to-buffer)) | 1872 | (bookmark--jump-via bmrk 'pop-to-buffer)) |
| 1879 | (bury-buffer menu)))) | 1873 | (bury-buffer menu))) |
| 1880 | 1874 | ||
| 1881 | 1875 | ||
| 1882 | (defun bookmark-bmenu-this-window () | 1876 | (defun bookmark-bmenu-this-window () |
| 1883 | "Select this line's bookmark in this window." | 1877 | "Select this line's bookmark in this window." |
| 1884 | (interactive) | 1878 | (interactive) |
| 1885 | (if (bookmark-bmenu-check-position) | 1879 | (bookmark-bmenu-ensure-position) |
| 1886 | (bookmark-jump (bookmark-bmenu-bookmark)))) | 1880 | (bookmark-jump (bookmark-bmenu-bookmark))) |
| 1887 | 1881 | ||
| 1888 | 1882 | ||
| 1889 | (defun bookmark-bmenu-other-window () | 1883 | (defun bookmark-bmenu-other-window () |
| 1890 | "Select this line's bookmark in other window, leaving bookmark menu visible." | 1884 | "Select this line's bookmark in other window, leaving bookmark menu visible." |
| 1891 | (interactive) | 1885 | (interactive) |
| 1892 | (let ((bookmark (bookmark-bmenu-bookmark))) | 1886 | (let ((bookmark (bookmark-bmenu-bookmark))) |
| 1893 | (if (bookmark-bmenu-check-position) | 1887 | (bookmark-bmenu-ensure-position) |
| 1894 | (let ((bookmark-automatically-show-annotations t)) ;FIXME: needed? | 1888 | (let ((bookmark-automatically-show-annotations t)) ;FIXME: needed? |
| 1895 | (bookmark--jump-via bookmark 'switch-to-buffer-other-window))))) | 1889 | (bookmark--jump-via bookmark 'switch-to-buffer-other-window)))) |
| 1896 | 1890 | ||
| 1897 | 1891 | ||
| 1898 | (defun bookmark-bmenu-switch-other-window () | 1892 | (defun bookmark-bmenu-switch-other-window () |
| @@ -1903,9 +1897,9 @@ The current window remains selected." | |||
| 1903 | (pop-up-windows t) | 1897 | (pop-up-windows t) |
| 1904 | same-window-buffer-names | 1898 | same-window-buffer-names |
| 1905 | same-window-regexps) | 1899 | same-window-regexps) |
| 1906 | (if (bookmark-bmenu-check-position) | 1900 | (bookmark-bmenu-ensure-position) |
| 1907 | (let ((bookmark-automatically-show-annotations t)) ;FIXME: needed? | 1901 | (let ((bookmark-automatically-show-annotations t)) ;FIXME: needed? |
| 1908 | (bookmark--jump-via bookmark 'display-buffer))))) | 1902 | (bookmark--jump-via bookmark 'display-buffer)))) |
| 1909 | 1903 | ||
| 1910 | (defun bookmark-bmenu-other-window-with-mouse (event) | 1904 | (defun bookmark-bmenu-other-window-with-mouse (event) |
| 1911 | "Select bookmark at the mouse pointer in other window, leaving bookmark menu visible." | 1905 | "Select bookmark at the mouse pointer in other window, leaving bookmark menu visible." |
| @@ -1920,8 +1914,8 @@ The current window remains selected." | |||
| 1920 | "Show the annotation for the current bookmark in another window." | 1914 | "Show the annotation for the current bookmark in another window." |
| 1921 | (interactive) | 1915 | (interactive) |
| 1922 | (let ((bookmark (bookmark-bmenu-bookmark))) | 1916 | (let ((bookmark (bookmark-bmenu-bookmark))) |
| 1923 | (if (bookmark-bmenu-check-position) | 1917 | (bookmark-bmenu-ensure-position) |
| 1924 | (bookmark-show-annotation bookmark)))) | 1918 | (bookmark-show-annotation bookmark))) |
| 1925 | 1919 | ||
| 1926 | 1920 | ||
| 1927 | (defun bookmark-bmenu-show-all-annotations () | 1921 | (defun bookmark-bmenu-show-all-annotations () |
| @@ -1934,8 +1928,8 @@ The current window remains selected." | |||
| 1934 | "Edit the annotation for the current bookmark in another window." | 1928 | "Edit the annotation for the current bookmark in another window." |
| 1935 | (interactive) | 1929 | (interactive) |
| 1936 | (let ((bookmark (bookmark-bmenu-bookmark))) | 1930 | (let ((bookmark (bookmark-bmenu-bookmark))) |
| 1937 | (if (bookmark-bmenu-check-position) | 1931 | (bookmark-bmenu-ensure-position) |
| 1938 | (bookmark-edit-annotation bookmark)))) | 1932 | (bookmark-edit-annotation bookmark))) |
| 1939 | 1933 | ||
| 1940 | 1934 | ||
| 1941 | (defun bookmark-bmenu-unmark (&optional backup) | 1935 | (defun bookmark-bmenu-unmark (&optional backup) |
| @@ -1943,27 +1937,25 @@ The current window remains selected." | |||
| 1943 | Optional BACKUP means move up." | 1937 | Optional BACKUP means move up." |
| 1944 | (interactive "P") | 1938 | (interactive "P") |
| 1945 | (beginning-of-line) | 1939 | (beginning-of-line) |
| 1946 | (if (bookmark-bmenu-check-position) | 1940 | (bookmark-bmenu-ensure-position) |
| 1947 | (progn | 1941 | (let ((inhibit-read-only t)) |
| 1948 | (let ((inhibit-read-only t)) | 1942 | (delete-char 1) |
| 1949 | (delete-char 1) | 1943 | ;; any flags to reset according to circumstances? How about a |
| 1950 | ;; any flags to reset according to circumstances? How about a | 1944 | ;; flag indicating whether this bookmark is being visited? |
| 1951 | ;; flag indicating whether this bookmark is being visited? | 1945 | ;; well, we don't have this now, so maybe later. |
| 1952 | ;; well, we don't have this now, so maybe later. | 1946 | (insert " ")) |
| 1953 | (insert " ")) | 1947 | (forward-line (if backup -1 1)) |
| 1954 | (forward-line (if backup -1 1)) | 1948 | (bookmark-bmenu-ensure-position)) |
| 1955 | (bookmark-bmenu-check-position)))) | ||
| 1956 | 1949 | ||
| 1957 | 1950 | ||
| 1958 | (defun bookmark-bmenu-backup-unmark () | 1951 | (defun bookmark-bmenu-backup-unmark () |
| 1959 | "Move up and cancel all requested operations on bookmark on line above." | 1952 | "Move up and cancel all requested operations on bookmark on line above." |
| 1960 | (interactive) | 1953 | (interactive) |
| 1961 | (forward-line -1) | 1954 | (forward-line -1) |
| 1962 | (if (bookmark-bmenu-check-position) | 1955 | (bookmark-bmenu-ensure-position) |
| 1963 | (progn | 1956 | (bookmark-bmenu-unmark) |
| 1964 | (bookmark-bmenu-unmark) | 1957 | (forward-line -1) |
| 1965 | (forward-line -1) | 1958 | (bookmark-bmenu-ensure-position)) |
| 1966 | (bookmark-bmenu-check-position)))) | ||
| 1967 | 1959 | ||
| 1968 | 1960 | ||
| 1969 | (defun bookmark-bmenu-delete () | 1961 | (defun bookmark-bmenu-delete () |
| @@ -1971,12 +1963,12 @@ Optional BACKUP means move up." | |||
| 1971 | To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]." | 1963 | To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]." |
| 1972 | (interactive) | 1964 | (interactive) |
| 1973 | (beginning-of-line) | 1965 | (beginning-of-line) |
| 1974 | (if (bookmark-bmenu-check-position) | 1966 | (bookmark-bmenu-ensure-position) |
| 1975 | (let ((inhibit-read-only t)) | 1967 | (let ((inhibit-read-only t)) |
| 1976 | (delete-char 1) | 1968 | (delete-char 1) |
| 1977 | (insert ?D) | 1969 | (insert ?D) |
| 1978 | (forward-line 1) | 1970 | (forward-line 1) |
| 1979 | (bookmark-bmenu-check-position)))) | 1971 | (bookmark-bmenu-ensure-position))) |
| 1980 | 1972 | ||
| 1981 | 1973 | ||
| 1982 | (defun bookmark-bmenu-delete-backwards () | 1974 | (defun bookmark-bmenu-delete-backwards () |
| @@ -1985,9 +1977,9 @@ To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\ | |||
| 1985 | (interactive) | 1977 | (interactive) |
| 1986 | (bookmark-bmenu-delete) | 1978 | (bookmark-bmenu-delete) |
| 1987 | (forward-line -2) | 1979 | (forward-line -2) |
| 1988 | (if (bookmark-bmenu-check-position) | 1980 | (bookmark-bmenu-ensure-position) |
| 1989 | (forward-line 1)) | 1981 | (forward-line 1) |
| 1990 | (bookmark-bmenu-check-position)) | 1982 | (bookmark-bmenu-ensure-position)) |
| 1991 | 1983 | ||
| 1992 | 1984 | ||
| 1993 | (defun bookmark-bmenu-execute-deletions () | 1985 | (defun bookmark-bmenu-execute-deletions () |
| @@ -2022,29 +2014,29 @@ To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\ | |||
| 2022 | (defun bookmark-bmenu-rename () | 2014 | (defun bookmark-bmenu-rename () |
| 2023 | "Rename bookmark on current line. Prompts for a new name." | 2015 | "Rename bookmark on current line. Prompts for a new name." |
| 2024 | (interactive) | 2016 | (interactive) |
| 2025 | (if (bookmark-bmenu-check-position) | 2017 | (bookmark-bmenu-ensure-position) |
| 2026 | (let ((bmrk (bookmark-bmenu-bookmark)) | 2018 | (let ((bmrk (bookmark-bmenu-bookmark)) |
| 2027 | (thispoint (point))) | 2019 | (thispoint (point))) |
| 2028 | (bookmark-rename bmrk) | 2020 | (bookmark-rename bmrk) |
| 2029 | (goto-char thispoint)))) | 2021 | (goto-char thispoint))) |
| 2030 | 2022 | ||
| 2031 | 2023 | ||
| 2032 | (defun bookmark-bmenu-locate () | 2024 | (defun bookmark-bmenu-locate () |
| 2033 | "Display location of this bookmark. Displays in the minibuffer." | 2025 | "Display location of this bookmark. Displays in the minibuffer." |
| 2034 | (interactive) | 2026 | (interactive) |
| 2035 | (if (bookmark-bmenu-check-position) | 2027 | (bookmark-bmenu-ensure-position) |
| 2036 | (let ((bmrk (bookmark-bmenu-bookmark))) | 2028 | (let ((bmrk (bookmark-bmenu-bookmark))) |
| 2037 | (message "%s" (bookmark-location bmrk))))) | 2029 | (message "%s" (bookmark-location bmrk)))) |
| 2038 | 2030 | ||
| 2039 | (defun bookmark-bmenu-relocate () | 2031 | (defun bookmark-bmenu-relocate () |
| 2040 | "Change the file path of the bookmark on the current line, | 2032 | "Change the file path of the bookmark on the current line, |
| 2041 | prompting with completion for the new path." | 2033 | prompting with completion for the new path." |
| 2042 | (interactive) | 2034 | (interactive) |
| 2043 | (if (bookmark-bmenu-check-position) | 2035 | (bookmark-bmenu-ensure-position) |
| 2044 | (let ((bmrk (bookmark-bmenu-bookmark)) | 2036 | (let ((bmrk (bookmark-bmenu-bookmark)) |
| 2045 | (thispoint (point))) | 2037 | (thispoint (point))) |
| 2046 | (bookmark-relocate bmrk) | 2038 | (bookmark-relocate bmrk) |
| 2047 | (goto-char thispoint)))) | 2039 | (goto-char thispoint))) |
| 2048 | 2040 | ||
| 2049 | ;;; Bookmark-bmenu search | 2041 | ;;; Bookmark-bmenu search |
| 2050 | 2042 | ||
| @@ -2105,7 +2097,7 @@ To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\ | |||
| 2105 | (defun bookmark-bmenu-goto-bookmark (name) | 2097 | (defun bookmark-bmenu-goto-bookmark (name) |
| 2106 | "Move point to bookmark with name NAME." | 2098 | "Move point to bookmark with name NAME." |
| 2107 | (goto-char (point-min)) | 2099 | (goto-char (point-min)) |
| 2108 | (bookmark-bmenu-check-position) | 2100 | (bookmark-bmenu-ensure-position) |
| 2109 | (while (not (equal name (bookmark-bmenu-bookmark))) | 2101 | (while (not (equal name (bookmark-bmenu-bookmark))) |
| 2110 | (forward-line 1)) | 2102 | (forward-line 1)) |
| 2111 | (forward-line 0)) | 2103 | (forward-line 0)) |