[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rec-mode 1da5f1a 10/14: Use pipes with Flymake, fix IMe
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rec-mode 1da5f1a 10/14: Use pipes with Flymake, fix IMenu index |
Date: |
Sat, 27 Mar 2021 13:30:42 -0400 (EDT) |
branch: externals/rec-mode
commit 1da5f1ad624fb3e0066d84bd0dfed7ab55c99eda
Author: Antoine Kalmbach <ane@iki.fi>
Commit: Antoine Kalmbach <ane@iki.fi>
Use pipes with Flymake, fix IMenu index
* rec-mode.el (rec-mode-imenu-index-name-function): Change imenu
index naming.
(rec-mode-flymake-recfix): Use pipes.
(rec-mode-imenu-goto-function): Sync after imenu jump, and don't
narrow if not in rec-edit-mode.
---
rec-mode.el | 74 ++++++++++++++++++++++++++++++-------------------------------
1 file changed, 36 insertions(+), 38 deletions(-)
diff --git a/rec-mode.el b/rec-mode.el
index dca6bc9..3d596da 100644
--- a/rec-mode.el
+++ b/rec-mode.el
@@ -2848,37 +2848,36 @@ function returns nil."
Defers to `recfix' for checking the buffer, calling REPORT-FN
to report the errors."
(when (executable-find rec-recfix)
- (when rec-mode--recfix-process
- (when (process-live-p rec-mode--recfix-process)
- (kill-process rec-mode--recfix-process)))
- (let ((temp-file (make-temp-file "flymake-recfix"))
- (source-buffer (current-buffer)))
+ (when (process-live-p rec-mode--recfix-process)
+ (kill-process rec-mode--recfix-process))
+ (let ((source-buffer (current-buffer))
+ (output-buffer (generate-new-buffer " *flymake-recfix*")))
+ (setq
+ rec-mode--recfix-process
+ (make-process
+ :name "rec-mode-flymake-recfix"
+ :stderr output-buffer
+ :buffer "*stdout of flymake-recfix*"
+ :command (list rec-recfix)
+ :connection-type 'pipe
+ :sentinel
+ (lambda (proc _event)
+ (when (eq (process-status proc) 'exit)
+ (unwind-protect
+ (let ((diagnostics (rec-mode-flymake-recfix-diagnostics
source-buffer output-buffer)))
+ (if (or diagnostics (zerop (process-exit-status proc)))
+ (funcall report-fn diagnostics)
+ (funcall report-fn
+ :panic
+ :explanation
+ (format "recfix process %s died" proc))))
+ (kill-buffer output-buffer))))
+ :noquery t))
(save-restriction
(widen)
- (write-region (point-min) (point-max) temp-file nil 'nomessage))
- (let* ((output-buffer (generate-new-buffer "*flymake-recfix*")))
- (setq
- rec-mode--recfix-process
- (make-process
- :name "rec-mode-flymake-recfix"
- :stderr output-buffer
- :buffer "*stdout of flymake-recfix*"
- :command (list rec-recfix temp-file)
- :connection-type 'pipe
- :sentinel
- (lambda (proc _event)
- (when (eq (process-status proc) 'exit)
- (unwind-protect
- (let ((diagnostics (rec-mode-flymake-recfix-diagnostics
source-buffer output-buffer)))
- (if (or diagnostics (zerop (process-exit-status proc)))
- (funcall report-fn diagnostics)
- (funcall report-fn
- :panic
- :explanation
- (format "recfix process %s died" proc))))
- (ignore-errors (delete-file temp-file))
- (kill-buffer output-buffer))))
- :noquery t))))))
+ (process-send-string rec-mode--recfix-process
+ (buffer-substring-no-properties (point-min)
(point-max)))
+ (process-send-eof rec-mode--recfix-process)))))
;;;###autoload
(defun rec-mode-eldoc-function (&rest _ignore)
@@ -2906,20 +2905,17 @@ to report the errors."
(defun rec-mode-imenu-index-name-function ()
"Get an imenu index entry for the record at point."
(let ((type (rec-record-type))
- (current (rec-current-record))
- (record (propertize "Record" 'face 'font-lock-variable-name-face))
- (desc (propertize "Descriptor" 'face 'font-lock-function-name-face)))
+ (current (rec-current-record)))
(if type
(cond ((rec-record-descriptor-p current)
- (format "%s: %s" desc type))
+ (propertize (format "%%%s" type) 'face 'font-lock-keyword-face))
((not (null (rec-key)))
(let ((key-value (car-safe (rec-record-assoc
(rec-key)
current))))
- (format "%s: %s %s" record type (or key-value ""))))
- (t
- (format "%s: %s" record type)))
- record)))
+ (format "%s %s" type (or key-value ""))))
+ (t type))
+ "Record")))
(defun rec-mode-imenu-goto-function (name position &rest rest)
"Move to the chosen record.
@@ -2928,7 +2924,9 @@ Calls function `imenu-default-goto-function' (which see),
with
NAME, POSITION and REST, but unlike that function, re-narrows
onto the chosen record."
(apply 'imenu-default-goto-function name position rest)
- (rec-show-record))
+ (unless (derived-mode-p 'rec-edit-mode)
+ (rec-show-record))
+ (rec-summary-move-to-record (rec-current-record)))
;;;; Definition of modes
- [elpa] externals/rec-mode 8d852cc 03/14: ob-rec.el: Update copyright years, set Maintainer, (continued)
- [elpa] externals/rec-mode 8d852cc 03/14: ob-rec.el: Update copyright years, set Maintainer, Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode fbad46f 01/14: Add indexes to the manual and some style/layout changes, Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode 9c3d4d2 04/14: Add a menu, Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode 4bef4b3 07/14: rec-cmd-show-summary: pass :type to rec-query, Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode b01f1e7 08/14: Selection improvements -- rec-selection-mode and cross referencing, Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode 0214c27 11/14: Synchronize summary buffer with the selection, Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode 6c53c57 02/14: Move smartly around after editing fields, Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode d45a8c7 09/14: Flymake, ElDoc and IMenu support, Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode 254c725 12/14: Update documentation to match new sync behavior, Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode c080633 06/14: Refactor to use generics and structs instead of lists., Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode 1da5f1a 10/14: Use pipes with Flymake, fix IMenu index,
Stefan Monnier <=
- [elpa] externals/rec-mode 6044b89 13/14: Remove duplicate code, remove unused bindings, Stefan Monnier, 2021/03/27
- [elpa] externals/rec-mode 12d864d 14/14: Merge remote-tracking branch 'upstream/rec-mode/main' into externals/rec-mode, Stefan Monnier, 2021/03/27