From: Eshel Yaron Date: Sun, 16 Oct 2022 15:20:33 +0000 (+0300) Subject: ENHANCED: update xref data for buffer after exporting predicate X-Git-Tag: V8.5.18-sweep-0.6.3~1 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a6b7339c881b62a3dac56adbf456120bd3ebad34;p=sweep.git ENHANCED: update xref data for buffer after exporting predicate --- diff --git a/sweeprolog.el b/sweeprolog.el index d1131d3..dd906df 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -2682,30 +2682,31 @@ non-exported predicates defined in the current buffer." (save-excursion (goto-char mend) (let ((pos (- (point-max) (point)))) - (if (search-backward "]" (car sweeprolog--module-term) t) - (combine-after-change-calls - (pcase (sweeprolog-last-token-boundaries) - (`(open ,_ ,_) - (insert pred) - (when (and comm (not (string-empty-p comm))) - (insert " % " comm)) - (insert "\n") - (indent-region mbeg (1+ (point)))) - (`(symbol ,_ ,oend) - (let ((point (point))) - (goto-char oend) - (insert ",") - (goto-char (1+ point)) - (insert "\n") - (backward-char) - (insert pred) - (when (and comm (not (string-empty-p comm))) - (insert " % " comm)) - (indent-region mbeg (- (point-max) pos)) - (align-regexp mbeg (- (point-max) pos) (rx (group (zero-or-more blank)) "%")) - )) - (_ (user-error "Unexpected token while looking for export list")))) - (user-error "Cannot find export list")))) + (unless (search-backward "]" (car sweeprolog--module-term) t) + (user-error "Cannot find export list")) + (combine-after-change-calls + (pcase (sweeprolog-last-token-boundaries) + (`(open ,_ ,_) + (insert pred) + (when (and comm (not (string-empty-p comm))) + (insert " % " comm)) + (insert "\n") + (indent-region mbeg (1+ (point)))) + (`(symbol ,_ ,oend) + (let ((point (point))) + (goto-char oend) + (insert ",") + (goto-char (1+ point)) + (insert "\n") + (backward-char) + (insert pred) + (when (and comm (not (string-empty-p comm))) + (insert " % " comm)) + (indent-region mbeg (- (point-max) pos)) + (align-regexp mbeg (- (point-max) pos) (rx (group (zero-or-more blank)) "%")))) + (_ (user-error "Unexpected token while looking for export list"))))) + (sweeprolog-colourise-buffer) + (message "Exported %s:%s" sweeprolog-buffer-module pred)) (user-error "Buffer is not a module"))) (defun sweeprolog-align-spaces (&optional _)