From f8b2149a6f22386c2ffceaeeaff2d0bf2d5f752a Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Fri, 24 Apr 2026 18:47:55 +0200 Subject: [PATCH] update graphviz-dot-mode --- .../graphviz-dot-mode-pkg.el | 12 - .../graphviz-dot-flycheck.el | 154 ++++++++++++ .../graphviz-dot-mode-autoloads.el | 48 ++-- .../graphviz-dot-mode-pkg.el | 9 + .../graphviz-dot-mode.el | 230 ++++++++---------- 5 files changed, 284 insertions(+), 169 deletions(-) delete mode 100644 elpa/graphviz-dot-mode-20230325.1050/graphviz-dot-mode-pkg.el create mode 100644 elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-flycheck.el rename elpa/{graphviz-dot-mode-20230325.1050 => graphviz-dot-mode-20250925.1226}/graphviz-dot-mode-autoloads.el (74%) create mode 100644 elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-mode-pkg.el rename elpa/{graphviz-dot-mode-20230325.1050 => graphviz-dot-mode-20250925.1226}/graphviz-dot-mode.el (84%) diff --git a/elpa/graphviz-dot-mode-20230325.1050/graphviz-dot-mode-pkg.el b/elpa/graphviz-dot-mode-20230325.1050/graphviz-dot-mode-pkg.el deleted file mode 100644 index 6fe7d636..00000000 --- a/elpa/graphviz-dot-mode-20230325.1050/graphviz-dot-mode-pkg.el +++ /dev/null @@ -1,12 +0,0 @@ -(define-package "graphviz-dot-mode" "20230325.1050" "Mode for the dot-language used by graphviz (att)." - '((emacs "25.0")) - :commit "8ff793b13707cb511875f56e167ff7f980a31136" :maintainers - '(("Pieter Pareit" . "pieter.pareit@gmail.com")) - :maintainer - '("Pieter Pareit" . "pieter.pareit@gmail.com") - :keywords - '("mode" "dot" "dot-language" "dotlanguage" "graphviz" "graphs" "att") - :url "https://ppareit.github.io/graphviz-dot-mode/") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-flycheck.el b/elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-flycheck.el new file mode 100644 index 00000000..08bf02bd --- /dev/null +++ b/elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-flycheck.el @@ -0,0 +1,154 @@ +;;; graphviz-dot-flycheck.el --- Flychecker for graphviz. -*- lexical-binding: t; -*- + +;; Part of graphviz-dot-mode, see https://ppareit.github.io/graphviz-dot-mode/ + +;; Copyright (C) 2025 - 2025 Pieter Pareit + +;; Package-Requires: ((emacs "25.0") (flycheck "20250527.907")) + +;;; Commentary: +;; +;;; Todo: +;; +;;; Code: +(require 'flycheck nil t) + +(defun graphviz-dot--add-column-to-error (err) + "Attach :column and :end-column to a ERR so we underline the exact token." + (when-let* ((msg (flycheck-error-message err)) + (buf (flycheck-error-buffer err)) + ((buffer-live-p buf)) ; buffer may have died + (line (flycheck-error-line err)) + (_ (string-match "near '\\([^']+\\)'" msg)) + (token (match-string 1 msg))) + (with-current-buffer buf + (save-excursion + (goto-char (point-min)) + (forward-line (1- line)) ; line is 1-based + (when-let* ((end (search-forward token (line-end-position) t)) + (start (- end (length token))) + (bol (line-beginning-position))) + (setf (flycheck-error-column err) (1+ (- start bol)) + (flycheck-error-end-column err) (1+ (- end bol))))))) + err) + +(defun graphviz-dot--prettify-error-message (err) + "Tweak a single Flycheck ERR from the Graphviz checker." + (when-let ((msg (flycheck-error-message err))) + ;; Drop “gvrender_set_style: ” + (setq msg (replace-regexp-in-string "\\`gvrender_set_style: *" "" msg)) + ;; Drop “using box for ” + (setq msg (replace-regexp-in-string "\\`using box for *" "" msg)) + ;; Trim “ - ignoring[.]” at the end. + (setq msg (replace-regexp-in-string " - ignoring\\.?\\s-*\\'" "" msg)) + ;; Turn bare “near 'foo'” into a full sentence. + (when (string-match "\\` *near '[^']+'\\'" msg) + (setq msg (concat "Syntax error " msg))) + ;; Save result back into ERR. + (setf (flycheck-error-message err) msg)) + err) + +(defun graphviz-dot--search-regex-from-msg (msg) + "Return regexp for MSG. + +Return a regexp that should locate the first occurrence of the +offending token mentioned in Graphviz warning MSG." + (cond + ;; unknown shape + ((string-match "unknown shape[[:space:]]+\\([[:alnum:]_-]+\\)" msg) + (format "\\bshape[[:space:]]*=[[:space:]]*\"?%s\\b" + (regexp-quote (match-string 1 msg)))) + ;; unsupported style + ((string-match "unsupported style[[:space:]]+\\([[:alnum:]_-]+\\)" msg) + (format "\\bstyle[[:space:]]*=[[:space:]]*\"?%s\\b" + (regexp-quote (match-string 1 msg)))) + ;; TOKEN is not a known color + ;; colour shows up in color=, fontcolor=, fillcolor= so allow any of them + ((string-match "\\`\\([^[:space:]]+\\)[[:space:]]+is not a known color" msg) + (format "\\b\\(?:color\\|fontcolor\\|fillcolor\\)[[:space:]]*=[[:space:]]*\"?%s\\b" + (regexp-quote (match-string 1 msg)))) + ;; Arrow type "TOKEN" unknown + ;; * arrowhead=TOKEN + ;; * arrowtail = "fooTOKENbar" + ((string-match "Arrow type \"\\([^\"]+\\)\" unknown" msg) + (let ((tok (regexp-quote (match-string 1 msg)))) + ;; arrow(head|tail) *= *"?(anything)*TOKEN(anything)*"? (no newline) + (format + "\\barrow\\(?:head\\|tail\\)[[:space:]]*=[[:space:]]*\"?[^\"\n]*%s[^\"\n]*\"?" + tok))) + ;; port "TOKEN" unrecognized + ;; search for :TOKEN (optionally with spaces or quotes) + ((string-match "port \"?\\([^\"]+\\)\"? unrecognized" msg) + (format ":[[:space:]]*\"?%s\\b" + (regexp-quote (match-string 1 msg)))) + ;; there could be more warnings, but I'm unable to trigger them + ;; let me know any missing, with an example to trigger + (t nil))) + +(defun graphviz-dot--add-line-and-column-to-error (err) + "Populate :line / :column / :end-column for Graphviz warning ERR." + (when (eq (flycheck-error-level err) 'warning) + (when-let* ((msg (flycheck-error-message err)) + (buf (flycheck-error-buffer err)) + (regex (graphviz-dot--search-regex-from-msg msg))) + (with-current-buffer buf + (save-excursion + (goto-char (point-min)) + (re-search-forward regex nil t) + (when-let* ((beg (match-beginning 0)) + (end (match-end 0)) + (bol (progn (goto-char beg) (line-beginning-position)))) + (setf (flycheck-error-line err) (line-number-at-pos beg) + (flycheck-error-column err) (1+ (- beg bol)) + (flycheck-error-end-column err) (1+ (- end bol)))))))) + err) + +(defun graphviz-dot--dedup-errors (errors) + "Return ERRORS without duplicates (same buffer/line/column/message)." + (let ((seen (make-hash-table :test #'equal)) + out) + (dolist (err errors (nreverse out)) + (let ((key (list (flycheck-error-buffer err) + (flycheck-error-line err) + (flycheck-error-column err) + (flycheck-error-message err)))) + (unless (gethash key seen) + (puthash key t seen) + (push err out)))))) + +(with-eval-after-load 'flycheck + (eval + '(flycheck-define-checker graphviz-dot + "A Graphviz dot file syntax checker.." + :command ("dot" + "-T" "dot" ; No graphics, for speed + "-o" "/dev/null" ; No output, for speed + source-inplace) + :error-patterns + (;; line number and near message + (error line-start "Error: " (file-name) ": syntax error in line " line " " + (message) + line-end) + ;; line number and no message + (error line-start "Error: " (file-name) ": syntax error in line " + line line-end) + ;; all the rest are warnings + (warning line-start "Warning: " (message (one-or-more not-newline)) line-end)) + :error-filter + (lambda (errors) + (dolist (err errors errors) + (unless (flycheck-error-message err) + (setf (flycheck-error-message err) "syntax error")) + (graphviz-dot--add-column-to-error err) + (graphviz-dot--prettify-error-message err) + (graphviz-dot--add-line-and-column-to-error err)) + (flycheck-fill-empty-line-numbers errors) + (flycheck-sanitize-errors errors) + (graphviz-dot--dedup-errors errors)) + :modes (graphviz-dot-mode))) + + ;; And add it to flycheck's list of checkers + (add-to-list 'flycheck-checkers 'graphviz-dot)) + +(provide 'graphviz-dot-flycheck) +;;; graphviz-dot-flycheck.el ends here diff --git a/elpa/graphviz-dot-mode-20230325.1050/graphviz-dot-mode-autoloads.el b/elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-mode-autoloads.el similarity index 74% rename from elpa/graphviz-dot-mode-20230325.1050/graphviz-dot-mode-autoloads.el rename to elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-mode-autoloads.el index 8ac80165..f508b50b 100644 --- a/elpa/graphviz-dot-mode-20230325.1050/graphviz-dot-mode-autoloads.el +++ b/elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-mode-autoloads.el @@ -1,19 +1,25 @@ -;;; graphviz-dot-mode-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- -;; +;;; graphviz-dot-mode-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + ;;; Code: -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + + + +;;; Generated autoloads from graphviz-dot-flycheck.el + +(register-definition-prefixes "graphviz-dot-flycheck" '("graphviz-dot--")) -;;;### (autoloads nil "graphviz-dot-mode" "graphviz-dot-mode.el" -;;;;;; (0 0 0 0)) ;;; Generated autoloads from graphviz-dot-mode.el (autoload 'graphviz-dot-mode "graphviz-dot-mode" "\ Major mode for the dot language. -Functionallity specific to this mode: +Functionality specific to this mode: `indent-for-tab-command' \\[indent-for-tab-command] Indents a single line. @@ -37,40 +43,34 @@ Variables specific to this mode: `graphviz-dot-save-before-view' (default t) Automatically save current buffer berore `graphviz-dot-view'. -\(fn)" t nil) - +(fn)" t) (autoload 'graphviz-dot-preview "graphviz-dot-mode" "\ Compile the graph between BEGIN and END and preview it in an other buffer. BEGIN (resp. END) is a number defaulting to `point-min' (resp. `point-max') representing the current buffer's point where the graph definition starts -\(resp. stops). - -\(fn &optional BEGIN END)" t nil) +(resp. stops). +(fn &optional BEGIN END)" t) (autoload 'graphviz-turn-on-live-preview "graphviz-dot-mode" "\ Turn on live preview. -This will update the preview on every save." t nil) - +This will update the preview on every save." t) (autoload 'graphviz-turn-off-live-preview "graphviz-dot-mode" "\ Turn off live preview. -Saving the file will no longer also update the preview." t nil) - +Saving the file will no longer also update the preview." t) (add-to-list 'auto-mode-alist '("\\.dot\\'" . graphviz-dot-mode)) - (add-to-list 'auto-mode-alist '("\\.gv\\'" . graphviz-dot-mode)) - (register-definition-prefixes "graphviz-dot-mode" '("dot-menu" "graphviz-")) - -;;;*** -;;;### (autoloads nil nil ("graphviz-dot-mode-pkg.el") (0 0 0 0)) +;;; End of scraped data + +(provide 'graphviz-dot-mode-autoloads) -;;;*** - ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 +;; no-native-compile: t +;; coding: utf-8-emacs-unix ;; End: + ;;; graphviz-dot-mode-autoloads.el ends here diff --git a/elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-mode-pkg.el b/elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-mode-pkg.el new file mode 100644 index 00000000..efa9ca8c --- /dev/null +++ b/elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-mode-pkg.el @@ -0,0 +1,9 @@ +;; -*- no-byte-compile: t; lexical-binding: nil -*- +(define-package "graphviz-dot-mode" "20250925.1226" + "Mode for the dot-language used by graphviz (att)." + '((emacs "25.0")) + :url "https://ppareit.github.io/graphviz-dot-mode/" + :commit "516c151b845a3eb2da73eb4ee648ad99172087ac" + :revdesc "516c151b845a" + :keywords '("mode" "dot" "dot-language" "dotlanguage" "graphviz" "graphs" "att") + :maintainers '(("Pieter Pareit" . "pieter.pareit@gmail.com"))) diff --git a/elpa/graphviz-dot-mode-20230325.1050/graphviz-dot-mode.el b/elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-mode.el similarity index 84% rename from elpa/graphviz-dot-mode-20230325.1050/graphviz-dot-mode.el rename to elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-mode.el index 537ab949..5f4bd580 100644 --- a/elpa/graphviz-dot-mode-20230325.1050/graphviz-dot-mode.el +++ b/elpa/graphviz-dot-mode-20250925.1226/graphviz-dot-mode.el @@ -24,7 +24,8 @@ ;; Homepage: https://ppareit.github.io/graphviz-dot-mode/ ;; Created: 28 Oct 2002 ;; Last modified: 25 Januari 2020 -;; Version: 0.4.2 +;; Package-Version: 20250925.1226 +;; Package-Revision: 516c151b845a ;; Package-Requires: ((emacs "25.0")) ;; Keywords: mode dot dot-language dotlanguage graphviz graphs att @@ -47,108 +48,16 @@ ;; ;;; Todo: ;; -;;; History: -;; Version 0.4.2 Pieter Pareit -;; 25/01/2020: * Fix issues -;; * Improve font-locking -;; * Improve completion by implementing company mode -;; * Rewrote basic documentation -;; Version 0.4.1 Pieter Pareit -;; 28/09/2019: * Maintenance, checking documentation, fixing flycheck errors. -;; * Solve next-error for gaphviz -;; * Tag new version -;; Version 0.3.11 Olli Piepponen -;; 29/01/2016: * use define-derived-mode for the mode-definition -;; * add support for a auto-loading live preview work flow -;; Version 0.3.10 Kevin Ryde -;; 25/05/2015: * shell-quote-argument for safety -;; * use read-shell-command whenever available, don't set novaproc -;; Version 0.3.9 Titus Barik -;; 28/08/2012: * compile-command uses -ofile instead of > -;; Version 0.3.8 new home -;; 27/06/2012: * put graphviz-dot-mode into git, updated links -;; Version 0.3.7 Tim Allen -;; 09/03/2011: * fix spaces in file names when compiling -;; Version 0.3.6 maintenance -;; 19/02/2011: * .gv is the new extension (Pander) -;; * comments can start with # (Pander) -;; * highlight of new keywords (Pander) -;; Version 0.3.5 bug (or at least feature I dislike) fix -;; 11/11/2010: Eric Anderson http://www.ece.cmu.edu/~andersoe/ -;; * Preserve indentation across blank (whitespace-only) lines -;; Version 0.3.4 bug fixes -;; 24/02/2005: * fixed a bug in graphviz-dot-preview -;; Version 0.3.3 bug fixes -;; 13/02/2005: Reuben Thomas -;; * add graphviz-dot-indent-width -;; Version 0.3.2 bug fixes -;; 25/03/2004: Rubens Ramos -;; * semi-colons and brackets are added when electric -;; behaviour is disabled. -;; * electric characters do not behave electrically inside -;; comments or strings. -;; * default for electric-braces is disabled now (makes more -;; sense I guess). -;; * using read-from-minibuffer instead of read-shell-command -;; for emacs. -;; * Fixed test for easymenu, so that it works on older -;; versions of XEmacs. -;; * Fixed indentation error when trying to indent last brace -;; of an empty graph. -;; * region-active-p does not exist in emacs (21.2 at least), -;; so removed from code -;; * Added uncomment menu option -;; Version 0.3.1 bug fixes -;; 03/03/2004: * backward-word needs argument for older emacs -;; Version 0.3 added features and fixed bugs -;; 10/01/2004: fixed a bug in graphviz-dot-indent-graph -;; 08/01/2004: Rubens Ramos -;; * added customization support -;; * Now it works on XEmacs and Emacs -;; * Added support to use an external Viewer -;; * Now things do not break when dot mode is entered -;; when there is no buffer name, but the side effect is -;; that in this case, the compilation command is not -;; correct. -;; * Preview works on XEmacs and emacs. -;; * Electric indentation on newline -;; * Minor changes to indentation -;; * Added keyword completion (but could be A LOT better) -;; * There are still a couple of ugly hacks. Look for 'RR'. -;; Version 0.2 added features -;; 11/11/2002: added preview support. -;; 10/11/2002: indent a graph or subgraph at once with C-M-q. -;; 08/11/2002: relaxed rules for indentation, the may now be extra chars -;; after beginning of graph (comment's for example). -;; Version 0.1.2 bug fixes and naming issues -;; 06/11/2002: renamed dot-font-lock-defaults to dot-font-lock-keywords. -;; added some documentation to dot-colors. -;; provided a much better way to handle my max-specpdl-size -;; problem. -;; added an extra autoload cookie (hope this helps, as I don't -;; yet use autoload myself) -;; Version 0.1.1 bug fixes -;; 06/11/2002: added an missing attribute, for font-locking to work. -;; fixed the regex generating, so that it only recognizes -;; whole words -;; 05/11/2002: there can now be extra whitespace chars after an '{'. -;; 04/11/2002: Why I use max-specpdl-size is now documented, and old value -;; gets restored. -;; Version 0.1 initial release -;; 02/11/2002: implemented parser for *compilation* of a .dot file. -;; 01/11/2002: implemented compilation of an .dot file. -;; 31/10/2002: added syntax-table to the mode. -;; 30/10/2002: implemented indentation code. -;; 29/10/2002: implemented all of font-lock. -;; 28/10/2002: derived graphviz-dot-mode from fundamental-mode, started -;; implementing font-lock. - ;;; Code: - +(require 'cl-lib) (require 'compile) (require 'subr-x) (require 'thingatpt) +;; add optionally flycheck support, will not error if not installed +(eval-when-compile + (require 'flycheck nil t)) + (defconst graphviz-dot-mode-version "0.4.2" "Version of `graphviz-dot-mode.el'.") @@ -173,7 +82,7 @@ (defcustom graphviz-dot-layout-programs '("dot" "neato" "fdp" "sfdp" "twopi" "twopi" "circo") "*List of layout programs for the user to choose from." - :type 'list + :type '(repeat (string :tag "Program")) :group 'graphviz) (defcustom graphviz-dot-view-command "dotty %s" @@ -209,11 +118,6 @@ file.dot -o file.png'." :type 'boolean :group 'graphviz) -(defcustom graphviz-dot-revert-delay 300 - "*Amount of time to sleep before attempting to display the rendered image." - :type 'number - :group 'graphviz) - (defcustom graphviz-dot-attr-keywords '("graph" "digraph" "subgraph" "node" "edge" "strict" "rankdir" "size" "page" "Damping" "Epsilon" "URL" "arrowhead" "arrowsize" @@ -257,7 +161,7 @@ See URL `https://graphviz.org/docs/attr-types/arrowType/'.") "vee" "lvee" "rvee" "curve" "lcurve" "rcurve" "ocurve" "olcurve" "orcurve") "The possible values that an attribute of type `arrowType' can have. -See URL 'https://graphviz.org/doc/info/arrows.html.'") +See URL `https://graphviz.org/doc/info/arrows.html.'") (defvar graphviz-attributes-type-shape '("shape") @@ -560,7 +464,7 @@ See URL `https://graphviz.org/doc/info/colors.html'") ;; after that we take the list of symbols, ;; convert them to a list of strings, and make ;; an optimized regexp from them - (,(let ((max-specpdl-size (max max-specpdl-size 1200))) + (,(let ((max-lisp-eval-depth (max max-lisp-eval-depth 1200))) (regexp-opt graphviz-dot-color-keywords 'words)) . font-lock-string-face) (,(concat @@ -635,29 +539,80 @@ arrow, shape, style, dir, outputmode or other." (t 'value)))) (t 'other))))))) +;; dynamic node completion +(defun graphviz-dot--collect-node-ids () + "Return a de-duplicated list of node IDs in the current buffer. + +• Ignores identifiers inside comments, double-quoted strings, + square-bracket attribute lists, or immediately following an '=' or ':'. +• Filters out everything in `graphviz-dot-attr-keywords` + so language and attribute names never appear." + (save-excursion + (goto-char (point-min)) + (let (ids) + (while (re-search-forward + ;; bare identifiers or double-quoted identifiers + "\\(?:\\_<\\([A-Za-z_][A-Za-z0-9_]*\\)\\_>\\|\"\\([^\"]+\\)\"\\)" + nil t) + (let* ((match-beg (match-beginning 0)) + (match-end (match-end 0)) ; keep point progressing + (state (syntax-ppss match-beg)) + (in-string (nth 3 state)) + (in-comment (nth 4 state)) + (bracket-pos (nth 1 state)) + (in-attr-list + (and bracket-pos (eq (char-after bracket-pos) ?\[))) + ;; identifier just after '=' ? + (preceded-by-equal + (save-excursion + (goto-char match-beg) + (skip-chars-backward " \t") + (eq (char-before) ?=))) + ;; identifier just after ':' ? + (preceded-by-colon + (save-excursion + (goto-char match-beg) + (skip-chars-backward " \t") + (eq (char-before) ?:)))) + (unless (or in-string in-comment in-attr-list + preceded-by-equal preceded-by-colon) + (push (or (match-string-no-properties 1) + (match-string-no-properties 2)) + ids)) + (goto-char match-end))) + (cl-set-difference + (cl-delete-duplicates ids :test #'string= :from-end t) + graphviz-dot-attr-keywords + :test #'string=)))) + (defun graphviz-completion-at-point () - "Function to use in the hook `completion-at-point-functions'." + "Offer context-aware completion for Graphviz. +Adds dynamic node/subgraph names alongside the static keyword tables." (let* ((bounds (bounds-of-thing-at-point 'symbol)) - (start (if bounds (car bounds) (point))) - (end (if bounds (cdr bounds) (point))) - (collection - (cl-case (graphviz-dot--syntax-at-point) - (compasspoint graphviz-values-type-portpos) - (color graphviz-dot-color-keywords) - (arrow graphviz-values-type-arrow) - (shape graphviz-values-type-shape) - (style graphviz-values-type-style) - (dir graphviz-values-type-dir) - (outputmode graphviz-values-type-outputmode) - (packmode graphviz-values-type-packmode) - (pagedir graphviz-values-type-pagedir) - (portpos graphviz-values-type-portpos) - (splines graphviz-attributes-splines-values) - (bool graphviz-values-type-bool) - (value graphviz-dot-value-keywords) - ((comment string) nil) - (t graphviz-dot-attr-keywords)))) - (list start end collection . nil))) + (start (if bounds (car bounds) (point))) + (end (if bounds (cdr bounds) (point))) + (context (graphviz-dot--syntax-at-point)) + (collection + (cl-case context + (compasspoint graphviz-values-type-portpos) + (color graphviz-dot-color-keywords) + (arrow graphviz-values-type-arrow) + (shape graphviz-values-type-shape) + (style graphviz-values-type-style) + (dir graphviz-values-type-dir) + (outputmode graphviz-values-type-outputmode) + (packmode graphviz-values-type-packmode) + (pagedir graphviz-values-type-pagedir) + (portpos graphviz-values-type-portpos) + (splines graphviz-attributes-splines-values) + (bool graphviz-values-type-bool) + (value graphviz-dot-value-keywords) + ((comment string) nil) ; nothing in strings/comments + (t (append (graphviz-dot--collect-node-ids) ; in all other places + graphviz-dot-attr-keywords))))) + (when collection + (list start end collection :exclusive 'no)))) + (defvar dot-menu nil "Menu for Graphviz Dot Mode. @@ -668,7 +623,7 @@ package.") (define-derived-mode graphviz-dot-mode prog-mode "dot" "Major mode for the dot language. -Functionallity specific to this mode: +Functionality specific to this mode: `indent-for-tab-command' \\[indent-for-tab-command] Indents a single line. @@ -711,7 +666,19 @@ Variables specific to this mode: 'local) (run-hooks 'graphviz-dot-mode-hook)) + +;;;; +;;;; Syntax Checking with flycheck +;;;; + + +;; only require the graphviz-dot-flycheck support if flycheck was loaded +(with-eval-after-load 'flycheck + (require 'graphviz-dot-flycheck)) + +;;;; ;;;; Menu definitions +;;;; (and (condition-case nil (require 'easymenu) @@ -881,6 +848,8 @@ representing the current buffer's point where the graph definition starts ,(format "-T%s" graphviz-dot-preview-extension)) :buffer stdout :stderr stderr + :connection-type 'pipe + :coding 'binary :sentinel (lambda (_ event) (cond @@ -930,14 +899,9 @@ This creates an external process every time it is executed. If saved before the command is executed." (interactive) (let ((cmd (if graphviz-dot-view-edit-command - (if (fboundp 'read-shell-command) (read-shell-command "View command: " (format graphviz-dot-view-command (shell-quote-argument (buffer-file-name)))) - ;; read-shell-command not available in GNU Emacs 21 - (read-from-minibuffer "View command: " - (format graphviz-dot-view-command - (shell-quote-argument (buffer-file-name))))) (format graphviz-dot-view-command (shell-quote-argument (buffer-file-name)))))) (if graphviz-dot-save-before-view -- 2.47.3