diff options
| -rw-r--r-- | lisp/progmodes/project.el | 10 | ||||
| -rw-r--r-- | lisp/textmodes/page.el | 13 |
2 files changed, 15 insertions, 8 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 1251bca2491..9c8a88c80fc 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -101,7 +101,9 @@ that it is not applicable, or a project instance.") | |||
| 101 | (defun project-current (&optional maybe-prompt dir) | 101 | (defun project-current (&optional maybe-prompt dir) |
| 102 | "Return the project instance in DIR or `default-directory'. | 102 | "Return the project instance in DIR or `default-directory'. |
| 103 | When no project found in DIR, and MAYBE-PROMPT is non-nil, ask | 103 | When no project found in DIR, and MAYBE-PROMPT is non-nil, ask |
| 104 | the user for a different directory to look in." | 104 | the user for a different directory to look in. If that directory |
| 105 | is not a part of a detectable project either, return a | ||
| 106 | `transient' project instance rooted in it." | ||
| 105 | (unless dir (setq dir default-directory)) | 107 | (unless dir (setq dir default-directory)) |
| 106 | (let ((pr (project--find-in-directory dir))) | 108 | (let ((pr (project--find-in-directory dir))) |
| 107 | (cond | 109 | (cond |
| @@ -110,7 +112,8 @@ the user for a different directory to look in." | |||
| 110 | (setq dir (read-directory-name "Choose the project directory: " dir nil t) | 112 | (setq dir (read-directory-name "Choose the project directory: " dir nil t) |
| 111 | pr (project--find-in-directory dir)) | 113 | pr (project--find-in-directory dir)) |
| 112 | (unless pr | 114 | (unless pr |
| 113 | (user-error "No project found in `%s'" dir)))) | 115 | (message "Using '%s' as a transient project root" dir) |
| 116 | (setq pr (cons 'transient dir))))) | ||
| 114 | pr)) | 117 | pr)) |
| 115 | 118 | ||
| 116 | (defun project--find-in-directory (dir) | 119 | (defun project--find-in-directory (dir) |
| @@ -182,6 +185,9 @@ to find the list of ignores for each directory." | |||
| 182 | (t | 185 | (t |
| 183 | (complete-with-action action all-files string pred)))))) | 186 | (complete-with-action action all-files string pred)))))) |
| 184 | 187 | ||
| 188 | (cl-defmethod project-roots ((project (head transient))) | ||
| 189 | (list (cdr project))) | ||
| 190 | |||
| 185 | (defgroup project-vc nil | 191 | (defgroup project-vc nil |
| 186 | "Project implementation using the VC package." | 192 | "Project implementation using the VC package." |
| 187 | :version "25.1" | 193 | :version "25.1" |
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el index 17fda677754..22c73591b91 100644 --- a/lisp/textmodes/page.el +++ b/lisp/textmodes/page.el | |||
| @@ -48,12 +48,13 @@ A page boundary is any line whose beginning matches the regexp | |||
| 48 | (and (save-excursion (re-search-backward page-delimiter nil t)) | 48 | (and (save-excursion (re-search-backward page-delimiter nil t)) |
| 49 | (= (match-end 0) (point)) | 49 | (= (match-end 0) (point)) |
| 50 | (goto-char (match-beginning 0))) | 50 | (goto-char (match-beginning 0))) |
| 51 | (forward-char -1) | 51 | (unless (bobp) |
| 52 | (if (re-search-backward page-delimiter nil t) | 52 | (forward-char -1) |
| 53 | ;; We found one--move to the end of it. | 53 | (if (re-search-backward page-delimiter nil t) |
| 54 | (goto-char (match-end 0)) | 54 | ;; We found one--move to the end of it. |
| 55 | ;; We found nothing--go to beg of buffer. | 55 | (goto-char (match-end 0)) |
| 56 | (goto-char (point-min))) | 56 | ;; We found nothing--go to beg of buffer. |
| 57 | (goto-char (point-min)))) | ||
| 57 | (setq count (1+ count)))) | 58 | (setq count (1+ count)))) |
| 58 | 59 | ||
| 59 | (defun backward-page (&optional count) | 60 | (defun backward-page (&optional count) |