emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d1e2b10 3/5: Merge from origin/emacs-25


From: Paul Eggert
Subject: [Emacs-diffs] master d1e2b10 3/5: Merge from origin/emacs-25
Date: Mon, 11 Apr 2016 16:10:16 +0000

branch: master
commit d1e2b10afa2df313e029b3faeeb0d694fd6e0fbc
Merge: 7b45cc5 96d9e78
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Merge from origin/emacs-25
    
    96d9e78 Fix "Beginning of buffer" error in forward-page
    20686f7 Add a `transient' project type
---
 lisp/progmodes/project.el |   10 ++++++++--
 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 1251bca..9c8a88c 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -101,7 +101,9 @@ that it is not applicable, or a project instance.")
 (defun project-current (&optional maybe-prompt dir)
   "Return the project instance in DIR or `default-directory'.
 When no project found in DIR, and MAYBE-PROMPT is non-nil, ask
-the user for a different directory to look in."
+the user for a different directory to look in.  If that directory
+is not a part of a detectable project either, return a
+`transient' project instance rooted in it."
   (unless dir (setq dir default-directory))
   (let ((pr (project--find-in-directory dir)))
     (cond
@@ -110,7 +112,8 @@ the user for a different directory to look in."
       (setq dir (read-directory-name "Choose the project directory: " dir nil 
t)
             pr (project--find-in-directory dir))
       (unless pr
-        (user-error "No project found in `%s'" dir))))
+        (message "Using '%s' as a transient project root" dir)
+        (setq pr (cons 'transient dir)))))
     pr))
 
 (defun project--find-in-directory (dir)
@@ -182,6 +185,9 @@ to find the list of ignores for each directory."
        (t
        (complete-with-action action all-files string pred))))))
 
+(cl-defmethod project-roots ((project (head transient)))
+  (list (cdr project)))
+
 (defgroup project-vc nil
   "Project implementation using the VC package."
   :version "25.1"
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index 17fda677..22c7359 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
     (and (save-excursion (re-search-backward page-delimiter nil t))
         (= (match-end 0) (point))
         (goto-char (match-beginning 0)))
-    (forward-char -1)
-    (if (re-search-backward page-delimiter nil t)
-       ;; We found one--move to the end of it.
-       (goto-char (match-end 0))
-      ;; We found nothing--go to beg of buffer.
-      (goto-char (point-min)))
+    (unless (bobp)
+      (forward-char -1)
+      (if (re-search-backward page-delimiter nil t)
+         ;; We found one--move to the end of it.
+         (goto-char (match-end 0))
+       ;; We found nothing--go to beg of buffer.
+       (goto-char (point-min))))
     (setq count (1+ count))))
 
 (defun backward-page (&optional count)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]