Georg Bauhaus <[email protected]> writes:
> Am 31.03.2014 um 20:25 schrieb Stephen Leake <[email protected]>:
>
>> We should have ada-mode replace nil with the actual current directory.
>> That fixes this prolem.
>>
>> here's a patch for this and the previous bug:
>>
>> #
>> # old_revision [c570df17b4e1d2234a1a30a12106ebefff381a7c]
>> #
>> # patch "ada-mode.el"
>> # from [da7274b40a4e10086ec62dea594529d6a9e83eba]
>> # to [c1769814d8f02680095640501a62b237d9e02ad7]
>
>
> I have put the hunks in the proper places; in 5.1.1,
> now, ff-find-other-file does not yield full results, the
> message being that `ada-make-package-body' is not set
> (yet).
Ah. Sorry, I did not actually test after deleting the body file.
> A new buffer is created, though, having
> ada-skel-inital-string as its only content.
Ok.
It would make sense for the function ada-make-package-body to
do nothing when the variable ada-make-package-body is not set, rather
than throw an error. Actually, the check should be in
ada-ff-create-body. another cumulative patch is given below.
Alternately, since ada-xref-tool defaults to gnat, it would make sense
to invoke ada-gnat-xref-select-prj when ada-gnat-xref.el is loaded, and
use the gnat functions for everything. Hmm. That doesn't work, because
ada-gnat-make-package-body requires a project file. Except that it
shouldn't; but that's not easy to fix. Sigh.
> The effect is the same for C-c C-o, which is bound to
> ada-find-other-file.
>
> Compiling the spec
Exactly how do you "compile the spec"? You must be doing something that
sets ada-make-package-body
>or selecting a project will both
> make ff-find-other-file work.
This is expected; selecting the project sets ada-make-package-body.
--
-- Stephe
#
# old_revision [c570df17b4e1d2234a1a30a12106ebefff381a7c]
#
# patch "ada-mode.el"
# from [da7274b40a4e10086ec62dea594529d6a9e83eba]
# to [0560ea11aac0db1e7bbed015095b0d8dad0b75f8]
#
============================================================
--- ada-mode.el da7274b40a4e10086ec62dea594529d6a9e83eba
+++ ada-mode.el 0560ea11aac0db1e7bbed015095b0d8dad0b75f8
@@ -1838,8 +1838,10 @@ previously set by a file navigation comm
;; This will still be confused by multiple references; we need
;; to use compiler cross reference info for more precision.
(while (not done)
- (when (search-forward-regexp ff-function-name nil t)
- (setq found (match-beginning 0)))
+ (if (search-forward-regexp ff-function-name nil t)
+ (setq found (match-beginning 0))
+ ;; not in remainder of buffer
+ (setq done t))
(if (ada-in-string-or-comment-p)
(setq found nil)
(setq done t)))
@@ -2310,23 +2312,26 @@ package body file, containing skeleton c
package body file, containing skeleton code that will compile.")
(defun ada-make-package-body (body-file-name)
- (if ada-make-package-body
- (funcall ada-make-package-body body-file-name)
- (error "`ada-make-package-body' not set")))
+ ;; no error if not set; let ada-skel do its thing.
+ (when ada-make-package-body
+ (funcall ada-make-package-body body-file-name)))
(defun ada-ff-create-body ()
- ;; ff-find-other-file calls us with point in an empty buffer for the
- ;; body file; ada-make-package-body expects to be in the spec. So go
- ;; back.
- (let ((body-file-name (buffer-file-name)))
- (ff-find-the-other-file)
- (ada-make-package-body body-file-name)
- ;; FIXME (later): if 'ada-make-package-body' fails, delete the body buffer
- ;; so it doesn't get written to disk, and we can try again.
+ ;; no error if not set; let ada-skel do its thing.
+ (when ada-make-package-body
+ ;; ff-find-other-file calls us with point in an empty buffer for the
+ ;; body file; ada-make-package-body expects to be in the spec. So go
+ ;; back.
+ (let ((body-file-name (buffer-file-name)))
+ (ff-find-the-other-file)
- ;; back to the body, read in from the disk.
- (ff-find-the-other-file)
- (revert-buffer t t)
+ (ada-make-package-body body-file-name)
+ ;; FIXME (later): if 'ada-make-package-body' fails, delete the body
buffer
+ ;; so it doesn't get written to disk, and we can try again.
+
+ ;; back to the body, read in from the disk.
+ (ff-find-the-other-file)
+ (revert-buffer t t))
))
;;;; fill-comment
@@ -2635,6 +2640,9 @@ The paragraph is indented on the first l
ff-file-created-hook 'ada-ff-create-body)
(add-hook 'ff-pre-load-hook 'ada-which-function)
(setq ff-search-directories 'compilation-search-path)
+ (when (null (car compilation-search-path))
+ ;; find-file doesn't handle nil in search path
+ (setq compilation-search-path (list (file-name-directory
(buffer-file-name)))))
(ada-set-ff-special-constructs)
(set (make-local-variable 'add-log-current-defun-function)
_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org