[elpa] externals-release/org 806abc5a2b: Update version number for the 9.6.9 release
branch: externals-release/org commit 806abc5a2bbcb5f884467a0145547221ba09eb59 Author: Ihor Radchenko Commit: Ihor Radchenko Update version number for the 9.6.9 release --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 750c8f9720..f97b9b6c75 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9,7 +9,7 @@ ;; URL: https://orgmode.org ;; Package-Requires: ((emacs "26.1")) -;; Version: 9.6.8 +;; Version: 9.6.9 ;; This file is part of GNU Emacs. ;;
[elpa] externals/org 234650af2e: org-make-tags-matcher: Re-add quoting of property names
branch: externals/org commit 234650af2efd3db70e36f7d91ad835c6de75c51a Author: Jens Schmidt Commit: Ihor Radchenko org-make-tags-matcher: Re-add quoting of property names * lisp/org.el (org-make-tags-matcher): * testing/lisp/test-org.el (test-org/map-entries): Move special cased handling of LEVEL properties. Add tests for other special cased properties TODO and CATEGORY. * lisp/org.el (org-make-tags-matcher): * doc/org-manual.org (Matching tags and properties): * testing/lisp/test-org.el (test-org/map-entries): Re-add and extend quoting of property names in search strings. Link: https://orgmode.org/list/87h6oq2nu1@gmail.com --- doc/org-manual.org | 22 +-- lisp/org.el | 55 +--- testing/lisp/test-org.el | 34 +- 3 files changed, 68 insertions(+), 43 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 17b25fef4f..2496485662 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -9320,21 +9320,21 @@ With the regular =<= operator, the search would handle entries without an =EFFORT= property as having a zero effort and would include them in the result as well. -Currently, you can use only property names including alphanumeric -characters, underscores, and minus characters in search strings. In -addition, if you want to search for a property whose name starts with -a minus character, you have to "quote" that leading minus character -with an explicit positive selection plus character, like this: +You can use all characters valid in property names when matching +properties. However, you have to quote some characters in property +names with backslashes when using them in search strings, namely all +characters different from alphanumerics and underscores[fn:: If you +quote alphanumeric characters or underscores with a backslash, that +backslash is ignored.]. For example, to search for all entries having +a property =boss-prio=, =boss:prio=, or =boss\prio=, respectively, +with value =C=, use search strings #+begin_example -+-long-and-twisted-property-name-="foo" +boss\-prio="C" +boss\:prio="C" +boss\\prio="C" #+end_example -#+texinfo: @noindent -Without that extra plus character, the minus character would be taken -to indicate a negative selection on search term -=long-and-twisted-property-name-="foo"=. - You can configure Org mode to use property inheritance during a search, but beware that this can slow down searches considerably. See [[*Property Inheritance]], for details. diff --git a/lisp/org.el b/lisp/org.el index 50df1b2d96..78f8eb2e9f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11328,15 +11328,14 @@ See also `org-scan-tags'." "\\(?2:" ;; tag regexp match "{[^}]+}\\|" - ;; LEVEL property match. For sake of consistency, - ;; recognize starred operators here as well. We do - ;; not need to process them below, however, since - ;; the LEVEL property is always present. - "LEVEL\\(?3:" opre "\\)\\*?\\(?4:[0-9]+\\)\\|" - ;; regular property match + ;; property match. Try to keep this subre generic + ;; and rather handle special properties like LEVEL + ;; and CATEGORY further below. This ensures that + ;; the same quoting mechanics can be used for all + ;; property names. "\\(?:" ;; property name [1] - "\\(?5:[[:alnum:]_-]+\\)" + "\\(?5:\\(?:[[:alnum:]_]+\\|[^[:space:]]\\)+\\)" ;; operator, optionally starred "\\(?6:" opre "\\)\\(?7:\\*\\)?" ;; operand (regexp, double-quoted string, @@ -11353,13 +11352,19 @@ See also `org-scan-tags'." (start 0) tagsmatch todomatch tagsmatcher todomatcher) -;; [1] The minus characters in property names do *not* conflict -;; with the exclusion operator above, since the mandatory -;; following operator distinguishes these both cases. -;; Accordingly, minus characters do not need any special quoting, -;; even if https://orgmode.org/list/87jzv67k3p.fsf@localhost and -;; commit 19b0e03f32c6032a60150fc6cb07c6f766cb3f6c suggest -;; otherwise. +;; [1] The history of this particular subre: +;; - \\([[:alnum:]_]+\\) [pre-19b0e03] +;; Does not allow for minus characters in property names. +;; - "\\(\\(?:[[:alnum:]_]+\\(?:-\\)*\\)+\\)" [19b0e03] +;; Incomplete fix of above issue, still resulting in, e.g., +;; https://orgmode.org/list/87jzv67k3p.fsf@localhost. +;; - "\\(?5:[[:alnum:]_-]+\\)" [f689eb4] +;; Allows for unquoted minus characters in property names, but +;; conflicts with searches l
[nongnu] elpa/eat b4595662d4: * eat.el (eat-project-other-window): New command
branch: elpa/eat commit b4595662d4739b6f014d6ee9a9edea9f63e24389 Author: Akib Azmain Turja Commit: Akib Azmain Turja * eat.el (eat-project-other-window): New command --- eat.el | 18 ++ 1 file changed, 18 insertions(+) diff --git a/eat.el b/eat.el index 07a747d5aa..fae03b27e4 100644 --- a/eat.el +++ b/eat.el @@ -6991,6 +6991,24 @@ that number, or create it if it doesn't already exist." (eat-buffer-name (project-prefixed-buffer-name "eat"))) (eat nil arg))) +;;;###autoload +(defun eat-project-other-window (&optional arg) + "Start Eat in the current project root directory in another window. + +Start a new Eat session, or switch to an already active session. +Return the buffer selected (or created). + +With a non-numeric prefix ARG, create a new session. + +With a numeric prefix ARG (like +\\[universal-argument] 42 \\[eat-project]), switch to the session with +that number, or create it if it doesn't already exist." + (interactive "P") + (require 'project) + (let* ((default-directory (project-root (project-current t))) + (eat-buffer-name (project-prefixed-buffer-name "eat"))) +(eat-other-window nil arg))) + Tracing.
[nongnu] elpa/org-contrib updated (dce101b461 -> dc59cdd46b)
elpasync pushed a change to branch elpa/org-contrib. from dce101b461 * lisp/org-contrib.el: Bump version to 0.4.2 new 68889695b5 * lisp/ob-mathomatic.el (org-babel-mathomatic-command): Add missing :type new dc59cdd46b org-babel-execute:mathomatic: Drop ((lambda ...) ...) call Summary of changes: lisp/ob-mathomatic.el | 24 1 file changed, 12 insertions(+), 12 deletions(-)
[nongnu] elpa/org-contrib 68889695b5 1/2: * lisp/ob-mathomatic.el (org-babel-mathomatic-command): Add missing :type
branch: elpa/org-contrib commit 68889695b52de7d99c4415f97c6a044de5679868 Author: Ihor Radchenko Commit: Ihor Radchenko * lisp/ob-mathomatic.el (org-babel-mathomatic-command): Add missing :type --- lisp/ob-mathomatic.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ob-mathomatic.el b/lisp/ob-mathomatic.el index beb52856f7..48a15a17fb 100644 --- a/lisp/ob-mathomatic.el +++ b/lisp/ob-mathomatic.el @@ -45,7 +45,8 @@ (defcustom org-babel-mathomatic-command (if (boundp 'mathomatic-command) mathomatic-command "mathomatic") "Command used to call mathomatic on the shell." - :group 'org-babel) + :group 'org-babel + :type 'string) (defun org-babel-mathomatic-expand (body params) "Expand a block of Mathomatic code according to its header arguments."
[nongnu] elpa/org-contrib dc59cdd46b 2/2: org-babel-execute:mathomatic: Drop ((lambda ...) ...) call
branch: elpa/org-contrib commit dc59cdd46be8f6854c5d6e9252263d0e4e62e896 Author: Ihor Radchenko Commit: Ihor Radchenko org-babel-execute:mathomatic: Drop ((lambda ...) ...) call * lisp/ob-mathomatic.el (org-babel-execute:mathomatic): Do not use deprecated lambda call syntax. --- lisp/ob-mathomatic.el | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lisp/ob-mathomatic.el b/lisp/ob-mathomatic.el index 48a15a17fb..744563497c 100644 --- a/lisp/ob-mathomatic.el +++ b/lisp/ob-mathomatic.el @@ -94,17 +94,16 @@ called by `org-babel-execute-src-block'." org-babel-mathomatic-command in-file cmdline))) (with-temp-file in-file (insert (org-babel-mathomatic-expand body params))) (message cmd) - ((lambda (raw) ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' " - (mapconcat - #'identity - (delq nil -(mapcar (lambda (line) - (unless (or (string-match "batch" line) - (string-match "^rat: replaced .*$" line) - (= 0 (length line))) -line)) -(split-string raw "[\r\n]"))) "\n")) - (org-babel-eval cmd "") + ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' " + (mapconcat + #'identity + (delq nil + (mapcar (lambda (line) + (unless (or (string-match "batch" line) + (string-match "^rat: replaced .*$" line) + (= 0 (length line))) + line)) + (split-string (org-babel-eval cmd "") "[\r\n]"))) "\n" (if (org-babel-mathomatic-graphical-output-file params) nil (if (or (member "scalar" result-params)
[nongnu] main e06ce547e3 2/2: * elpa-packages (adoc-mode): New package
branch: main commit e06ce547e379ebf708a181b455e61e77bc5143e8 Author: Philip Kaludercic Commit: Philip Kaludercic * elpa-packages (adoc-mode): New package --- elpa-packages | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elpa-packages b/elpa-packages index df894c2c92..b57fcd061f 100644 --- a/elpa-packages +++ b/elpa-packages @@ -11,6 +11,8 @@ ;; that can be used in PLIST. ( + (adoc-mode :url "https://github.com/bbatsov/adoc-mode";) + (afternoon-theme :url "https://github.com/osener/emacs-afternoon-theme"; :ignored-files ("*.png"))
[nongnu] main updated (aba50eda61 -> e06ce547e3)
zge pushed a change to branch main. from aba50eda61 * elpa-packages (mastodon): Don't track `develop` for fear of force-pushes new 8a17d68cac * elpa-packages (hyperdrive): New package new e06ce547e3 * elpa-packages (adoc-mode): New package Summary of changes: elpa-packages | 6 ++ 1 file changed, 6 insertions(+)
[nongnu] main 8a17d68cac 1/2: * elpa-packages (hyperdrive): New package
branch: main commit 8a17d68cac704a8e1bf2ddca88281dfc49da0bca Author: Joseph Turner Commit: Philip Kaludercic * elpa-packages (hyperdrive): New package --- elpa-packages | 4 1 file changed, 4 insertions(+) diff --git a/elpa-packages b/elpa-packages index 0d9da00c84..df894c2c92 100644 --- a/elpa-packages +++ b/elpa-packages @@ -344,6 +344,10 @@ :ignored-files ("htmlize.el.html") :release-branch "stable") + (hyperdrive :url "https://git.sr.ht/~ushin/hyperdrive.el"; + :readme "README.md" + :doc "doc/hyperdrive-manual.org") + (idle-highlight-mode :url "https://codeberg.org/ideasman42/emacs-idle-highlight-mode"; :ignored-files (".elisp-autofmt"))
[nongnu] elpa/adoc-mode f4bbbea2ff 003/199: replaced adoc's own faces with markup-faces library
branch: elpa/adoc-mode commit f4bbbea2fff128044953bc3a34a7f230d6131b98 Author: Florian Kaufmann Commit: Florian Kaufmann replaced adoc's own faces with markup-faces library --- adoc-mode.el | 315 +++ 1 file changed, 77 insertions(+), 238 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 689ac77553..5f2d62bd04 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -108,6 +108,8 @@ ;; ;;; Variables: +(require 'markup-faces) + (defconst adoc-mode-version "0.4.0" "Based upon AsciiDoc version 8.5.2. I.e. regexeps and rules are taken from that version's asciidoc.conf/manual.") @@ -116,16 +118,6 @@ that version's asciidoc.conf/manual.") "Support for AsciiDoc documents." :group 'wp) -(defgroup adoc-faces nil - "Faces used in adoc mode. - -Note that what is really used to highlight is the content of the -corresponding variables. E.g. for titles not really the face -adoc-title-0 is used, but the content of the variable -adoc-title-0." - :group 'adoc - :group 'faces ) - (defcustom adoc-script-raise '(-0.3 0.3) "How much to lower and raise subscript and superscript content. @@ -195,227 +187,74 @@ configuration file." "Default title sub type, see `adoc-title-descriptor'." :group 'adoc ) -(defface adoc-orig-default - '((t (:inherit (default - "The default face before buffer-face-mode was in effect. - -This face is only a kludge. If I understood the face-remap -library better, it probably woudn't be needed." - :group 'adoc-faces) - -(defface adoc-generic - 'background light)) - (:foreground "blue")) -(((background dark)) - (:foreground "skyblue"))) - "For things that don't have their dedicated face. - -Many important AsciiDoc constructs have their dedicated face in -adoc-mode like e.g. adoc-title-0, adoc-strong etc. - -For all other, less often used constructs, where it wasn't deemed -necessary to create an own dedicated face, adoc-generic is used. -E.g. #...#, the label text of a labeled list item, block titles. - -Beside that it servers as a base face from which other adoc -faces, at least their default value, inherit." - :group 'adoc-faces) - -(defface adoc-title-0 - '((t (:inherit adoc-generic :weight bold :height 2.0))) - "" - :group 'adoc-faces) - -(defface adoc-title-1 - '((t (:inherit adoc-generic :weight bold :height 1.8))) - "" - :group 'adoc-faces) - -(defface adoc-title-2 - '((t (:inherit adoc-generic :weight bold :height 1.4))) - "" - :group 'adoc-faces) - -(defface adoc-title-3 - '((t (:inherit adoc-generic :slant italic :weight bold))) - "" - :group 'adoc-faces) - -(defface adoc-title-4 - '((t (:inherit adoc-generic :slant italic :weight bold))) - "" - :group 'adoc-faces) - -(defface adoc-monospace - '((t (:inherit (fixed-pitch adoc-generic - "For monospace, literal or pass through text" - :group 'adoc-faces) - -(defface adoc-strong - '((t (:inherit (adoc-generic bold - "" - :group 'adoc-faces) - -(defface adoc-emphasis - '((t (:inherit (adoc-generic italic - "" - :group 'adoc-faces) - -(defface adoc-superscript - '((t (:inherit adoc-generic :height 0.8))) - "How much to raise it is defined by adoc-script-raise. - -Note that the example here in the customization buffer is not -correctly highlighted the raising by adoc-script-raise part is -missing." - :group 'adoc-faces) - -(defface adoc-subscript - '((t (:inherit adoc-generic :height 0.8))) - "How much to lower it is defined by adoc-script-raise. - -Note that the example here in the customization buffer is not -correctly highlighted, the lowering by adoc-script-raise part is -missing." - :group 'adoc-faces) - -(defface adoc-secondary-text - '((t (:height 0.8))) - "Text that is not part of the running text in the output. - -E.g. captions or footnotes." - :group 'adoc-faces) - -(defface adoc-replacement - '((default (:inherit adoc-orig-default)) -(((background light)) - (:foreground "purple1")) -(((background dark)) - (:foreground "plum1"))) - "For things that will be replaced by something simple/similar. - -A text phrase that is replaced by another phrase. - -E.g. AsciiDoc replacements ('(C)' for the copy right sign), -entity references ('¶' for a carriage return sign), -single/double quoted text (that is, the quotes in `...' , ``...'' -are replaced by actual single/double quotation marks.)" - :group 'adoc-faces) - -(defface adoc-complex-replacement - '((default (:inherit adoc-orig-default)) -(((background light)) - (:background "plum1" :foreground "purple3" :box (:line-width 2 :color "plum1" :style released-button))) -(((background dark)) - (:background "purple3" :foreground "plum1" :box (:line-width 2 :color "purple3" :style released-button - "For things that will be replaced by something complex (e.g an image). - -E.g. adominition paragraphs ('WARNING: '), images ('image::images/tiger.png'), rulers, ..." - :group 'adoc-faces) - -(deffac
[nongnu] elpa/adoc-mode 46c99fbd51 006/199: bugfix in font lock regexp for comments
branch: elpa/adoc-mode commit 46c99fbd511e4adaf37dfc0678b2900bd1c4061f Author: Florian Kaufmann Commit: Florian Kaufmann bugfix in font lock regexp for comments --- adoc-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index cdd49fe447..869e5e0ccc 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -999,7 +999,7 @@ When LITERAL-P is non-nil, the contained text is literal text." '(1 '(face adoc-delimiter adoc-reserved t))) ;; comment ;; ^//(?P[^/].*|)$=#comment[normal] - (list "^\\(//.*\n\\)" + (list "^\\(//\\(?:[^/].*\\|\\)\n\\)" '(1 '(face adoc-comment adoc-reserved t))) ;; image (list "^\\(\\(image::\\)\\([^ \t\n]*?\\)\\(\\[.*?\\]\\)\\)[ \t]*$"
[nongnu] elpa/adoc-mode 2a088d1e83 020/199: added meta-face-cleanup, initial version
branch: elpa/adoc-mode commit 2a088d1e834ac8ac81825039de47d00f6d161f17 Author: Florian Kaufmann Commit: Florian Kaufmann added meta-face-cleanup, initial version --- adoc-mode-test.el | 17 + adoc-mode.el | 26 ++ 2 files changed, 43 insertions(+) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index a4ba94d4ae..79e2f3a5d6 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -168,4 +168,21 @@ "+" markup-meta-face "\n" nil "2nd list paragraph\n" nil )) +(ert-deftest adoctest-test-meta-face-cleanup () + ;; begin with a few simple explicit cases which are easier to debug in case of troubles + (adoctest-faces +"*" markup-meta-hide-face "lorem " markup-strong-face +"_" markup-meta-hide-face "ipsum" '(markup-strong-face markup-emphasis-face) "_" markup-meta-hide-face +" dolor" markup-strong-face "*" markup-meta-hide-face "\n" nil) + (adoctest-faces +"_" markup-meta-hide-face "lorem " markup-emphasis-face +"*" markup-meta-hide-face "ipsum" '(markup-strong-face markup-emphasis-face) "*" markup-meta-hide-face +" dolor" markup-emphasis-face "_" markup-meta-hide-face "\n" nil) + + ;; now test all possible cases + ;; mmm, that is all possible cases inbetween constrained/unconstrained quotes + + ;; todo + ) + (ert-run-tests-interactively "^adoctest-test-") diff --git a/adoc-mode.el b/adoc-mode.el index 3262668f84..c80e75e96b 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -957,6 +957,29 @@ When LITERAL-P is non-nil, the contained text is literal text." 'adoc-flf-first-whites-fixed-width '(1 adoc-align t))) +;; ensures that faces from the markup-text group don't overwrite faces from the +;; markup-meta group +(defun adoc-flf-meta-face-cleanup (end) + (while (< (point) end) +(let* ((next-pos (next-single-property-change (point) 'face nil end)) + (faces-raw (get-text-property (point) 'face)) + (faces (if (listp faces-raw) faces-raw (list faces-raw))) + newfaces + meta-p) + (while faces + (if (member (car faces) '(markup-meta-hide-face markup-command-face markup-attribute-face markup-value-face markup-complex-replacement-face markup-list-face markup-table-face markup-table-row-face markup-table-cell-face markup-anchor-face markup-internal-reference-face markup-comment-face markup-preprocessor-face)) + (progn + (setq meta-p t) + (setq newfaces (cons (car faces) newfaces))) + (if (not (string-match "markup-" (symbol-name (car faces + (setq newfaces (cons (car faces) newfaces + (setq faces (cdr faces))) + (if meta-p + (put-text-property (point) next-pos 'face +(if (= 1 (length newfaces)) (car newfaces) newfaces))) + (goto-char next-pos))) + nil) + (defun adoc-unfontify-region-function (beg end) ;; (font-lock-default-unfontify-region beg end) @@ -1462,6 +1485,9 @@ When LITERAL-P is non-nil, the contained text is literal text." ;; wanted to add a normal paragraph. List paragraphs are appended ;; implicitely. (list "^\\(\\+[ \t]*\\)\n\\([ \t]+\\)[^ \t\n]" '(1 adoc-warning t) '(2 adoc-warning t)) + + ;; cleanup + (list 'adoc-flf-meta-face-cleanup) )) (defun adoc-show-version ()
[nongnu] elpa/adoc-mode 7a87ac9e5c 007/199: added customization var for delimited block regexps, added tests
branch: elpa/adoc-mode commit 7a87ac9e5c9b584fd5e2b7dce0280ec0aff45d21 Author: Florian Kaufmann Commit: Florian Kaufmann added customization var for delimited block regexps, added tests refactored functions generating font lock keywords for delimited blocks --- adoc-mode-test.el | 35 adoc-mode.el | 166 -- 2 files changed, 158 insertions(+), 43 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 3d3ddf59e9..f6e28688d5 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -21,6 +21,8 @@ ;; Lock Support Mode must be set to nil ;; ! + ;; todo: test for presence of adoc-reserved (we do white-box testing here) + ;; the white after = really is part of the delimiter (adoctest-make-buffer @@ -63,6 +65,39 @@ "chapter 4" markup-title-4-face "\n" nil "+" markup-meta-hide-face "\n" nil "\n" nil + + "" markup-meta-hide-face "\n" nil + "comment line 1\ncomment line 2" markup-comment-face "\n" nil + "" markup-meta-hide-face "\n" nil + "\n" nil + "" markup-meta-hide-face "\n" nil + "passthrouh line 1\npassthrouh line 2" markup-passthrough-face "\n" nil + "" markup-meta-hide-face "\n" nil + "\n" nil + "" markup-meta-hide-face "\n" nil + "listing line 1\nlisting line 2" markup-code-face "\n" nil + "" markup-meta-hide-face "\n" nil + "\n" nil + "" markup-meta-hide-face "\n" nil + "literal line 1\nliteral line 2" markup-verbatim-face "\n" nil + "" markup-meta-hide-face "\n" nil + "\n" nil + "" markup-meta-hide-face "\n" nil + "quote line 1\nquote line 2" nil "\n" nil + "" markup-meta-hide-face "\n" nil + "\n" nil + "" markup-meta-hide-face "\n" nil + "example line 1\nexample line 2" nil "\n" nil + "" markup-meta-hide-face "\n" nil + "\n" nil + "" markup-meta-hide-face "\n" nil + "sidebar line 1\nsidebar line 2" markup-secondary-text-face "\n" nil + "" markup-meta-hide-face "\n" nil + "\n" nil + "--" markup-meta-hide-face "\n" nil + "open block line 1\nopen block line 2" nil "\n" nil + "--" markup-meta-hide-face "\n" nil + "\n" nil ) (goto-char (point-min)) diff --git a/adoc-mode.el b/adoc-mode.el index 869e5e0ccc..07ba7096a5 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -177,6 +177,58 @@ configuration file." (string :tag "level 4") ) :group 'adoc) +(defcustom adoc-delimited-block-del + '("^/\\{4,\\}"; 0 comment +"^\\+\\{4,\\}" ; 1 pass +"^-\\{4,\\}"; 2 listing +"^\\.\\{4,\\}" ; 3 literal +"^_\\{4,\\}"; 4 quote +"^=\\{4,\\}"; 5 example +"^\\*\\{4,\\}" ; 6 sidebar +"^--") ; 7 open block + "WITHOUT $!" + :type '(list + (choice :tag "comment" + (regexp :tag "start/end regexp") + (list :tag "separate regexp" + (regexp :tag "start regexp") + (regexp :tag "end regexp"))) + (choice :tag "pass" + (regexp :tag "start/end regexp") + (list :tag "separate regexp" + (regexp :tag "start regexp") + (regexp :tag "end regexp"))) + (choice :tag "listing" + (regexp :tag "start/end regexp") + (list :tag "separate regexp" + (regexp :tag "start regexp") + (regexp :tag "end regexp"))) + (choice :tag "literal" + (regexp :tag "start/end regexp") + (list :tag "separate regexp" + (regexp :tag "start regexp") + (regexp :tag "end regexp"))) + (choice :tag "quote" + (regexp :tag "start/end regexp") + (list :tag "separate regexp" + (regexp :tag "start regexp") + (regexp :tag "end regexp"))) + (choice :tag "example" + (regexp :tag "start/end regexp") + (list :tag "separate regexp" + (regexp :tag "start regexp") + (regexp :tag "end regexp"))) + (choice :tag "sidebar" + (regexp :tag "start/end regexp") + (list :tag "separate regexp" + (regexp :tag "start regexp") + (regexp :tag "end regexp"))) + (choice :tag "open" + (regexp :tag "start/end regexp") + (list :tag "separate regexp" + (regexp :tag "start regexp") + (regexp :tag "end regexp") + ;; todo: limit value range to 1 or 2 (defcustom adoc-default-title-type 1 "Default title type, see `adoc-title-descriptor'." @@ -458,15 +510,23 @@ Subgroups: "^\\(\\)\\(.*[^ \t\n]\\)\\(:-\\)\\(\\)$")
[nongnu] elpa/adoc-mode b0d75800d0 012/199: edited comment
branch: elpa/adoc-mode commit b0d75800d0e196f52a6b1aa66022744920aeed9b Author: Florian Kaufmann Commit: Florian Kaufmann edited comment --- adoc-mode.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index 53f77eabe9..15d18bf238 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1288,7 +1288,8 @@ When LITERAL-P is non-nil, the contained text is literal text." ;; special characters ;; -- - ;; no highlighting for them + ;; no highlighting for them, since they are a property of the backend markup, + ;; not of AsciiDoc syntax ;; quotes: unconstrained and constrained
[nongnu] elpa/adoc-mode 113eba1bfe 008/199: changed/added docstring
branch: elpa/adoc-mode commit 113eba1bfe5d51a8ff420cb4500b26470187869e Author: Florian Kaufmann Commit: Florian Kaufmann changed/added docstring --- adoc-mode.el | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index 07ba7096a5..6193a843e2 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -186,7 +186,22 @@ configuration file." "^=\\{4,\\}"; 5 example "^\\*\\{4,\\}" ; 6 sidebar "^--") ; 7 open block - "WITHOUT $!" + "Regexp used for delimited blocks. + +WARNING: They should not contain a $. It is implied that they +match up to end of the line; + +They correspond to delimiter variable blockdef-xxx sections in +the AsciiDoc configuration file. + +However contrary to the AsciiDoc configuration file a separate +regexp can be given for the start line and for the end line. You +may want to do that because adoc-mode often can't properly +distinguish between a) a two line tile b) start of a delimited +block and c) end of a delimited block. If you start a listing +delimited block with '>' and end it with '<', then all +three cases can easily be distinguished. The regexp in your +AsciiDoc config file would the probably be '^[<>]-{4,}$'" :type '(list (choice :tag "comment" (regexp :tag "start/end regexp")
[nongnu] elpa/adoc-mode 6cb365085b 018/199: removed/abandoned lexxer stuff
branch: elpa/adoc-mode commit 6cb365085bac6cad9a4b541fb4c45917bf64fe27 Author: Florian Kaufmann Commit: Florian Kaufmann removed/abandoned lexxer stuff --- adoc-mode.el | 75 1 file changed, 75 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index e1901e09d8..3262668f84 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -760,79 +760,6 @@ value." (when (not (= 0 (car adoc-script-raise))) `(display (raise ,(cadr adoc-script-raise))) -;; adoc-lexxer will set these faces when it finds a match. The numbers are the -;; regexp group numbers of the match. -(defvar adoc-lex-face-1 adoc-align) -(defvar adoc-lex-face-2 adoc-align) -(defvar adoc-lex-face-3 adoc-align) -(defvar adoc-lex-face-4 adoc-align) -(defvar adoc-lex-face-5 adoc-align) -(defvar adoc-lex-face-6 adoc-align) - -(defvar adoc-lexems `( - ;; the order of lexems is given by AsciiDoc, see source code Lex.next - ;; - ;; attribute entry - ;; attribute list - ;; title - ;; single line - ,(list (adoc-re-one-line-title 0) adoc-hide-delimiter markup-title-0-face adoc-hide-delimiter) - ,(list (adoc-re-one-line-title 1) adoc-hide-delimiter markup-title-1-face adoc-hide-delimiter) - ,(list (adoc-re-one-line-title 2) adoc-hide-delimiter markup-title-2-face adoc-hide-delimiter) - ,(list (adoc-re-one-line-title 3) adoc-hide-delimiter markup-title-3-face adoc-hide-delimiter) - ,(list (adoc-re-one-line-title 4) adoc-hide-delimiter markup-title-4-face adoc-hide-delimiter) - ;; double line - ,(list (adoc-re-two-line-title (nth 0 adoc-two-line-title-del)) markup-title-0-face adoc-hide-delimiter) - ,(list (adoc-re-two-line-title (nth 1 adoc-two-line-title-del)) markup-title-1-face adoc-hide-delimiter) - ,(list (adoc-re-two-line-title (nth 2 adoc-two-line-title-del)) markup-title-2-face adoc-hide-delimiter) - ,(list (adoc-re-two-line-title (nth 3 adoc-two-line-title-del)) markup-title-3-face adoc-hide-delimiter) - ,(list (adoc-re-two-line-title (nth 4 adoc-two-line-title-del)) markup-title-4-face adoc-hide-delimiter) - ;; macros - ;; lists - ;; blocks - ,(list (adoc-re-delimited-block 0) adoc-delimiter adoc-hide-delimiter adoc-comment adoc-delimiter adoc-hide-delimiter) ; comment - ,(list (adoc-re-delimited-block 1) adoc-delimiter adoc-hide-delimiter adoc-monospace adoc-delimiter adoc-hide-delimiter) ; pass through - ,(list (adoc-re-delimited-block 2) adoc-delimiter adoc-hide-delimiter adoc-monospace adoc-delimiter adoc-hide-delimiter) ; listing - ,(list (adoc-re-delimited-block 3) adoc-delimiter adoc-hide-delimiter adoc-monospace adoc-delimiter adoc-hide-delimiter) ; literal - ,(list (adoc-re-delimited-block 6) adoc-delimiter adoc-hide-delimiter adoc-secondary-text adoc-delimiter adoc-hide-delimiter) ; sidebar - ,(list (adoc-re-delimited-block 4) adoc-delimiter adoc-hide-delimiter adoc-generic adoc-delimiter adoc-hide-delimiter) ; quote - ,(list (adoc-re-delimited-block 5) adoc-delimiter adoc-hide-delimiter adoc-monospace adoc-delimiter adoc-hide-delimiter) ; example - ((nth 7 adoc-delimited-block-del) adoc-delimiter) ; open block - ;; tables OLD - ;; tables - ;; block title - (list "^\\(\\.\\)\\(\\.?[^. \t\n].*\\)$" adoc-delimiter adoc-generic) - ;; paragraph - )) - -;; Todo: -;; - 'compile' adoc-lexems. So the concat "\\=" below and the evals doesn't have -;; to be done all the time. -;; -;; - instead of setting a face variable, do it more general -;; (1 '(face face-1 prop-11 prop-val11 prop-12 prop-val12) override-1 laxmatch-1) -;; (2 '(face face-2 prop-21 prop-val21 prop-22 prop-val22) override-2 laxmatch-2) -;; ... -(defun adoc-lexxer (end) - (let* (item - found) -(while (and (< (point) end) (not found)) - (setq item adoc-lexems) - (while (and item (not found)) -(setq found (re-search-forward (concat "\\=" (nth 0 (car item))) end t)) -(when found - (setq adoc-lex-face-1 (eval (nth 1 (car item - (setq adoc-lex-face-2 (eval (nth 2 (car item - (setq adoc-lex-face-3 (eval (nth 3 (car item - (setq adoc-lex-face-4 (eval (nth 4 (car item - (setq adoc-lex-face-5 (eval (nth 5 (car item - (setq adoc-lex-face-6 (eval (nth 6 (car item - ) -(setq item (cdr item))) - (when (not found) -(forward-line 1))) -found)) - ;; todo: use & learn some more macro magic so adoc-kw-unconstrained-quote and ;; adoc-kw-constrained-quote are less redundant and have common parts in one ;; macro. E.g. at least such 'lists' @@ -1059,8 +986,6 @@ When LITERAL-P is non-nil, the contained text is literal text." (defun adoc-get-font-lock-keywords () (list - ;; (list 'adoc-lexxer '(1 adoc-lex-face-1 t t) '(2 adoc-lex-face-2 t t) '(3 adoc-lex-face-3 t t) '(4 adoc-lex-face-4 t t) '(5 adoc-lex-face-5 t t) '(6 adoc-lex-face-6 t t)) - ;; Asciidoc BUG:
[nongnu] elpa/adoc-mode 9c395f4bf9 093/199: it's now less likely that text between two adjacent delimited blocks is misinterpreted as delimited block
branch: elpa/adoc-mode commit 9c395f4bf91b82966bff3a4ce1540e5164bc66df Author: sensorflo Commit: sensorflo it's now less likely that text between two adjacent delimited blocks is misinterpreted as delimited block But sadly that also introduces a bug: contrary to the specification in the AsciiDoc manual, adoc-mode does not allow that either the first line or the last line of a delimited block is blank. --- adoc-mode-test.el | 41 + adoc-mode.el | 25 ++--- 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 68ca1efaa4..4e93454f9b 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -191,6 +191,47 @@ removed before TRANSFORM is evaluated. "sidebar line 1\nsidebar line 2" markup-secondary-text-face "\n" nil "" markup-meta-hide-face "\n")) +;; Don't mistake text between two same delimited blocks as a delimited block, +;; i.e. wrongly treating the end of block 1 as a beginning and wrongly +;; treating the beginning of block 2 as ending. +(ert-deftest adoctest-test-delimited-blocks-simple () + (adoctest-faces "delimited-blocks-special-case" + + "" markup-meta-hide-face "\n" nil + "11\n12\n13\n14" markup-code-face "\n" nil + "" markup-meta-hide-face "\n" nil + "\n" nil + "lorem" 'no-face "\n" nil + "\n" nil + "" markup-meta-hide-face "\n" nil + "21\n22\n23\n24" markup-code-face "\n" nil + "" markup-meta-hide-face "\n" nil + "\n" nil + "ipsum" 'no-face "\n" nil)) + +(ert-deftest adoctest-test-delimited-blocks-simple () + (adoctest-faces "delimited-blocks-empty" +"" markup-meta-hide-face "\n" nil +"" markup-meta-hide-face "\n" nil +"\n" nil +"" markup-meta-hide-face "\n" nil +"" markup-meta-hide-face "\n" nil +"\n" nil +"" markup-meta-hide-face "\n" nil +"" markup-meta-hide-face "\n" nil +"\n" nil +"" markup-meta-hide-face "\n" nil +"" markup-meta-hide-face "\n" nil +"\n" nil +"" markup-meta-hide-face "\n" nil +"" markup-meta-hide-face "\n" nil +"\n" nil +"" markup-meta-hide-face "\n" nil +"" markup-meta-hide-face "\n" nil +"\n" nil +"" markup-meta-hide-face "\n" nil +"" markup-meta-hide-face "\n")) + (ert-deftest adoctest-test-open-block () (adoctest-faces "open-block" "--" markup-meta-hide-face "\n" nil diff --git a/adoc-mode.el b/adoc-mode.el index 632f68abac..1c2708c979 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -900,13 +900,32 @@ Subgroups: adoc-delimited-block-del "\\|") "\\)")) +;; KLUDGE: Contrary to what the AsciiDoc manual specifies, adoc-mode does not +;; allow that either the first or the last line within a delmited block is +;; blank. That shall help to prevent the case that adoc-mode wrongly +;; interprets the end of a delimited block as the beginning, and the beginning +;; of a following delimited block as the ending, thus wrongly interpreting the +;; text between two adjacent delimited blocks as delimited block. It is +;; expected that it is unlikely that one wants to begin or end a delimited +;; block with a blank line, and it is expected that it is likely that +;; delimited blocks are surrounded by blank lines. (defun adoc-re-delimited-block (del) (let* ((tmp (nth del adoc-delimited-block-del)) (start (if (consp tmp) (car tmp) tmp)) (end (if (consp tmp) (cdr tmp) tmp))) (concat "\\(" start "\\)[ \t]*\n" - "\\(\\(?:.*\n\\)*?\\)" + "\\(" + ;; a single leading non-blank line + "[ \t]*[^ \t\n].*\n" + ;; optionally followed by + "\\(?:" + ;; any number of arbitrary lines followed by + "\\(?:.*\n\\)*?" + ;; a trailing non blank line + "[ \t]*[^ \t\n].*\n" + "\\)??" + "\\)??" "\\(" end "\\)[ \t]*$"))) ;; TODO: since its multiline, it doesn't yet work properly. @@ -1399,8 +1418,8 @@ Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-llisti'." '(0 '(face nil font-lock-multiline t) t) '(1 '(face markup-meta-hide-face adoc-reserved block-del) t) (if (not inhibit-text-reserved) - `(2 '(face ,text-face face markup-verbatim-face adoc-reserved t) t) - `(2 ,text-face t)) + `(2 '(face ,text-face face markup-verbatim-face adoc-reserved t) t t) + `(2 ,text-face t t)) '(3 '(face markup-meta-hide-face adoc-reserved block-del) t))) ;; if adoc-kw-delimited-block, adoc-kw-two-line-title don't find the whole
[nongnu] elpa/adoc-mode f519baf304 022/199: addef *.elc files to .gitignore
branch: elpa/adoc-mode commit f519baf304bb2d74fe87cee12531827532013cec Author: Florian Kaufmann Commit: Florian Kaufmann addef *.elc files to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e0c38e3b07..fab7aa3c70 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ .svn +*.elc
[nongnu] elpa/adoc-mode 1b3a175861 100/199: renamings and improved comments in field of macros
branch: elpa/adoc-mode commit 1b3a17586164fce187504076b58e7e68451d05cb Author: sensorflo Commit: sensorflo renamings and improved comments in field of macros --- adoc-mode.el | 101 --- 1 file changed, 69 insertions(+), 32 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 2d1d5d54d9..055c1d5186 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1163,13 +1163,12 @@ subgroups: (t (error "Invalid type" -;; asciidoc.conf: -;; # Macros using default syntax. +;; Macros using default syntax. From asciidoc.conf: ;; (?http|https|ftp|file|irc|mailto|callto|image|link|anchor|xref|indexterm):(?P\S*?)\[(?P.*?)\] -;; # Default (catchall) inline macro is not implemented -;; # [\\]?(?P\w(\w|-)*?):(?P\S*?)\[(?P.*?)(?\w(\w|-)*?):(?P\S*?)\[(?P.*?)(?
[nongnu] elpa/adoc-mode 569eff13b1 078/199: added lots of templates & easy-menu-entries
branch: elpa/adoc-mode commit 569eff13b144e2f2bd996a47502bff1aa88f9af4 Author: Florian Kaufmann Commit: Florian Kaufmann added lots of templates & easy-menu-entries Now the most of the often used construct each have a - template - easy menu entry which calls the template - both of the above have a doc string, which's content is an extract from the AsciiDoc manual. As template, either the tempo or the tempo-snippet framework can be used. --- adoc-mode-test.el | 139 adoc-mode.el | 622 -- 2 files changed, 744 insertions(+), 17 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 82ba796a2f..d6c8f7a701 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -611,11 +611,150 @@ removed before TRANSFORM is evaluated. (should (equal (line-number-at-pos) 3))) (kill-buffer "adoc-test"))) +(defun adoctest-template (template expected) + (let ((buf-name (concat "adoctest-" (symbol-name template +(unwind-protect + (progn + ;; setup + (set-buffer (get-buffer-create buf-name)) + (delete-region (point-min) (point-max)) + (funcall template) + (should (equal (buffer-substring-no-properties (point-min) (point-max)) expected))) + ;; tear-down + (kill-buffer buf-name + +(defun adoctest-quotes (start-del end-del transform) + (adoctest-trans "lorem ! ipsum" + (concat "lorem " start-del end-del " ipsum") transform) + (adoctest-trans "lorem dolor" + (concat "lorem " start-del "ipsum" end-del " dolor") transform)) + +;; todo: test templates also with tempo-snippets +(ert-deftest adoctest-test-tempo-quotes () + (adoctest-quotes "_" "_" '(tempo-template-adoc-emphasis)) + (adoctest-quotes "*" "*" '(tempo-template-adoc-strong)) + (adoctest-quotes "+" "+" '(tempo-template-adoc-monospace)) + (adoctest-quotes "`" "`" '(tempo-template-adoc-monospace-literal)) + (adoctest-quotes "`" "'" '(tempo-template-adoc-single-quote)) + (adoctest-quotes "``" "''" '(tempo-template-adoc-double-quote)) + (adoctest-quotes "[]#" "#" '(tempo-template-adoc-attributed)) + (adoctest-quotes "__" "__" '(tempo-template-adoc-emphasis-uc)) + (adoctest-quotes "**" "**" '(tempo-template-adoc-strong-uc)) + (adoctest-quotes "++" "++" '(tempo-template-adoc-monospace-uc)) + (adoctest-quotes "^" "^" '(tempo-template-adoc-superscript)) + (adoctest-quotes "~" "~" '(tempo-template-adoc-subscript))) + +(ert-deftest adoctest-test-tempo-formatting-misc () + + (adoctest-trans "" " +" '(tempo-template-adoc-line-break)) + (adoctest-trans "lor!em" "lor +\nem" '(tempo-template-adoc-line-break)) + ;; dont change only white sequence between point and end of line + (adoctest-trans "lorem! \nipsum" "lorem + \nipsum" '(tempo-template-adoc-line-break)) + ;; if befor point already a space is, dont insert a new one + (adoctest-trans "lorem !\nipsum" "lorem +\nipsum" '(tempo-template-adoc-line-break)) + + (adoctest-trans "" "<<<" '(tempo-template-adoc-page-break)) + (adoctest-trans "lorem\n!\nipsum" "lorem\n<<<\nipsum" '(tempo-template-adoc-page-break)) + (adoctest-trans "lor!em\nipsum" "lor\n<<<\nem\nipsum" '(tempo-template-adoc-page-break)) + + (adoctest-trans "" "---" '(tempo-template-adoc-ruler-line)) + (adoctest-trans "lorem\n!\nipsum" "lorem\n---\nipsum" '(tempo-template-adoc-ruler-line)) + (adoctest-trans "lor!em\nipsum" "lor\n---\nem\nipsum" '(tempo-template-adoc-ruler-line))) + +;; todo: check buffer position after insertion (aka transionsion). Probably +;; factor out from adoctest-trans a defun which translates a string containing +;; !s into one with the ! stripped and a buffer-position-list +(ert-deftest adoctest-test-tempo-title () + (let ((adoc-title-style 'adoc-title-style-one-line)) +;; BUG!! somehow I need to load adoc-mode twice until it works!!! +(adoctest-trans "" "= " '(tempo-template-adoc-title-1)) +(adoctest-trans "" "=== " '(tempo-template-adoc-title-3)) +(adoctest-trans "lorem\n!\nipsum" "lorem\n= \nipsum" '(tempo-template-adoc-title-1))) + + (let ((adoc-title-style 'adoc-title-style-one-line-enclosed)) +(adoctest-trans "" "= =" '(tempo-template-adoc-title-1)) +(adoctest-trans "" "=== ===" '(tempo-template-adoc-title-3)) +(adoctest-trans "lorem\n!\nipsum" "lorem\n= =\nipsum" '(tempo-template-adoc-title-1))) + + (let ((adoc-title-style 'adoc-title-style-two-line)) +(adoctest-trans "" "\n" '(tempo-template-adoc-title-1)) +(adoctest-trans "" "\n" '(tempo-template-adoc-title-3)) +(adoctest-trans "lorem\n!\nipsum" "lorem\n\n\nipsum" '(tempo-template-adoc-title-1 + +(ert-deftest adoctest-test-tempo-paragraphs () + (adoctest-trans "" " " '(tempo-template-adoc-literal-paragraph)) + (adoctest-trans "lorem" "lorem\n ipsum" '(tempo-template-adoc-literal-paragraph)) + (adoctest-trans "" "TIP: " '(tempo-template-adoc-paragra
[nongnu] elpa/adoc-mode e144653832 005/199: refactored title constructs, initiated testing adoc-mode
branch: elpa/adoc-mode commit e1446538322c3fddd20aa23628a34f75a40b83f2 Author: Florian Kaufmann Commit: Florian Kaufmann refactored title constructs, initiated testing adoc-mode only concerning title constructs - no longer use varibles pointing to faces - deleted adoc faces, only using markup faces - simple tests - regexps now all use adoc-two-line-title-del instead own redundant literals --- adoc-mode-test.el | 80 + adoc-mode.el | 89 +++ 2 files changed, 117 insertions(+), 52 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el new file mode 100644 index 00..3d3ddf59e9 --- /dev/null +++ b/adoc-mode-test.el @@ -0,0 +1,80 @@ +(require 'ert) +(require 'adoc-mode) + +;; todo +;; test for font lock multiline property + +(defun adoctest-make-buffer (&rest args) + (set-buffer (get-buffer-create "adoctest")) + (delete-region (point-min) (point-max)) + + (while args +(insert (propertize (car args) 'adoctest (cadr args))) +(setq args (cddr args))) + + (adoc-mode) + (font-lock-fontify-buffer)) + +(ert-deftest adoctest-foo () + ;; todo + ;; ! + ;; Lock Support Mode must be set to nil + ;; ! + + + ;; the white after = really is part of the delimiter + (adoctest-make-buffer + "= " markup-meta-hide-face "document title" markup-title-0-face "\n" nil + "\n" nil + "== " markup-meta-hide-face "chapter 1" markup-title-1-face "\n" nil + "\n" nil + "=== " markup-meta-hide-face "chapter 2" markup-title-2-face "\n" nil + "\n" nil + " " markup-meta-hide-face "chapter 3" markup-title-3-face "\n" nil + "\n" nil + "= " markup-meta-hide-face "chapter 4" markup-title-4-face "\n" nil + "\n" nil + + "= " markup-meta-hide-face "document title" markup-title-0-face " =" markup-meta-hide-face "\n" nil + "\n" nil + "== " markup-meta-hide-face "chapter 1" markup-title-1-face " ==" markup-meta-hide-face "\n" nil + "\n" nil + "=== " markup-meta-hide-face "chapter 2" markup-title-2-face " ===" markup-meta-hide-face "\n" nil + "\n" nil + " " markup-meta-hide-face "chapter 3" markup-title-3-face " " markup-meta-hide-face "\n" nil + "\n" nil + "= " markup-meta-hide-face "chapter 4" markup-title-4-face " =" markup-meta-hide-face "\n" nil + "\n" nil + + ;; todo + ;; ensure somehow adoc-enable-two-line-title is t + "document title" markup-title-0-face "\n" nil + "==" markup-meta-hide-face "\n" nil + "\n" nil + "chapter 1" markup-title-1-face "\n" nil + "-" markup-meta-hide-face "\n" nil + "\n" nil + "chapter 2" markup-title-2-face "\n" nil + "~" markup-meta-hide-face "\n" nil + "\n" nil + "chapter 3" markup-title-3-face "\n" nil + "^" markup-meta-hide-face "\n" nil + "\n" nil + "chapter 4" markup-title-4-face "\n" nil + "+" markup-meta-hide-face "\n" nil + "\n" nil + ) + + (goto-char (point-min)) + (let ((not-done t)) +(while not-done + (let* ((tmp (get-text-property (point) 'adoctest)) +(tmp2 (get-text-property (point) 'face))) + (when tmp + (ert-should (equal tmp2 tmp + (if (< (point) (point-max)) + (forward-char 1) + (setq not-done nil) + +(ert-run-tests-interactively "^adoctest-") + diff --git a/adoc-mode.el b/adoc-mode.el index 670fb68f33..cdd49fe447 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -222,11 +222,6 @@ aligned. :group 'adoc) (define-obsolete-face-alias 'adoc-generic 'markup-gen-face "23.3") -(define-obsolete-face-alias 'adoc-title-0 'markup-title-0-face "23.3") -(define-obsolete-face-alias 'adoc-title-1 'markup-title-1-face "23.3") -(define-obsolete-face-alias 'adoc-title-2 'markup-title-2-face "23.3") -(define-obsolete-face-alias 'adoc-title-3 'markup-title-3-face "23.3") -(define-obsolete-face-alias 'adoc-title-4 'markup-title-4-face "23.3") (define-obsolete-face-alias 'adoc-monospace 'markup-typewriter-face "23.3") (define-obsolete-face-alias 'adoc-strong 'markup-strong-face "23.3") (define-obsolete-face-alias 'adoc-emphasis 'markup-emphasis-face "23.3") @@ -251,11 +246,6 @@ aligned. ;; adoc-font-lock-keywords does not work. (defvar adoc-align 'adoc-align) (defvar adoc-generic 'markup-gen-face) -(defvar adoc-title-0 'markup-title-0-face) -(defvar adoc-title-1 'markup-title-1-face) -(defvar adoc-title-2 'markup-title-2-face) -(defvar adoc-title-3 'markup-title-3-face) -(defvar adoc-title-4 'markup-title-4-face) (defvar adoc-monospace 'markup-typewriter-face) (defvar adoc-strong 'markup-strong-face) (defvar adoc-emphasis 'markup-emphasis-face) @@ -268,7 +258,7 @@ aligned. (defvar adoc-reference 'markup-reference-face) (defvar adoc-secondary-text 'markup-secondary-text-face) (defvar adoc-delimiter 'markup-meta-face) -(defvar adoc-hide-delimiter 'markup-hide-delimiter-face) +(defvar adoc-hide-delimiter '
[nongnu] elpa/adoc-mode 1206fe7409 103/199: adoc-re-inline-macro can now also match in the middle of a word
branch: elpa/adoc-mode commit 1206fe74090a5712bc6f19077e91b1f463c19276 Author: sensorflo Commit: sensorflo adoc-re-inline-macro can now also match in the middle of a word --- adoc-mode.el | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 0faa49e3b1..c5a01e0e4d 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1169,13 +1169,15 @@ subgroups: ;; asciidoc.conf itself says: Default (catchall) inline macro is not ;; implemented. It _would_ be ;; (?su)[\\]?(?P\w(\w|-)*?):(?P\S*?)\[(?P.*?)(?
[nongnu] elpa/adoc-mode 7b0009904e 047/199: updated URL and copyright date
branch: elpa/adoc-mode commit 7b0009904ee08e2111dcfb9d55e3f8da44a21ad7 Author: Florian Kaufmann Commit: Florian Kaufmann updated URL and copyright date --- adoc-mode.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 4f2a7a4f99..3801211624 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1,9 +1,10 @@ ;;; adoc-mode.el --- a major-mode for editing AsciiDoc files in Emacs ;; -;; Copyright 2010 Florian Kaufmann +;; Copyright 2010-2012 Florian Kaufmann ;; ;; Author: Florian Kaufmann -;; URL: http://code.google.com/p/adoc-mode/ +;; URL: Current official: http://code.google.com/p/adoc-mode/ +;; Develop, future official: https://github.com/sensorflo/adoc-mode ;; Created: 2009 ;; Version: 0.4.0 ;; Keywords: wp AsciiDoc
[nongnu] elpa/adoc-mode eb20a274e0 024/199: made it easier to run tests
branch: elpa/adoc-mode commit eb20a274e094411015bce6af4e37a666b5501f35 Author: Florian Kaufmann Commit: Florian Kaufmann made it easier to run tests --- adoc-mode-test.el | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index e390b8c724..fc703116ea 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -201,4 +201,12 @@ (ert-deftest adoctest-test-byte-compile () (ert-should (byte-compile-file (locate-library "adoc-mode.el" t -(ert-run-tests-interactively "^adoctest-test-") +(defun adoc-test-run() + (interactive) + (save-buffer "adoc-mode.el") + (load-library "adoc-mode") + (save-buffer "adoc-mode-test.el") + (load-library "adoc-mode-test") + (ert-run-tests-interactively "^adoctest-test-")) + +(global-set-key [(f5)] 'adoc-test-run)
[nongnu] elpa/adoc-mode 0ac95247d4 116/199: refactoring so regexp's for one- and two line titles have group 2 for title's text
branch: elpa/adoc-mode commit 0ac95247d4809c6aef544f0b1907efa9ad883b60 Author: sensorflo Commit: sensorflo refactoring so regexp's for one- and two line titles have group 2 for title's text --- adoc-mode.el | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index bb761ed8cb..46ca7c2324 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -755,15 +755,18 @@ has the correct length. DEL is described in `adoc-re-two-line-title-undlerline'. match-data has these sub groups: -1 title's text -2 delimiter + +1 dummy, so that group 2 is the title's text as in + adoc-re-one-line-title +2 title's text +3 delimiter 0 only chars that belong to the title block element" (when (not (eq (length del) 2)) (error "two line title delimiters must be 2 chars long")) (concat ;; 1st line: title text must contain at least one \w character, see ;; asciidoc src, Title.parse, - "\\(^.*?[a-zA-Z0-9_].*?\\)[ \t]*\n" + "\\(\\)\\(^.*?[a-zA-Z0-9_].*?\\)[ \t]*\n" ;; 2nd line: underline (adoc-re-two-line-title-undlerline del))) @@ -1435,13 +1438,13 @@ text having adoc-reserved set to 'block-del." `(lambda (end) (and adoc-enable-two-line-title (re-search-forward ,(adoc-re-two-line-title del) end t) - (< (abs (- (length (match-string 1)) (length (match-string 2 3) + (< (abs (- (length (match-string 2)) (length (match-string 3 3) (or (not (numberp adoc-enable-two-line-title)) (not (equal adoc-enable-two-line-title (length (match-string 2) (not (text-property-not-all (match-beginning 0) (match-end 0) 'adoc-reserved nil ;; highlighers - `(1 ,text-face t) - `(2 '(face markup-meta-hide-face adoc-reserved block-del) t))) + `(2 ,text-face t) + `(3 '(face markup-meta-hide-face adoc-reserved block-del) t))) ;; (defun adoc-?-attributes (endpos enddelchar) ;; (list @@ -2738,7 +2741,7 @@ trailing delimiter ('== my title =='). (beginning-of-line) (looking-at (adoc-re-two-line-title (nth level adoc-two-line-title-del) (setq type 2) - (setq text (match-string 1)) + (setq text (match-string 2)) (setq found t)) (t (setq level (+ level 1)
[nongnu] elpa/adoc-mode c5fec9c015 001/199: initial commit
branch: elpa/adoc-mode commit c5fec9c01591432faf5ce0e7c95421a8ecdedbe9 Author: Florian Kaufmann Commit: Florian Kaufmann initial commit --- .gitignore |2 + adoc-mode.el | 1900 ++ 2 files changed, 1902 insertions(+) diff --git a/.gitignore b/.gitignore new file mode 100644 index 00..e0c38e3b07 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +.svn diff --git a/adoc-mode.el b/adoc-mode.el new file mode 100644 index 00..689ac77553 --- /dev/null +++ b/adoc-mode.el @@ -0,0 +1,1900 @@ +;;; adoc-mode.el --- a major-mode for editing AsciiDoc files in Emacs +;; +;; Copyright 2010 Florian Kaufmann +;; +;; Author: Florian Kaufmann +;; URL: http://code.google.com/p/adoc-mode/ +;; Created: 2009 +;; Version: 0.4.0 +;; Keywords: wp AsciiDoc +;; +;; This file is not part of GNU Emacs. +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. +;; +;;; Commentary: +;; +;; AsciiDoc (http://www.methods.co.nz/asciidoc/) is a text document format for +;; writing short documents, articles, books and UNIX man pages. AsciiDoc files +;; can be translated to HTML and DocBook markups. +;; +;; This is just a first version which works not too bad for my small uses of +;; AsciiDoc. It's mostly about syntax highlighting. I still like to play a lot +;; and thus it's not stable at all. +;; +;; I actually would like to improve it, but realistically will invest +;; my time in other activities. +;; +;; Installation: +;; +;; Installation is as usual, so if you are proficient with Emacs you don't need +;; to read this. +;; +;; 1. Copy this file to a directory in `load-path'. To add a specific directory +;;to the load path, add this to your initialization file (~/.emacs or ~/_emacs): +;;(add-to-list 'load-path "mypath") +;; +;; 2. Add either of the two following lines to your initialization file: +;;a) (autoload 'adoc-mode "adoc-mode") +;;b) (require 'adoc-mode) +;;The first only loads adoc mode when necessary, the 2nd always during +;;startup of Emacs. +;; +;; 3. To use adoc mode, call adoc-mode after you opened an AsciiDoc file +;;M-x adoc-mode +;; +;; Each of the following is optional +;; +;; * Byte compile this file (adoc-mode.el) for faster startup: +;; M-x byte-compile +;; +;; * According to AsciiDoc manual, '.txt' is the standard file extension for +;; AsciiDoc files. Add the following to your initialization file to open all +;; '.txt' files with adoc-mode as major mode automatically: +;; (add-to-list 'auto-mode-alist (cons "\\.txt\\'" 'adoc-mode)) +;; +;; * If your default face is a fixed pitch (monospace) face, but in AsciiDoc +;; files you liked to have normal text with a variable pitch face, +;; `buffer-face-mode' is for you: +;; (add-hook 'adoc-mode-hook (lambda() (buffer-face-mode t))) +;; +;; +;; Todo: +;; - Fontlock +;; - make font-lock regexps based upon AsciiDoc configuration file, or +;; make them configurable in a way similar to that configuration file +;; - respect font-lock-maximum-decoration +;; - Other common emacs functionality/features +;; - indent functions +;; - imenu / outline / hideshow +;; - tags +;; - Make 'compilation', i.e. translating into the desired output format more +;; conventient +;; - tempo-templates +;; - spell check shall ignore text that is not part of the output +;; - supply a regexp for magic-mode-alist +;; - Is there something that would remove hard newlines within a paragraph, +;; but just for display, so the paragraph uses the whole buffer length. +;; - are there generic base packages to handle lists / tables? +;; - AsciiDoc related features +;; - Two (or gruadualy fading) display modes: one emphasises to see the +;; AsciiDoc source text, the other emphasises to see how the output will +;; look like. +;; - invisible text property could be used to hide meta characters +;; - tags tables for anchors, indixes, bibliography items, titles, ... +;; +;; Bugs: +;; - delimited blocks are supported, but not well at all +;; - Most regexps for highlighting can spawn at most over two lines. +;; - font-lock's multi line capabilities are not used well enough +;; - AsciiDoc's escape rules don't seem to be what one expects. E.g. \\__bla__ +;; is *not
[nongnu] elpa/adoc-mode de18a17505 031/199: fl keyword for comments now in new-style
branch: elpa/adoc-mode commit de18a1750564cf0eb458c7e1b9aec115bc7353ea Author: Florian Kaufmann Commit: Florian Kaufmann fl keyword for comments now in new-style --- adoc-mode-test.el | 14 ++ adoc-mode.el | 10 ++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 337c618350..f07b2524f1 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -121,6 +121,20 @@ "open block line 1\nopen block line 2" nil "\n" nil "--" markup-meta-hide-face "\n" nil)) +(ert-deftest adoctest-test-comments () + (adoctest-faces "comments" +;; as block macro +"// lorem ipsum\n" markup-comment-face +"\n" nil +;; as inline macro +"lorem ipsum\n" 'no-face +"// dolor sit\n" markup-comment-face +"amen\n" 'no-face +"\n" nil +;; as delimited block +;; tested in delimited-blocks-simple +)) + (ert-deftest adoctest-test-quotes-simple () (adoctest-faces "test-quotes-simple" ;; note that in unconstraned quotes cases " ipsum " has spaces around, in diff --git a/adoc-mode.el b/adoc-mode.el index 5a74af9182..fc301aef6b 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1161,21 +1161,23 @@ When LITERAL-P is non-nil, the contained text is literal text." (list "^\\(<\\{3,\\}+\\)[ \t]*$" '(1 '(face adoc-delimiter adoc-reserved block-del))) ;; comment - ;; ^//(?P[^/].*|)$=#comment[normal] + ;; (?mu)^[\\]?//(?P[^/].*|)$ + ;; I don't know what the [\\]? should mean (list "^\\(//\\(?:[^/].*\\|\\)\n\\)" - '(1 '(face adoc-comment adoc-reserved block-del))) + '(1 '(face markup-comment-face adoc-reserved block-del))) ;; image + ;; (?u)^(?Pimage|unfloat)::(?P\S*?)(\[(?P.*?)\])$ (list "^\\(\\(image::\\)\\([^ \t\n]*?\\)\\(\\[.*?\\]\\)\\)[ \t]*$" '(1 '(face nil adoc-reserved block-del)) ; whole match '(2 adoc-hide-delimiter) ; macro name '(3 adoc-complex-replacement); file name '(4 adoc-delimiter)) ; attribute list inlcl. [] - ;; passthrough: (?u)^(?Ppass)::(?P\S*?)(\[(?P.*?)\])$=# + ;; passthrough: (?u)^(?Ppass)::(?P\S*?)(\[(?P.*?)\])$ ;; todo ;; -- general block macro ;; also highlight yet unknown block macros - ;; general syntax: (?u)^(?Pimage|unfloat)::(?P\S*?)(\[(?P.*?)\])$=# + ;; general syntax: (?u)^(?Pimage|unfloat)::(?P\S*?)(\[(?P.*?)\])$ (list "^[a-zA-Z0-9_]+::\\([^ \t\n]*?\\)\\(\\[.*?\\]\\)[ \t]*$" 'adoc-delimiter)
[nongnu] elpa/adoc-mode 276e822b59 004/199: Merge markup-faces into font_lock_delimited_blocks
branch: elpa/adoc-mode commit 276e822b59667df72bf0e7b1a384f6882c74fffa Merge: 56cfbecca2 f4bbbea2ff Author: Florian Kaufmann Commit: Florian Kaufmann Merge markup-faces into font_lock_delimited_blocks Conflicts: adoc-mode.el --- adoc-mode.el | 315 +++ 1 file changed, 77 insertions(+), 238 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 0e3d986987..670fb68f33 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -108,6 +108,8 @@ ;; ;;; Variables: +(require 'markup-faces) + (defconst adoc-mode-version "0.4.0" "Based upon AsciiDoc version 8.5.2. I.e. regexeps and rules are taken from that version's asciidoc.conf/manual.") @@ -116,16 +118,6 @@ that version's asciidoc.conf/manual.") "Support for AsciiDoc documents." :group 'wp) -(defgroup adoc-faces nil - "Faces used in adoc mode. - -Note that what is really used to highlight is the content of the -corresponding variables. E.g. for titles not really the face -adoc-title-0 is used, but the content of the variable -adoc-title-0." - :group 'adoc - :group 'faces ) - (defcustom adoc-script-raise '(-0.3 0.3) "How much to lower and raise subscript and superscript content. @@ -213,227 +205,74 @@ most 3 chars from the length of the title text." number) :group 'adoc) -(defface adoc-orig-default - '((t (:inherit (default - "The default face before buffer-face-mode was in effect. - -This face is only a kludge. If I understood the face-remap -library better, it probably woudn't be needed." - :group 'adoc-faces) - -(defface adoc-generic - 'background light)) - (:foreground "blue")) -(((background dark)) - (:foreground "skyblue"))) - "For things that don't have their dedicated face. - -Many important AsciiDoc constructs have their dedicated face in -adoc-mode like e.g. adoc-title-0, adoc-strong etc. - -For all other, less often used constructs, where it wasn't deemed -necessary to create an own dedicated face, adoc-generic is used. -E.g. #...#, the label text of a labeled list item, block titles. - -Beside that it servers as a base face from which other adoc -faces, at least their default value, inherit." - :group 'adoc-faces) - -(defface adoc-title-0 - '((t (:inherit adoc-generic :weight bold :height 2.0))) - "" - :group 'adoc-faces) - -(defface adoc-title-1 - '((t (:inherit adoc-generic :weight bold :height 1.8))) - "" - :group 'adoc-faces) - -(defface adoc-title-2 - '((t (:inherit adoc-generic :weight bold :height 1.4))) - "" - :group 'adoc-faces) - -(defface adoc-title-3 - '((t (:inherit adoc-generic :slant italic :weight bold))) - "" - :group 'adoc-faces) - -(defface adoc-title-4 - '((t (:inherit adoc-generic :slant italic :weight bold))) - "" - :group 'adoc-faces) - -(defface adoc-monospace - '((t (:inherit (fixed-pitch adoc-generic - "For monospace, literal or pass through text" - :group 'adoc-faces) - -(defface adoc-strong - '((t (:inherit (adoc-generic bold - "" - :group 'adoc-faces) - -(defface adoc-emphasis - '((t (:inherit (adoc-generic italic - "" - :group 'adoc-faces) - -(defface adoc-superscript - '((t (:inherit adoc-generic :height 0.8))) - "How much to raise it is defined by adoc-script-raise. - -Note that the example here in the customization buffer is not -correctly highlighted the raising by adoc-script-raise part is -missing." - :group 'adoc-faces) - -(defface adoc-subscript - '((t (:inherit adoc-generic :height 0.8))) - "How much to lower it is defined by adoc-script-raise. - -Note that the example here in the customization buffer is not -correctly highlighted, the lowering by adoc-script-raise part is -missing." - :group 'adoc-faces) - -(defface adoc-secondary-text - '((t (:height 0.8))) - "Text that is not part of the running text in the output. - -E.g. captions or footnotes." - :group 'adoc-faces) - -(defface adoc-replacement - '((default (:inherit adoc-orig-default)) -(((background light)) - (:foreground "purple1")) -(((background dark)) - (:foreground "plum1"))) - "For things that will be replaced by something simple/similar. - -A text phrase that is replaced by another phrase. - -E.g. AsciiDoc replacements ('(C)' for the copy right sign), -entity references ('¶' for a carriage return sign), -single/double quoted text (that is, the quotes in `...' , ``...'' -are replaced by actual single/double quotation marks.)" - :group 'adoc-faces) - -(defface adoc-complex-replacement - '((default (:inherit adoc-orig-default)) -(((background light)) - (:background "plum1" :foreground "purple3" :box (:line-width 2 :color "plum1" :style released-button))) -(((background dark)) - (:background "purple3" :foreground "plum1" :box (:line-width 2 :color "purple3" :style released-button - "For things that will be replaced by something complex (e.g an image). - -E.g. adominition paragraphs ('WARNING: '), images ('image::i
[nongnu] elpa/adoc-mode 141af8c56a 123/199: Associate with .adoc and .asciidoc
branch: elpa/adoc-mode commit 141af8c56aa3efc572c04767c25ba946341a6c05 Author: Ville Skyttä Commit: TobiasZawada Associate with .adoc and .asciidoc --- adoc-mode.el | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 767b2a2685..23435054ab 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -99,10 +99,12 @@ ;; ;; Each of the following is optional ;; -;; * According to AsciiDoc manual, .txt is the standard file extension of +;; * According to an old AsciiDoc manual, .txt is the standard file extension of ;; AsciiDoc files. Add the following to your initialization file to open all ;; .txt files with adoc-mode as major mode automatically: `(add-to-list -;; 'auto-mode-alist (cons "\\.txt\\'" 'adoc-mode))` +;; 'auto-mode-alist (cons "\\.txt\\'" 'adoc-mode))`. +;; More recent conventions for AsciiDoc file extensions include `.adoc` and +;; `.asciidoc`, these are associated automatically. ;; ;; * If your default face is a fixed pitch (monospace) face, but in AsciiDoc ;; files you liked to have normal text with a variable pitch face, @@ -3038,6 +3040,9 @@ Turning on Adoc mode runs the normal hook `adoc-mode-hook'." (easy-menu-add adoc-mode-menu)) +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.a\\(?:scii\\)?doc\\'" . adoc-mode)) + non-definitions evaluated during load (adoc-calc)
[nongnu] elpa/adoc-mode 2bcfcea743 112/199: improved comments
branch: elpa/adoc-mode commit 2bcfcea74379a1a9bba375e3bfd3c0be95ae913a Author: sensorflo Commit: sensorflo improved comments --- adoc-mode.el | 1 - 1 file changed, 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index 911a599fa4..793c72a5a0 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1574,7 +1574,6 @@ meta characters." ;; largely copied from adoc-kw-inline-macro ;; todo: output text should be affected by quotes & co, e.g. bold, emph, ... -;; todo: for simplicity maybe split up in one for url[] and url[caption] (defun adoc-kw-inline-macro-urls-attribute-list () (let ((cmd-name (regexp-opt '("http" "https" "ftp" "file" "irc" "mailto" "callto" "link"))) (attribute-list '(("caption") (("caption" . markup-reference-face)
[nongnu] elpa/adoc-mode 0a35871ac3 083/199: edited (doc-)comments to make it fit package format guidelines
branch: elpa/adoc-mode commit 0a35871ac3a2ea49ea103cbe8c518866217e7787 Author: Florian Kaufmann Commit: Florian Kaufmann edited (doc-)comments to make it fit package format guidelines --- adoc-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 02d4981576..32cf399016 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -3,10 +3,10 @@ ;; Copyright 2010-2013 Florian Kaufmann ;; ;; Author: Florian Kaufmann -;; URL: Current official: http://code.google.com/p/adoc-mode/ -;; Develop, future official: https://github.com/sensorflo/adoc-mode +;; URL: https://github.com/sensorflo/adoc-mode/wiki ;; Created: 2009 ;; Version: 0.6.0 +;; Package-Requires: ((markup-faces "1.0.0")) ;; Keywords: wp AsciiDoc ;; ;; This file is not part of GNU Emacs.
[nongnu] elpa/adoc-mode efa9ef97a0 080/199: list item tempos respect tab-width and indent-tabs-mode
branch: elpa/adoc-mode commit efa9ef97a0f79919907d736655bb092b0214f5da Author: Florian Kaufmann Commit: Florian Kaufmann list item tempos respect tab-width and indent-tabs-mode --- adoc-mode-test.el | 12 +++- adoc-mode.el | 20 ++-- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 8ad4079fdd..3889e553da 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -711,11 +711,13 @@ removed before TRANSFORM is evaluated. (adoctest-delimited-block "--" '(tempo-template-adoc-delimited-block-open-block))) (ert-deftest adoctest-test-tempo-lists () - (adoctest-trans "" "- " '(tempo-template-adoc-bulleted-list-item-1)) - (adoctest-trans "" " ** " '(tempo-template-adoc-bulleted-list-item-2)) - (adoctest-trans "" "- foo" '(tempo-template-adoc-bulleted-list-item-1)) - (adoctest-trans "" ":: " '(tempo-template-adoc-labeled-list-item)) - (adoctest-trans "" ":: foo" '(tempo-template-adoc-labeled-list-item))) + (let ((tab-width 2) + (indent-tabs-mode nil)) +(adoctest-trans "" "- " '(tempo-template-adoc-bulleted-list-item-1)) +(adoctest-trans "" " ** " '(tempo-template-adoc-bulleted-list-item-2)) +(adoctest-trans "" "- foo" '(tempo-template-adoc-bulleted-list-item-1)) +(adoctest-trans "" ":: " '(tempo-template-adoc-labeled-list-item)) +(adoctest-trans "" ":: foo" '(tempo-template-adoc-labeled-list-item (ert-deftest adoctest-test-tempo-macros () (adoctest-trans "" "http://foo.com[]"; '(tempo-template-adoc-url-caption)) diff --git a/adoc-mode.el b/adoc-mode.el index 7ab3e21186..1dc8c57310 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -2424,18 +2424,18 @@ Is influenced by customization variables such as `adoc-title-style'." ;; Lists ;; todo: customize indentation -(adoc-tempo-define "adoc-bulleted-list-item-1" '(bol "- " (r "text" text))) -(adoc-tempo-define "adoc-bulleted-list-item-2" '(bol " ** " (r "text" text))) -(adoc-tempo-define "adoc-bulleted-list-item-3" '(bol " *** " (r "text" text))) -(adoc-tempo-define "adoc-bulleted-list-item-4" '(bol " " (r "text" text))) -(adoc-tempo-define "adoc-bulleted-list-item-5" '(bol "* " (r "text" text))) +(adoc-tempo-define "adoc-bulleted-list-item-1" '(bol (adoc-insert-indented "- " 1) (r "text" text))) +(adoc-tempo-define "adoc-bulleted-list-item-2" '(bol (adoc-insert-indented "** " 2) (r "text" text))) +(adoc-tempo-define "adoc-bulleted-list-item-3" '(bol (adoc-insert-indented "*** " 3) (r "text" text))) +(adoc-tempo-define "adoc-bulleted-list-item-4" '(bol (adoc-insert-indented " " 4) (r "text" text))) +(adoc-tempo-define "adoc-bulleted-list-item-5" '(bol (adoc-insert-indented "* " 5) (r "text" text))) (adoc-tempo-define "adoc-numbered-list-item" '(bol (p "number" number) ". " (r "text" text))) (adoc-tempo-define "adoc-numbered-list-item-roman" '(bol (p "number" number) ") " (r "text" text))) -(adoc-tempo-define "adoc-implicit-numbered-list-item-1" '(bol ". " (r "text" text))) -(adoc-tempo-define "adoc-implicit-numbered-list-item-2" '(bol " .. " (r "text" text))) -(adoc-tempo-define "adoc-implicit-numbered-list-item-3" '(bol " ... " (r "text" text))) -(adoc-tempo-define "adoc-implicit-numbered-list-item-4" '(bol " " (r "text" text))) -(adoc-tempo-define "adoc-implicit-numbered-list-item-5" '(bol ". " (r "text" text))) +(adoc-tempo-define "adoc-implicit-numbered-list-item-1" '(bol (adoc-insert-indented ". " 1) (r "text" text))) +(adoc-tempo-define "adoc-implicit-numbered-list-item-2" '(bol (adoc-insert-indented ".. " 2) (r "text" text))) +(adoc-tempo-define "adoc-implicit-numbered-list-item-3" '(bol (adoc-insert-indented "... " 3) (r "text" text))) +(adoc-tempo-define "adoc-implicit-numbered-list-item-4" '(bol (adoc-insert-indented " " 4) (r "text" text))) +(adoc-tempo-define "adoc-implicit-numbered-list-item-5" '(bol (adoc-insert-indented ". " 5) (r "text" text))) (adoc-tempo-define "adoc-labeled-list-item" '(bol (p "label" label) ":: " (r "text" text))) (adoc-tempo-define "adoc-list-item-continuation" '(bol "+" %) nil adoc-help-list-item-continuation)
[nongnu] elpa/adoc-mode f779544180 084/199: bumped version to 0.6.1
branch: elpa/adoc-mode commit f7795441808b8ed7f5b5cdc273e6df7ebf4503cc Author: Florian Kaufmann Commit: Florian Kaufmann bumped version to 0.6.1 --- adoc-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 32cf399016..b9b08e8d48 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -5,7 +5,7 @@ ;; Author: Florian Kaufmann ;; URL: https://github.com/sensorflo/adoc-mode/wiki ;; Created: 2009 -;; Version: 0.6.0 +;; Version: 0.6.1 ;; Package-Requires: ((markup-faces "1.0.0")) ;; Keywords: wp AsciiDoc ;; @@ -114,7 +114,7 @@ ;; tempo or tempo-snippet is required later below -(defconst adoc-mode-version "0.6.0" +(defconst adoc-mode-version "0.6.1" "adoc mode version number. Based upon AsciiDoc version 8.5.2. I.e. regexeps and rules are
[nongnu] elpa/adoc-mode b65c7fcb92 026/199: block title now fits into the new concept
branch: elpa/adoc-mode commit b65c7fcb92638575e33bbc5a516b949e1be577ab Author: Florian Kaufmann Commit: Florian Kaufmann block title now fits into the new concept --- adoc-mode-test.el | 18 +- adoc-mode.el | 38 -- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index fc7e62c3e8..fb6a7309be 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -1,3 +1,4 @@ + (require 'ert) (require 'adoc-mode) @@ -77,7 +78,10 @@ "^" markup-meta-hide-face "\n" nil "\n" nil "chapter 4" markup-title-4-face "\n" nil - "+" markup-meta-hide-face "\n" nil)) + "+" markup-meta-hide-face "\n" nil + "\n" nil + + "." markup-meta-face "Block title" markup-gen-face "\n" nil )) (ert-deftest adoctest-test-delimited-blocks-simple () (adoctest-faces "delimited-blocks-simple" @@ -210,10 +214,14 @@ "lorem ** ipsum\n" 'no-face "\n" nil - ;; "chapter ** 1" markup-title-1-face "\n" nil - ;; "" markup-meta-hide-face "\n" nil - ;; "lorem ** ipsum\n" 'no-face - ;; "\n" nil + "chapter ** 1" markup-title-1-face "\n" nil + "" markup-meta-hide-face "\n" nil + "lorem ** ipsum\n" 'no-face + "\n" nil + + "." markup-meta-face "block ** title" markup-gen-face "\n" nil + "lorem ** ipsum\n" 'no-face + "\n" nil ;; test also diff --git a/adoc-mode.el b/adoc-mode.el index 4a15635143..6c54bee868 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -585,6 +585,26 @@ Subgroups: "\\)" )) +;; ^\.(?P([^.\s].*)|(\.[^.\s].*))$ +;; Isn't that asciidoc.conf regexp the same as: ^\.(?P(.?[^.\s].*))$ +;; insertion: so that this whole regex doesn't mistake a line starting with a cell specifier like .2+| as a block title +(defun adoc-re-block-title () + "Returns a regexp matching an block title + +Subgroups: +1 delimiter +2 title's text incl trailing whites +3 newline + +.foo n +12--23" + (concat + "^\\(\\.\\)" + "\\(\\.?\\(?:" + "[0-9]+[^+*]" ; inserted part, see above + "\\|[^. \t\n]\\).*\\)" + "\\(\n\\)")) + (defun adoc-re-precond (&optional unwanted-chars backslash-allowed disallowed-at-bol) (concat (when disallowed-at-bol ".") @@ -937,6 +957,13 @@ Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-llisti'." ;; highlighers '(1 '(face adoc-monospace adoc-reserved t font-lock-multiline t +(defun adoc-kw-block-title () + (list + `(lambda (end) (adoc-kwf-std end ,(adoc-re-block-title) '(1))) + '(1 '(face markup-meta-face adoc-reserved block-del)) + '(2 markup-gen-face) + '(3 '(face nil adoc-reserved block-del + (defun adoc-kw-quote (type ldel text-face-spec &optional del-face rdel literal-p) "Return a keyword which highlights (un)constrained quotes. When LITERAL-P is non-nil, the contained text is literal text." @@ -1260,18 +1287,9 @@ When LITERAL-P is non-nil, the contained text is literal text." '(1 '(face adoc-delimiter adoc-reserved block-del))) - ;; block title ;; --- - ;; ^\.(?P([^.\s].*)|(\.[^.\s].*))$ - ;; Isn't that asciidoc.conf regexp the same as: ^\.(?P(.?[^.\s].*))$ - (list (concat - "^\\(\\.\\)\\(\\.?\\(" - ; insertion: so that this whole regex doesn't mistake a line starting with a cell specifier like .2+| as a block title - "[0-9]+[^+*]" - "\\|[^. \t\n]\\).*\\)$") - '(1 '(face adoc-delimiter adoc-reserved block-del)) -'(2 adoc-generic)) + (adoc-kw-block-title) ;; paragraphs
[nongnu] elpa/adoc-mode 27bf57f6fd 095/199: in commentary section, fixed wrong recipe how to use autoload
branch: elpa/adoc-mode commit 27bf57f6fd815dc6aaa47e00bc1a7e4a019eda6d Author: sensorflo Commit: sensorflo in commentary section, fixed wrong recipe how to use autoload --- adoc-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index 6e33aaf992..870afdbe67 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -74,7 +74,7 @@ ;;first only loads adoc mode when necessary, the 2nd always during startup ;;of Emacs. ;; -;;* `(autoload 'adoc-mode "adoc-mode")` +;;* `(autoload 'adoc-mode "adoc-mode" nil t)` ;; ;;* `(require 'adoc-mode)` ;;
[nongnu] elpa/adoc-mode 9e1ea49b09 196/199: Listing blocks and literal blocks can have source style.
branch: elpa/adoc-mode commit 9e1ea49b0908f5b227c3bfdde695b33387198994 Author: Tobias Zawada Commit: TobiasZawada Listing blocks and literal blocks can have source style. Also ignore whitespace at the end of the block attribute line. --- adoc-mode.el | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 2feaa4b234..d49ae6d86b 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -2038,12 +2038,17 @@ START-SRC and END-SRC delimit the actual source code." (cl-flet ((rx-or (first second) (format "\\(?:%s\\|%s\\)" first second)) (rx-optional (stuff) (format "\\(?:%s\\)?" stuff)) (outer-brackets-and-delimiter (&rest stuff) - (format "^\\[%s\\]\n\\(?2:+\\)\n" + ;; Listing blocks (delimiter ) and literal blocks (delimiter ) can have `source`-style: + ;; https://docs.asciidoctor.org/asciidoc/latest/blocks/delimited/#summary-of-structural-containers + (format "^\\[%s\\]\s*\n\\(?2:\\(+\\|\\.\\{4,\\}\\)\\)\n" (apply #'concat stuff))) ;; The language attribute is positional only (2nd slot). ;; It gets its default value from the document attribute `source-language`. ;; The leading space between the comma and the 2nd attribute is ignored. ;; See https://docs.asciidoctor.org/asciidoc/latest/attributes/element-attributes/#attribute-list. +;; +;; Even if that is not specified in https://docs.asciidoctor.org, +;; whitespaces at the end of the block attributes are silently ignored by Asciidoctor. (lang () ",[\t ]*\\(?1:[^],]+\\)") (optional-other-args () "\\(?:,[^]]+\\)?")) (outer-brackets-and-delimiter @@ -2078,7 +2083,7 @@ actual source code." (and (setq start-src (re-search-forward adoc-code-block-begin-regexp last noerror)) (setq lang (or (match-string 1) t) start-header (match-beginning 0)) - (setq end-block (re-search-forward (format "\n%s$" (match-string 2 + (setq end-block (re-search-forward (format "\n%s$" (regexp-quote (match-string 2))) nil t)) (setq end-src (match-beginning 0))) ) (when end-block @@ -2102,7 +2107,10 @@ Returns a cons (BEG . END) with the updated limits of the region." end-block) (when beg-block (goto-char (match-end 0)) - (setq end-block (or (re-search-forward (format "\n%s$" (match-string 2)) (+ (point) adoc-font-lock-extend-after-change-max) t) end)) + (setq end-block (or (re-search-forward (format "\n%s$" (regexp-quote (match-string 2))) + (+ (point) adoc-font-lock-extend-after-change-max) + t) + end)) (when (and end-block (> end-block beg)) ;; block reaches really into edited area (cons (min beg beg-block) (max end end-block
[nongnu] elpa/adoc-mode 2756c62d86 043/199: revert test2
branch: elpa/adoc-mode commit 2756c62d86ecae8d432ba4f2b61290dc38b15e98 Author: Florian Kaufmann Commit: Florian Kaufmann revert test2 --- adoc-mode-test.el | 6 - adoc-mode.el | 80 --- 2 files changed, 29 insertions(+), 57 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 2fb9279398..e94641a626 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -168,12 +168,6 @@ "lorem " 'no-face "xref" markup-command-face ":" markup-meta-face "foo" markup-internal-reference-face "[" markup-meta-face "bla bli bla blu" markup-reference-face "]" markup-meta-face "\n" nil - - "lorem " 'no-face "<<" markup-meta-hide-face "foo" markup-reference-face - ">>" markup-meta-hide-face "\n" nil - "lorem " 'no-face "<<" markup-meta-hide-face "foo" markup-internal-reference-face - "," markup-meta-hide-face "bla bli bla blu" markup-reference-face - ">>" markup-meta-hide-face "\n" nil )) (ert-deftest adoctest-test-images () diff --git a/adoc-mode.el b/adoc-mode.el index 86d948f453..bc9bd785f9 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -643,20 +643,20 @@ Subgroups: ((eq type 'biblio) "\\(\\[\\[\\)\\(\\[[a-zA-Z0-9_:][a-zA-Z0-9_:.-]*?\\]\\)\\(\\]\\]\\)") ((eq type 'inline-general) (adoc-re-inline-macro "anchor" -(defun adoc-re-attribute-list-elt (first) +(defun adoc-re-attribute-list-elt () "Returns a regexp matching an attribute list elment. Subgroups: 1 attribute name 2 attribute value if given as string 3 attribute value if not given as string" (concat - "\\=" (unless first ",") "[ \t\n]*" + ",?[ \t\n]*" "\\(?:\\([a-zA-Z_]+\\)[ \t\n]*=[ \t\n]*\\)?" ; 1 "\\(?:" ;; regexp for string: See 'Mastering Regular Expressions', chapter 'The ;; Real "Unrolling-the-Loop" Pattern'. "\"\\([^\"\\]*\\(?:.[^\"\\]*\\)*\\)\"[ \t\n]*" "\\|" ; 2 - "\\([^,]*\\)" ; 3 + "\\([^,]+\\)" ; 3 "\\)")) (defun adoc-re-precond (&optional unwanted-chars backslash-allowed disallowed-at-bol) @@ -730,14 +730,14 @@ subgroups: (concat ;; added &<> because those are special chars which are substituted by a ;; entity, which ends in ;, which is prohibited in the ascidoc.conf regexp - (adoc-re-quote-precondition "A-Za-z0-9_;:}&<>") + (adoc-re-quote-precondition "A-Za-z0-9;:}&<>") "\\(\\[[^][]+?\\]\\)?" "\\(" qldel "\\)" "\\([^ \t\n]\\|[^ \t\n].*?\\(?:\n.*?\\)\\{,1\\}?[^ \t\n]\\)" "\\(" qrdel "\\)" ;; BUG: now that Emacs doesn't has look-ahead, the match is too long, and ;; adjancted quotes of the same type wouldn't be recognized. - "\\(?:[^A-Za-z0-9_\n]\\|[ \t]*$\\)"))) + "\\(?:[^A-Za-z0-9\n]\\|[ \t]*$\\)"))) (defun adoc-re-quote (type ldel &optional rdel) (cond @@ -835,7 +835,7 @@ Subgroups: (style "[demshalv]")) (concat "\\(?:" fullspan "\\)?\\(?:" align "\\)?\\(?:" style "\\)?"))) -(defun adoc-kwf-std (end regexp &optional must-free-groups no-block-del-groups attrib-list-group) +(defun adoc-kwf-std (end regexp &optional must-free-groups no-block-del-groups) "Standart function for keywords Intendent to be called from font lock keyword functions. END is @@ -864,8 +864,6 @@ value." no-block-del-groups (when (and found prevented (<= (point) end)) (goto-char (1+ saved-point -(when (and found (not prevented) attrib-list-group) - (adoc-put-text-properies-on-attrib-list (match-beginning attrib-list-group) (match-end attrib-list-group))) (and found (not prevented (defun adoc-kwf-attriblist (end) @@ -1045,19 +1043,19 @@ When LITERAL-P is non-nil, the contained text is literal text." '(3 nil)) ; grumbl, I dont know how to get rid of it `(4 '(face ,(or del-face markup-meta-hide-face) adoc-reserved t) t))); close del -(defun adoc-kw-inline-macro (&optional cmd-name cmd-face target-faces target-meta-p attribute-list-spec) +(defun adoc-kw-inline-macro (&optional cmd-name cmd-face target-faces target-meta-p attribute-list) (list - `(lambda (end) (adoc-kwf-std end ,(adoc-re-inline-macro cmd-name) '(1 2 4 5) '(0) attribute-list-spec)) - `(1 '(face ,(or cmd-face markup-command-face) adoc-reserved t) t) ; cmd name - '(2 '(face markup-meta-face adoc-reserved t) t) ; : - `(3 ,(cond ((not target-faces) markup-meta-face) ; target + `(lambda (end) (adoc-kwf-std end ,(adoc-re-inline-macro cmd-name) '(1 2 4 5) '(0))) + `(1 '(face ,(or cmd-face markup-command-face) adoc-reserved t) t) + '(2 '(face markup-meta-face adoc-reserved t) t) ; : + `(3 ,(cond ((not target-faces) markup-meta-face) ((listp target-faces) `(if (string= (match-string 5) "") ,(car target-faces) ,(cadr target-faces)))
[nongnu] elpa/adoc-mode 9d4bb33fca 016/199: reworked lists items and adoc-align prefix, incl. tests,
branch: elpa/adoc-mode commit 9d4bb33fca8c6d85720a60f654d97086baf79be0 Author: Florian Kaufmann Commit: Florian Kaufmann reworked lists items and adoc-align prefix, incl. tests, --- adoc-mode-test.el | 36 ++- adoc-mode.el | 101 +++--- 2 files changed, 85 insertions(+), 52 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 41b85047ff..3212eb550c 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -130,5 +130,39 @@ "Lorem " nil "~" markup-meta-hide-face " ipsum " markup-subscript-face "~" markup-meta-hide-face " dolor\n" nil "Lorem " nil "^" markup-meta-hide-face " ipsum " markup-superscript-face "^" markup-meta-hide-face " dolor\n" nil)) -(ert-run-tests-interactively "^adoctest-test-") +(ert-deftest adoctest-test-lists-simple () + (adoctest-faces + " " adoc-align "-" markup-list-face " " adoc-align "uo list item\n" nil + " " adoc-align "*" markup-list-face " " adoc-align "uo list item\n" nil + " " adoc-align "**" markup-list-face " " adoc-align "uo list item\n" nil + " " adoc-align "***" markup-list-face " " adoc-align "uo list item\n" nil + " " adoc-align "" markup-list-face " " adoc-align "uo list item\n" nil + " " adoc-align "*" markup-list-face " " adoc-align "uo list item\n" nil + "+" markup-list-face " " adoc-align "uo list item\n" nil + + " " adoc-align "1." markup-list-face " " adoc-align "o list item\n" nil + " " adoc-align "a." markup-list-face " " adoc-align "o list item\n" nil + " " adoc-align "B." markup-list-face " " adoc-align "o list item\n" nil + " " adoc-align "ii)" markup-list-face " " adoc-align "o list item\n" nil + " " adoc-align "II)" markup-list-face " " adoc-align "o list item\n" nil + + " " adoc-align "." markup-list-face " " adoc-align "implicitly numbered list item\n" nil + " " adoc-align ".." markup-list-face " " adoc-align "implicitly numbered list item\n" nil + " " adoc-align "..." markup-list-face " " adoc-align "implicitly numbered list item\n" nil + " " adoc-align "" markup-list-face " " adoc-align "implicitly numbered list item\n" nil + " " adoc-align "." markup-list-face " " adoc-align "implicitly numbered list item\n" nil + "<1>" markup-list-face " " adoc-align "callout\n" nil + "1>" markup-list-face " " adoc-align "callout\n" nil + " " adoc-align "term" markup-gen-face "::" markup-list-face " " adoc-align "lorem ipsum\n" nil + " " adoc-align "term" markup-gen-face ";;" markup-list-face " " adoc-align "lorem ipsum\n" nil + " " adoc-align "term" markup-gen-face ":::" markup-list-face " " adoc-align "lorem ipsum\n" nil + " " adoc-align "term" markup-gen-face "" markup-list-face " " adoc-align "lorem ipsum\n" nil + " " adoc-align "question" markup-gen-face "??" markup-list-face "\n" nil + "glossary" markup-gen-face ":-" markup-list-face "\n" nil + + "-" markup-list-face " " adoc-align "uo list item\n" nil + "+" markup-meta-face "\n" nil + "2nd list paragraph\n" nil )) + +(ert-run-tests-interactively "^adoctest-test-") diff --git a/adoc-mode.el b/adoc-mode.el index 37bf3b4171..ee59b3c38d 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -322,7 +322,6 @@ aligned. (defvar adoc-subscript 'markup-subscript-face) (defvar adoc-replacement 'markup-replacement-face) (defvar adoc-complex-replacement 'markup-complex-replacement-face) -(defvar adoc-list-item 'markup-list-face) (defvar adoc-table-del 'markup-table-face) (defvar adoc-reference 'markup-reference-face) (defvar adoc-secondary-text 'markup-secondary-text-face) @@ -438,7 +437,7 @@ match-data has his this sub groups: match-data his this sub groups: 1 leading whites 2 delimiter -3 trailing white between delimiter and item's text +3 trailing whites between delimiter and item's text 0 only chars belonging to delimiter/whites. I.e. none of text. WARNING: See warning about list item nesting level in `adoc-list-descriptor'." @@ -455,7 +454,7 @@ WARNING: See warning about list item nesting level in `adoc-list-descriptor'." (let ((r (cond ((numberp level) (if (eq level 0) "-" (make-string level ?\*))) ((or (null level) (eq level 'adoc-all-levels)) "-\\|\\*\\{1,5\\}") (t (error "adoc-unordered/adoc-normal: invalid level") -(concat "^\\([ \t]*\\)\\(" r "\\)\\([ \t]\\)"))) +(concat "^\\([ \t]*\\)\\(" r "\\)\\([ \t]+\\)"))) ((and (eq sub-type 'adoc-bibliography) (null level)) "^\\(\\)\\(\\+\\)\\([ \t]+\\)") (t (error "adoc-unordered: invalid sub-type/level combination" @@ -471,7 +470,7 @@ WARNING: See warning about list item nesting level in `adoc-list-descriptor'." (r (cond ((numberp sub-type) (nth sub-type l)) ((or (null sub-type) (eq sub-type 'adoc-all-subtypes)) (mapconcat 'identity l "\\|")) (t (error "adoc-explicitly-numbered: invalid subtype") - (concat "^\\(
[nongnu] elpa/adoc-mode be65a78a00 092/199: bumped version to 0.6.3
branch: elpa/adoc-mode commit be65a78a00392c6874a768f496f8729b28d93a30 Author: sensorflo Commit: sensorflo bumped version to 0.6.3 --- adoc-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 5d05c16011..632f68abac 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -5,7 +5,7 @@ ;; Author: Florian Kaufmann ;; URL: https://github.com/sensorflo/adoc-mode/wiki ;; Created: 2009 -;; Version: 0.6.2 +;; Version: 0.6.3 ;; Package-Requires: ((markup-faces "1.0.0")) ;; Keywords: wp AsciiDoc ;; @@ -178,7 +178,7 @@ ;; tempo or tempo-snippet is required later below -(defconst adoc-mode-version "0.6.2" +(defconst adoc-mode-version "0.6.3" "adoc mode version number. Based upon AsciiDoc version 8.5.2. I.e. regexeps and rules are
[nongnu] elpa/adoc-mode 56cfbecca2 002/199: added adoc-enable-two-line-title
branch: elpa/adoc-mode commit 56cfbecca2f8afa66df1430f82689a567e2ccebc Author: Florian Kaufmann Commit: Florian Kaufmann added adoc-enable-two-line-title --- adoc-mode.el | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 689ac77553..0e3d986987 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -195,6 +195,24 @@ configuration file." "Default title sub type, see `adoc-title-descriptor'." :group 'adoc ) +(defcustom adoc-enable-two-line-title t + "Wether or not two line titles shall be fontified. + +nil means never fontify. t means always fontify. A number means +only fontify if the line below has NOT the lenght of the given +number. You could use a number for example when all your +delimited block lines have a certain length. + +This is usefull because adoc-mode has troubles to properly +distinguish between two line titles and a line of text before a +delimited block. Note however that adoc-mode knows the AsciiDoc +rule that the length of a two line title underline can differ at +most 3 chars from the length of the title text." + :type '(choice (const nil) +(const t) +number) + :group 'adoc) + (defface adoc-orig-default '((t (:inherit (default "The default face before buffer-face-mode was in effect. @@ -915,8 +933,11 @@ subgroups: `(list ;; matcher function (lambda (end) - (and (re-search-forward ,(adoc-re-two-line-title del) end t) - (< (abs (- (length (match-string 1)) (length (match-string 2 3) + (and adoc-enable-two-line-title + (re-search-forward ,(adoc-re-two-line-title del) end t) + (< (abs (- (length (match-string 1)) (length (match-string 2 3) + (or (not (numberp adoc-enable-two-line-title)) + (not (equal adoc-enable-two-line-title (length (match-string 2) (not (text-property-not-all (match-beginning 0) (match-end 0) 'adoc-reserved nil ;; highlighers '(1 ,text-face t)
[nongnu] elpa/adoc-mode 69e44f37ac 049/199: changed default of adoc-insert-replacement to nil
branch: elpa/adoc-mode commit 69e44f37ac473f38c9da2935f7d30d7f704c25d0 Author: Florian Kaufmann Commit: Florian Kaufmann changed default of adoc-insert-replacement to nil --- adoc-mode.el | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index de919a0666..d9c48ed027 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -137,8 +137,11 @@ You need to call `adoc-calc' after a change." (float :tag "Superscript")) :group 'adoc) -(defcustom adoc-insert-replacement t - "When true the character/string a replacment/entity stands for is displayed. +;; Interacts very badly with minor-modes using overlays because +;; adoc-unfontify-region-function removes ALL overlays, not only those which +;; where insered by adoc-mode. +(defcustom adoc-insert-replacement nil + "When non-nil the character/string a replacment/entity stands for is displayed. E.g. after '&' an '&' is displayed, after '(C)' the copy right sign is displayed. It's only about display, neither the file nor @@ -146,8 +149,11 @@ the buffer content is affected. You need to call `adoc-calc' after you change `adoc-insert-replacement'. For named character entities (e.g. -'&', in contrast to '' or '(C)' ) to be displayed you need to -set `adoc-unichar-name-resolver'." +'&', in contrast to '' or '(C)' ) to be displayed you +need to set `adoc-unichar-name-resolver'. + +Setting it to non-nil interacts very badly with minor-modes using +overlays." :type 'boolean :group 'adoc)
[nongnu] elpa/adoc-mode 9bea822e07 136/199: Add license badge
branch: elpa/adoc-mode commit 9bea822e078da966b127589b932cee3f0deefa68 Author: Bozhidar Batsov Commit: Bozhidar Batsov Add license badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 82e650c062..db478dcc2a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ [](https://github.com/emacsorphanage/adoc-mode/actions?query=workflow%3ACI) [![MELPA][melpa-badge]][melpa-package] [![MELPA Stable][melpa-stable-badge]][melpa-stable-package] +[![License GPL 3][badge-license]][copying] # adoc-mode @@ -163,3 +164,4 @@ Distributed under the GNU General Public License; type C-h C-c to vie [melpa-stable-package]: http://stable.melpa.org/#/adoc-mode [melpa]: http://melpa.org [melpa stable]: http://stable.melpa.org +[copying]: http://www.gnu.org/copyleft/gpl.html
[nongnu] elpa/adoc-mode 5421059e54 015/199: small change in regexp for unconstrained quote
branch: elpa/adoc-mode commit 5421059e545a390993311bfbb40fb35c877e8269 Author: Florian Kaufmann Commit: Florian Kaufmann small change in regexp for unconstrained quote AsciiDoc's internal regexp has changed --- adoc-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 0b73af46d9..37bf3b4171 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -623,7 +623,7 @@ NOT-ALLOWED-CHARS are chars not allowed before the quote." ;; # Non-word (\W) characters are allowed at boundaries to accommodate ;; # enveloping quotes. ;; -;; reo = re.compile(r'(?msu)(^|[^\w;:])(\[(?P[^[\]]+?)\])?' \ +;; reo = re.compile(r'(?msu)(^|[^\w;:}])(\[(?P[^[\]]+?)\])?' \ ;; + r'(?:' + re.escape(lq) + r')' \ ;; + r'(?P\S|\S.*?\S)(?:'+re.escape(rq)+r')(?=\W|$)') (defun adoc-re-constrained-quote (ldel &optional rdel) @@ -639,7 +639,7 @@ subgroups: (concat ;; added &<> because those are special chars which are substituted by a ;; entity, which ends in ;, which is prohibited in the ascidoc.conf regexp - (adoc-re-quote-precondition "A-Za-z0-9;:&<>") + (adoc-re-quote-precondition "A-Za-z0-9;:}&<>") "\\(\\[[^][]+?\\]\\)?" "\\(" qldel "\\)" "\\([^ \t\n]\\|[^ \t\n].*?\\(?:\n.*?\\)\\{,1\\}?[^ \t\n]\\)"
[nongnu] elpa/adoc-mode 625388ac44 010/199: improved superscript/subsctipt unfontify
branch: elpa/adoc-mode commit 625388ac449418925b0f74c9b55753096e6390e2 Author: Florian Kaufmann Commit: Florian Kaufmann improved superscript/subsctipt unfontify now does it almost like latex-mode. --- adoc-mode.el | 35 ++- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index c2dc8985f1..53f77eabe9 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -125,7 +125,9 @@ This is a list of two floats. The first is negative and specifies how much subscript is lowered, the second is positive and specifies how much superscript is raised. Heights are measured relative to that of the normal text. The faces used are -adoc-superscript and adoc-subscript respectively." +adoc-superscript and adoc-subscript respectively. + +You need to call `adoc-calc' after a change." :type '(list (float :tag "Subscript") (float :tag "Superscript")) :group 'adoc) @@ -752,10 +754,16 @@ value." (and found (not prevented (defun adoc-facespec-subscript () - `(face adoc-subscript display (raise ,(nth 0 adoc-script-raise + (list 'quote + (append '(face markup-subscript-face) + (when (not (= 0 (car adoc-script-raise))) + `(display (raise ,(car adoc-script-raise))) (defun adoc-facespec-superscript () - `(face adoc-superscript display (raise ,(nth 1 adoc-script-raise + (list 'quote + (append '(face markup-superscript-face) + (when (not (= 0 (car adoc-script-raise))) + `(display (raise ,(cadr adoc-script-raise))) ;; adoc-lexxer will set these faces when it finds a match. The numbers are the ;; regexp group numbers of the match. @@ -1007,9 +1015,26 @@ When LITERAL-P is non-nil, the contained text is literal text." '(1 '(face adoc-replacement adoc-reserved t) t (defun adoc-unfontify-region-function (beg end) + ;; + (font-lock-default-unfontify-region beg end) + + ;; remove overlays. Currently only used by AsciiDoc replacements + ;; todo: this is an extremly brute force solution and interacts very badly + ;; with many (minor) modes using overlays such as flyspell or ediff (when adoc-insert-replacement (remove-overlays beg end)) - (font-lock-default-unfontify-region beg end)) + + ;; text properties. Currently only display raise used for sub/superscripts. + ;; code snipped copied from tex-mode + (when (not (and (= 0 (car adoc-script-raise)) (= 0 (cadr adoc-script-raise +(while (< beg end) + (let ((next (next-single-property-change beg 'display nil end)) + (prop (get-text-property beg 'display))) + (if (and (eq (car-safe prop) 'raise) +(member (car-safe (cdr prop)) adoc-script-raise) +(null (cddr prop))) + (put-text-property beg next 'display nil)) + (setq beg next) (defun adoc-font-lock-mark-block-function () (mark-paragraph 2) @@ -1801,7 +1826,7 @@ Turning on Adoc mode runs the normal hook `adoc-mode-hook'." (font-lock-multiline . t) (font-lock-mark-block-function . adoc-font-lock-mark-block-function))) (make-local-variable 'font-lock-extra-managed-props) - (setq font-lock-extra-managed-props (list 'display 'adoc-reserved)) + (setq font-lock-extra-managed-props '(adoc-reserved)) (make-local-variable 'font-lock-unfontify-region-function) (setq font-lock-unfontify-region-function 'adoc-unfontify-region-function)
[nongnu] elpa/adoc-mode 6dc82593f0 162/199: Document the mode's history
branch: elpa/adoc-mode commit 6dc82593f05377a78083ee3f050a159f25a600b1 Author: Bozhidar Batsov Commit: Bozhidar Batsov Document the mode's history --- README.adoc | 10 +- adoc-mode.el | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index 9c4f559f0f..53e695be27 100644 --- a/README.adoc +++ b/README.adoc @@ -179,9 +179,17 @@ To check for byte-compilation warnings you can just compile the project with Eld $ eldev compile +== History + +`adoc-mode` was created by https://github.com/sensorflo/[Florian Kaufmann] in 2009. Eventually the development +was halted in 2016 and the mode was dormant for the next 6 years. In 2016 +https://github.com/TobiasZawada[Tobias Zawada] encouraged the Emacs community to revive the development and after a brief period under the https://github.com/emacsorphanage[Emacs Orphanage] org, https://github.com/bbatsov/[Bozhidar Batsov] assumed the project's maintenance. + +These days all upstream packages (e.g. on MELPA) are build from Bozhidar's fork. + == License -Copyright © 2010-2013 Florian Kaufmann +Copyright © 2009-2016 Florian Kaufmann Copyright © 2022 Bozhidar Batsov and `adoc-mode` contributors Distributed under the link:{copying}[GNU General Public License]; type kbd:[C-h] kbd:[C-c] to view it. diff --git a/adoc-mode.el b/adoc-mode.el index 01fe296633..54762fd289 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1,6 +1,6 @@ ;;; adoc-mode.el --- a major-mode for editing AsciiDoc files in Emacs ;; -;; Copyright 2009-2014 Florian Kaufmann +;; Copyright 2009-2016 Florian Kaufmann ;; Copyright 2022 Bozhidar Batsov and adoc-mode contributors ;; ;; Author: Florian Kaufmann
[nongnu] elpa/adoc-mode 4b6054b5c8 079/199: added adoc-insert-indented
branch: elpa/adoc-mode commit 4b6054b5c8f934f19b84b0f2467cfbadaf643d3e Author: Florian Kaufmann Commit: Florian Kaufmann added adoc-insert-indented --- adoc-mode-test.el | 11 +++ adoc-mode.el | 5 + 2 files changed, 16 insertions(+) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index d6c8f7a701..8ad4079fdd 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -756,6 +756,17 @@ removed before TRANSFORM is evaluated. (should (equal (adoc-repeat-string "lorem" 1) "lorem")) (should (equal (adoc-repeat-string "lorem" 2) "loremlorem"))) +(ert-deftest adoctest-test-indent-by-example () + (let ((tab-width 2) + (indent-tabs-mode nil)) +(adoctest-trans "" " x" '(adoc-insert-indented "x" 1)) +(adoctest-trans "" " x" '(adoc-insert-indented "x" 2))) + + (let ((tab-width 3) + (indent-tabs-mode t)) +(adoctest-trans "" " x" '(adoc-insert-indented "x" 1)) +(adoctest-trans "" "\t x" '(adoc-insert-indented "x" 2 + ;; purpose ;; - ensure that the latest version, i.e. the one currently in buffer(s), of ;; adoc-mode and adoc-mode-test is used for the test diff --git a/adoc-mode.el b/adoc-mode.el index d65d964faa..7ab3e21186 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -2467,6 +2467,11 @@ Is influenced by customization variables such as `adoc-title-style'." misc +(defun adoc-insert-indented (str indent-level) + "Indents and inserts STR such that point is at INDENT-LEVEL." + (indent-to (- (* tab-width indent-level) (length str))) + (insert str)) + (defun adoc-repeat-string (str n) "Returns str n times concatenated" (let ((retval ""))
[nongnu] elpa/adoc-mode 6ccb9d6de5 009/199: intermediate checkin - to be removed
branch: elpa/adoc-mode commit 6ccb9d6de5bb05dcc46aafac2d00f9783deb5b2b Author: Florian Kaufmann Commit: Florian Kaufmann intermediate checkin - to be removed --- TAGS | 124 ++ adoc-mode-test.el | 17 ++-- adoc-mode.el | 115 -- 3 files changed, 192 insertions(+), 64 deletions(-) diff --git a/TAGS b/TAGS new file mode 100644 index 00..c81d7fa062 --- /dev/null +++ b/TAGS @@ -0,0 +1,124 @@ + +adoc-mode.el,5334 +(defconst adoc-mode-version 113,4643 +(defgroup adoc 117,4796 +(defcustom adoc-script-raise 121,4866 +(defcustom adoc-insert-replacement 133,5368 +(defcustom adoc-unichar-name-resolver 147,5898 +(defcustom adoc-two-line-title-del 167,6780 +(defcustom adoc-delimited-block-del180,7251 +(defcustom adoc-default-title-type 248,9581 +(defcustom adoc-default-title-sub-type 253,9725 +(defcustom adoc-enable-two-line-title 257,9842 +(define-obsolete-face-alias 'adoc-orig-default adoc-orig-default275,10537 +(defface adoc-align276,10604 +(define-obsolete-face-alias 'adoc-generic adoc-generic291,11076 +(define-obsolete-face-alias 'adoc-monospace adoc-monospace292,11143 +(define-obsolete-face-alias 'adoc-strong adoc-strong293,11219 +(define-obsolete-face-alias 'adoc-emphasis adoc-emphasis294,11288 +(define-obsolete-face-alias 'adoc-superscript adoc-superscript295,11361 +(define-obsolete-face-alias 'adoc-subscript adoc-subscript296,11440 +(define-obsolete-face-alias 'adoc-secondary-text adoc-secondary-text297,11515 +(define-obsolete-face-alias 'adoc-replacement adoc-replacement298,11600 +(define-obsolete-face-alias 'adoc-complex-replacement adoc-complex-replacement299,11679 +(define-obsolete-face-alias 'adoc-list-item adoc-list-item300,11774 +(define-obsolete-face-alias 'adoc-table-del adoc-table-del301,11844 +(define-obsolete-face-alias 'adoc-reference adoc-reference302,11915 +(define-obsolete-face-alias 'adoc-delimiter adoc-delimiter303,11990 +(define-obsolete-face-alias 'adoc-hide-delimiter adoc-hide-delimiter304,12060 +(define-obsolete-face-alias 'adoc-anchor adoc-anchor305,12145 +(define-obsolete-face-alias 'adoc-comment adoc-comment306,12214 +(define-obsolete-face-alias 'adoc-warning adoc-warning307,12285 +(define-obsolete-face-alias 'adoc-preprocessor adoc-preprocessor308,12354 +(defvar adoc-align 314,12696 +(defvar adoc-generic 315,12728 +(defvar adoc-monospace 316,12767 +(defvar adoc-strong 317,12815 +(defvar adoc-emphasis 318,12856 +(defvar adoc-superscript 319,12901 +(defvar adoc-subscript 320,12952 +(defvar adoc-replacement 321,12999 +(defvar adoc-complex-replacement 322,13050 +(defvar adoc-list-item 323,13117 +(defvar adoc-table-del 324,13159 +(defvar adoc-reference 325,13202 +(defvar adoc-secondary-text 326,13249 +(defvar adoc-delimiter 327,13306 +(defvar adoc-hide-delimiter 328,13348 +(defvar adoc-anchor 329,13400 +(defvar adoc-comment 330,13441 +(defvar adoc-warning 331,13484 +(defvar adoc-preprocessor 332,13525 +(defconst adoc-title-max-level 334,13579 +(defconst adoc-uolist-max-level 337,13657 +(defconst adoc-summarize-re-uolisti 342,13913 +(defconst adoc-summarize-re-olisti 346,14113 +(defconst adoc-summarize-re-llisti 349,14216 +(defvar adoc-unichar-alist 352,14319 +(defvar adoc-mode-hook 355,14421 +(defvar adoc-mode-abbrev-table 358,14500 +(defvar adoc-font-lock-keywords 361,14583 +(defvar adoc-replacement-failed 364,14666 +(define-abbrev-table 'adoc-mode-abbrev-table adoc-mode-abbrev-table366,14705 +(defun adoc-re-attribute-entry 372,14865 +(defun adoc-re-one-line-title 377,15031 +(defun adoc-make-one-line-title 394,15657 +(defun adoc-re-two-line-title 401,15987 +(defun adoc-make-two-line-title 420,16705 +(defun adoc-re-oulisti 433,17254 +(defun adoc-make-uolisti 491,20083 +(defun adoc-re-llisti 508,20940 +(defun adoc-re-delimited-block-line 528,21624 +(defun adoc-re-delimited-block 537,21801 +(defun adoc-re-verbatim-paragraph-sequence 547,22132 +(defun adoc-re-precond 569,22965 +(defun adoc-re-quote-precondition 581,23314 +(defun adoc-re-unconstrained-quote 608,24257 +(defun adoc-re-constrained-quote 627,24977 +(defun adoc-re-quote 649,25778 +(defun adoc-re-paragraph-separate 659,26068 +(defun adoc-re-paragraph-start 684,26561 +(defun adoc-re-aor(713,27183 +(defun adoc-re-ror(717,27311 +(defun adoc-re-cell-specifier 722,27566 +(defun adoc-kwf-std 728,27828 +(defun adoc-facespec-subscript 752,28763 +(defun adoc-facespec-superscript 755,28867 +(defvar adoc-lex-face-1 760,29092 +(defvar adoc-lex-face-2 761,29128 +(defvar adoc-lex-face-3 762,29164 +(defvar adoc-lex-face-4 763,29200 +(defvar adoc-lex-face-5 764,29236 +(defvar adoc-lex-face-6 765,29272 +(defvar adoc-lexems 767,29309 +(defun adoc-lexxer 811,32067 +(defun adoc-kw-one-line-title 846,33688 +(defun adoc-kw-two-line-title 860,34315 +(defmacro adoc-kw-oulisti 875,34984 +(defmacro adoc-kw
[nongnu] elpa/adoc-mode a16699bffe 050/199: test: adapted to new ert
branch: elpa/adoc-mode commit a16699bffead29d67444f0b19f134c12f41f3e2f Author: Florian Kaufmann Commit: Florian Kaufmann test: adapted to new ert --- adoc-mode-test.el | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 7e1cdbc5d6..b4eb21fc8d 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -37,11 +37,11 @@ (cond ((null tmp)) ; nop ((eq tmp 'no-face) - (ert-should (null tmp2))) + (should (null tmp2))) (t (if (and (listp tmp2) (not (listp tmp))) - (ert-should (and (= 1 (length tmp2)) (equal tmp (car tmp2 - (ert-should (equal tmp tmp2) + (should (and (= 1 (length tmp2)) (equal tmp (car tmp2 + (should (equal tmp tmp2) (if (< (point) (point-max)) (forward-char 1) (setq not-done nil) @@ -447,10 +447,10 @@ (ert-deftest adoctest-pre-test-byte-compile () ;; todo: also test for warnings - (ert-should (byte-compile-file (locate-library "adoc-mode.el" t))) - (ert-should (load "adoc-mode.el" nil nil t)) - (ert-should (byte-compile-file (locate-library "adoc-mode-test.el" t))) - (ert-should (load "adoc-mode-test.el" nil nil t))) + (should (byte-compile-file (locate-library "adoc-mode.el" t))) + (should (load "adoc-mode.el" nil nil t)) + (should (byte-compile-file (locate-library "adoc-mode-test.el" t))) + (should (load "adoc-mode-test.el" nil nil t))) (defun adoc-test-run() (interactive)
[nongnu] elpa/adoc-mode 4ded97193c 178/199: Implement fontification of source blocks (#21)
branch: elpa/adoc-mode commit 4ded97193ca8b1ae30d05d0c37b4dfe47059a4d4 Author: TobiasZawada Commit: GitHub Implement fontification of source blocks (#21) The method is adapted from Org and consists of the following steps: 1. Create temp buffer 2. copy source code there 3. apply font-lock in the temp buffer 4. transfer text properties back to the adoc buffer --- README.adoc| 8 ++ adoc-mode.el | 314 ++--- test/adoc-mode-test.el | 45 +++ 3 files changed, 327 insertions(+), 40 deletions(-) diff --git a/README.adoc b/README.adoc index 999769e6c3..71fb83755d 100644 --- a/README.adoc +++ b/README.adoc @@ -34,6 +34,7 @@ be easily ignored. Here are some of the main features of `adoc-mode`: - sophisticated highlighting +- native fontification of code blocks - promote / demote title - toggle title type between one line title and two line title - adjust underline length of a two line title to match title text's length @@ -97,6 +98,13 @@ or if you're into `use-package`: `buffer-face-mode` is for you: `(add-hook 'adoc-mode-hook (lambda() (buffer-face-mode t)))` +* Settings regarding native fontification of source blocks: +** Native fontification of source blocks can be switched off by setting `adoc-fontify-code-blocks-natively` to `nil`. +** Native fontification of lengthy code blocks can cause performance problems. If the value of `adoc-fontify-code-blocks-natively` is an integer only those code blocks are fontified natively whose length is less or equal to that value. +** To avoid performance problems with code block beginnings that do not have a matching end yet the scanning for the code block end is delimited by `adoc-font-lock-extend-after-change-max`. +** All programming languages `XYZ` that have an Emacs major mode `XYZ-mode` and use `font-lock` are automatically supported. Some other languages not fitting into that name scheme are supported through the alist `adoc-code-lang-modes`. You can add your own languages and modes there if they work based on `font-lock` and are not automatically supported. +** The fall-back language mode is `prog-mode` without any fontification. You can set your own default by `adoc-fontify-code-block-default-mode`. + === Syntax Highlighting Customization It is possible to customize the way `adoc-mode` renders different text diff --git a/adoc-mode.el b/adoc-mode.el index df2c9d66d5..7734433876 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -7,7 +7,7 @@ ;; URL: https://github.com/bbatsov/adoc-mode ;; Maintainer: Bozhidar Batsov ;; Created: 2009 -;; Version: 0.7.0 +;; Version: 0.8.0-snapshot ;; Package-Requires: ((emacs "26")) ;; Keywords: docs, wp ;; @@ -45,8 +45,8 @@ (require 'cl-lib) (require 'tempo) -(defconst adoc-mode-version "0.7.0" - "Adoc-mode version number. +(defconst adoc-mode-version "0.8.0-snapshot" + "adoc mode version number. Based upon AsciiDoc version 8.5.2. I.e. regexeps and rules are taken from that version's asciidoc.conf / manual.") @@ -55,7 +55,7 @@ taken from that version's asciidoc.conf / manual.") (defgroup adoc nil "Support for editing AsciiDoc files in GNU Emacs." :group 'text :prefix "adoc-" - :version "0.7.0" + :version "0.8.0" :link '(url-link "https://github.com/bbatsov/adoc-mode";)) (defcustom adoc-script-raise '(-0.3 0.3) @@ -78,13 +78,13 @@ You need to call `adoc-calc' after a change." (defcustom adoc-insert-replacement nil "When non-nil the character/string a replacement/entity stands for is displayed. -E.g. after '&' an '&' is displayed, after '(C)' the copy right -sign is displayed. It's only about display, neither the file nor +E.g. after \\='&\\=' an \\='&\\=' is displayed, after \\='(C)\\=' the copy right +sign is displayed. It is only about display, neither the file nor the buffer content is affected. You need to call `adoc-calc' after you change `adoc-insert-replacement'. For named character entities (e.g. -'&', in contrast to '' or '(C)' ) to be displayed you +\\='&\\=', in contrast to \\='\\=' or \\='(C)\\=' ) to be displayed you need to set `adoc-unichar-name-resolver'. Setting it to non-nil interacts very badly with minor-modes using @@ -238,6 +238,70 @@ See for example `tempo-template-adoc-title-1'." (const :tag "tempo-snippets" tempo-snippets)) :group 'adoc) +(defcustom adoc-fontify-code-blocks-natively 5000 + "When non-nil, fontify code in code blocks using the native major mode. +This only works for code blocks where the language is +specified where we can automatically determine the appropriate +mode to use. The language to mode mapping may be customized by +setting the variable `adoc-code-lang-modes'. + +The value can be a number that determines the size +up to which code blocks are fontified natively. +If the value is another non-nil value then code blocks +are fontified natively regardless of their size." + :group '
[nongnu] elpa/adoc-mode af7cd59e1b 013/199: added first-whites-fixed-width
branch: elpa/adoc-mode commit af7cd59e1babd04bff7f06d898c0335dc7893f69 Author: Florian Kaufmann Commit: Florian Kaufmann added first-whites-fixed-width --- adoc-mode.el | 29 + 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 15d18bf238..0b73af46d9 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1014,6 +1014,26 @@ When LITERAL-P is non-nil, the contained text is literal text." '(1 '(face adoc-hide-delimiter adoc-reserved t) t) '(1 '(face adoc-replacement adoc-reserved t) t +;; - To ensure that indented lines are nicely aligned. They only look aligned if +;; the whites at line beginning have a fixed with font. +;; - Some faces have properties which are also visbile on whites +;; (underlines/backgroundcolor/...), for example links typically gave +;; underlines. If now a link in an indented paragraph (e.g. because its a list +;; item), spawns multiple lines, then without countermeasures the blanks at +;; line beginning would also be underlined, which looks akward. +(defun adoc-flf-first-whites-fixed-width(end) + (and (re-search-forward "\\(^[ \t]+\\)" end t) + ;; dont replace adoc-monospace with adoc-orig-default because that is + ;; already a fixed with font, and the semantic context might expext + ;; that the blanks have equal widht as the context + (text-property-not-all (match-beginning 0) (match-end 0) 'face 'adoc-monospace))) + +;; See adoc-flf-first-whites-fixed-width +(defun adoc-kw-first-whites-fixed-width () + (list + 'adoc-flf-first-whites-fixed-width + '(1 adoc-orig-default t))) + (defun adoc-unfontify-region-function (beg end) ;; (font-lock-default-unfontify-region beg end) @@ -1512,14 +1532,7 @@ When LITERAL-P is non-nil, the contained text is literal text." '(1 adoc-secondary-text t)) (list "\\[[^]\n]*?\\(?:id\\)=\"\\([^\"\n]*?\\)\"[^]\n]*?\\]" '(1 adoc-anchor t)) - ;; - If e.g. in a list item a reference/link continues over new line, then - ;; the following prevents the trailing whites from having underlines (that - ;; is adoc-reference face) - ;; - It also aligns better if the other text is variable pitch - ;; BUG: should not be applyied in literal paragraphs (because there typically - ;; the surrounding font has another pitch) - ;; (list "\\([ \t]*\n\\)" '(1 adoc-text t)) - (list "\\(^[ \t]+\\)" '(1 adoc-align t)) + (adoc-kw-first-whites-fixed-width) ;; -- warnings ;; todo: add tooltip explaining what is the warning all about
[nongnu] elpa/adoc-mode c117d58b4b 119/199: Merge pull request #1 from lukesanantonio/master
branch: elpa/adoc-mode commit c117d58b4b70f4078dcb53a0a9828754345ff41a Merge: 745884359a 2682662c96 Author: TobiasZawada Commit: GitHub Merge pull request #1 from lukesanantonio/master Use mode-* to set var require-final-newline --- adoc-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index 87e9650664..ba160e349f 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -3016,7 +3016,7 @@ Turning on Adoc mode runs the normal hook `adoc-mode-hook'." ;; misc (set (make-local-variable 'page-delimiter) "^<<<+$") - (set (make-local-variable 'require-final-newline) t) + (set (make-local-variable 'require-final-newline) mode-require-final-newline) (set (make-local-variable 'parse-sexp-lookup-properties) t) ;; it's the user's decision whether he wants to set imenu-sort-function to
[nongnu] elpa/adoc-mode 9753b42821 065/199: bumped version to V0.5.0
branch: elpa/adoc-mode commit 9753b42821c733ef03170a50d8d8d0651cb670e0 Author: Florian Kaufmann Commit: Florian Kaufmann bumped version to V0.5.0 --- adoc-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 1ead15397e..da492d36f2 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -6,7 +6,7 @@ ;; URL: Current official: http://code.google.com/p/adoc-mode/ ;; Develop, future official: https://github.com/sensorflo/adoc-mode ;; Created: 2009 -;; Version: 0.4.0 +;; Version: 0.5.0 ;; Keywords: wp AsciiDoc ;; ;; This file is not part of GNU Emacs. @@ -112,7 +112,7 @@ (require 'markup-faces) ; https://github.com/sensorflo/markup-faces (require 'cl) ; I know, I should remove it, I will, eventually -(defconst adoc-mode-version "0.4.0" +(defconst adoc-mode-version "0.5.0" "Based upon AsciiDoc version 8.5.2. I.e. regexeps and rules are taken from that version's asciidoc.conf/manual.
[nongnu] elpa/adoc-mode ab42f4909a 107/199: (un)constrained quotes can now spawn more than two lines
branch: elpa/adoc-mode commit ab42f4909a769f3c021813b2970322d7869f54dd Author: sensorflo Commit: sensorflo (un)constrained quotes can now spawn more than two lines --- adoc-mode-test.el | 16 +++- adoc-mode.el | 26 -- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 836a5eeeae..7eb6371754 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -449,11 +449,17 @@ removed before TRANSFORM is evaluated. (ert-deftest adoctest-test-quotes-medium () (adoctest-faces "test-quotes-medium" ;; test wheter constrained/unconstrained quotes can spawn multiple lines - "Lorem " 'no-face "*" markup-meta-hide-face "ipsum" markup-strong-face "\n" nil - "dolor" markup-strong-face "*" markup-meta-hide-face " sit" 'no-face "\n" nil - "Lorem " 'no-face "__" markup-meta-hide-face "ipsum" markup-emphasis-face "\n" nil - "dolor" markup-emphasis-face "__" markup-meta-hide-face " sit" 'no-face "\n" nil - "\n" nil + "Lorem " 'no-face "*" markup-meta-hide-face "ipsum" markup-strong-face + "\n" nil "dolor" markup-strong-face "\n" nil "dolor" markup-strong-face + "\n" nil "dolor" markup-strong-face "\n" nil "dolor" markup-strong-face + "*" markup-meta-hide-face + " sit" 'no-face "\n" nil + + "Lorem " 'no-face "__" markup-meta-hide-face "ipsum" markup-emphasis-face + "\n" nil "dolor" markup-emphasis-face "\n" nil "dolor" markup-emphasis-face + "\n" nil "dolor" markup-emphasis-face "\n" nil "dolor" markup-emphasis-face + "__" markup-meta-hide-face + " sit" 'no-face "\n" nil ;; tests border case that delimiter is at the beginnin/end of an paragraph/line ;; constrained at beginning diff --git a/adoc-mode.el b/adoc-mode.el index 36b140157b..0ec9216885 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1122,7 +1122,7 @@ NOT-ALLOWED-CHARS are chars not allowed before the quote." (adoc-re-quote-precondition "") "\\(\\[[^][]+?\\]\\)?" "\\(" qldel "\\)" - "\\(.+?\\(?:\n.*?\\)\\{,1\\}?\\)" + "\\(" (adoc-re-content "+") "\\)" "\\(" qrdel "\\)"))) ;; AsciiDoc src for constrained quotes @@ -1149,7 +1149,7 @@ subgroups: (adoc-re-quote-precondition "A-Za-z0-9;:}&<>") "\\(\\[[^][]+?\\]\\)?" "\\(" qldel "\\)" - "\\([^ \t\n]\\|[^ \t\n].*?\\(?:\n.*?\\)\\{,1\\}?[^ \t\n]\\)" + "\\([^ \t\n]\\|[^ \t\n]" (adoc-re-content) "[^ \t\n]\\)" "\\(" qrdel "\\)" ;; BUG: now that Emacs doesn't has look-ahead, the match is too long, and ;; adjancted quotes of the same type wouldn't be recognized. @@ -1273,6 +1273,28 @@ Subgroups of returned regexp: (style "[demshalv]")) (concat "\\(?:" fullspan "\\)?\\(?:" align "\\)?\\(?:" style "\\)?"))) +;; bug: if qualifier is "+", and the thing to match starts at the end of a +;; line (i.e. the first char is newline), then wrongly this regexp does +;; never match. +;; Note: asciidoc uses Python's \s to determine blank lines, while _not_ +;; setting either the LOCALE or UNICODE flag, see +;; Reader.skip_blank_lines. Python uses [ \t\n\r\f\v] for it's \s . So +;; the horizontal spaces are [ \t]. +(defun adoc-re-content (&optional qualifier) + "Matches content, possibly spawning multiple non-blank lines" + (concat + "\\(?:" + ;; content on initial line + "." (or qualifier "*") "?" + ;; if content spawns multiple lines + "\\(?:\n" + ;; complete non blank lines + "\\(?:[ \t]*\\S-.*\n\\)*?" + ;; leading content on last line + ".*?" + "\\)??" + "\\)")) + font lock keywords (defun adoc-kwf-std (end regexp &optional must-free-groups no-block-del-groups)
[nongnu] elpa/adoc-mode 73b790fcf2 064/199: Merge branch 'develop'
branch: elpa/adoc-mode commit 73b790fcf26f2a1c6bf8e78a3c37b12e420bcce5 Merge: 69e44f37ac a61e7cd749 Author: Florian Kaufmann Commit: Florian Kaufmann Merge branch 'develop' --- adoc-mode-test.el | 267 -- adoc-mode.el | 345 +- 2 files changed, 468 insertions(+), 144 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 7e1cdbc5d6..55010d9e1a 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -2,12 +2,9 @@ ;;; ;;; Commentary: ;; -;; - font-lock-support-mode must be nil +;; Call adoc-test-run to run the test suite ;; ;;; Todo: -;; - there shoud not be a need to set font-lock-support-mode to nil. Maybe use -;; the let form, or find a function which forces font lock to do the -;; fontification of the whole buffer. ;; - test for font lock multiline property ;; - test for presence of adoc-reserved (we do white-box testing here) ;; - test also with multiple versions of (X)Emacs @@ -19,36 +16,90 @@ (require 'ert) (require 'adoc-mode) +;; todo: +;; - auto-create different contexts like +;; - beginning/end of buffer +;; - beginning/end of paragraph +;; - side-to-side yes/no with next same construct (defun adoctest-faces (name &rest args) - (set-buffer (get-buffer-create (concat "adoctest-" name))) - (delete-region (point-min) (point-max)) - - (while args -(insert (propertize (car args) 'adoctest (cadr args))) -(setq args (cddr args))) - - (adoc-mode) - (font-lock-fontify-buffer) - (goto-char (point-min)) - (let ((not-done t)) -(while not-done - (let* ((tmp (get-text-property (point) 'adoctest)) -(tmp2 (get-text-property (point) 'face))) - (cond -((null tmp)) ; nop -((eq tmp 'no-face) - (ert-should (null tmp2))) -(t - (if (and (listp tmp2) (not (listp tmp))) - (ert-should (and (= 1 (length tmp2)) (equal tmp (car tmp2 - (ert-should (equal tmp tmp2) - (if (< (point) (point-max)) - (forward-char 1) - (setq not-done nil) - (kill-buffer (concat "adoctest-" name))) - -(ert-deftest adoctest-test-titles-simple () - (adoctest-faces "titles-simple" + (let ((not-done t) + (font-lock-support-mode) + (buf-name (concat "adoctest-" name))) +(unwind-protect + (progn + ;; setup + (set-buffer (get-buffer-create buf-name)) + (delete-region (point-min) (point-max)) + (while args + (insert (propertize (car args) 'adoctest (cadr args))) + (setq args (cddr args))) + + ;; exercise + (adoc-mode) + (font-lock-fontify-buffer) + + ;; verify + (goto-char (point-min)) + (while not-done + (let* ((tmp (get-text-property (point) 'adoctest)) + (tmp2 (get-text-property (point) 'face))) + (cond + ((null tmp)) ; nop + ((eq tmp 'no-face) + (should (null tmp2))) + (t + (if (and (listp tmp2) (not (listp tmp))) + (should (and (= 1 (length tmp2)) (equal tmp (car tmp2 + (should (equal tmp tmp2) + (if (< (point) (point-max)) + (forward-char 1) + (setq not-done nil) + ;; tear-down + (kill-buffer buf-name + +(defun adoctest-trans (original-text expected-text transform) + (if (string-match "!" original-text) + ;; original-text has ! markers + (let ((pos 0) + (pos-old 0) + (pos-list) + (new-original-text "")) + ;; original-text -> new-original-text by removing ! and remembering their positions + (while (and (< pos (length original-text)) + (setq pos (string-match "!" original-text pos))) + (setq new-original-text (concat new-original-text (substring original-text pos-old pos))) + (setq pos-list (cons (length new-original-text) pos-list)) + (setq pos (1+ pos)) + (setq pos-old pos)) + (setq new-original-text (concat new-original-text (substring original-text pos-old pos))) + ;; run adoctest-trans-inner for each remembered pos + (while pos-list + (adoctest-trans-inner new-original-text expected-text transform (car pos-list)) + (setq pos-list (cdr pos-list +;; original-text has no ! markers +(adoctest-trans-inner original-text expected-text transform))) + +(defun adoctest-trans-inner (original-text expected-text transform &optional pos) + (let ((not-done t) + (font-lock-support-mode)) +(unwind-protect + (progn + ;; setup + (set-buffer (get-buffer-create "adoctest-trans")) + (delete-region (point-min) (point-max)) + (adoc-mode) + (insert original-text) + (when pos + (goto-char pos)) + ;; exercise + (eval tr
[nongnu] elpa/adoc-mode a3d77b0c15 082/199: bumped copyright year
branch: elpa/adoc-mode commit a3d77b0c152ab1d21339d475ebe2d0e50c45b4b0 Author: Florian Kaufmann Commit: Florian Kaufmann bumped copyright year --- adoc-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index 6215e6cc6e..02d4981576 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1,6 +1,6 @@ ;;; adoc-mode.el --- a major-mode for editing AsciiDoc files in Emacs ;; -;; Copyright 2010-2012 Florian Kaufmann +;; Copyright 2010-2013 Florian Kaufmann ;; ;; Author: Florian Kaufmann ;; URL: Current official: http://code.google.com/p/adoc-mode/
[nongnu] elpa/adoc-mode 3501940311 073/199: test: running the test is a bit more smoothly
branch: elpa/adoc-mode commit 3501940311ce4611b807fd2cd69261f82fe55191 Author: Florian Kaufmann Commit: Florian Kaufmann test: running the test is a bit more smoothly --- adoc-mode-test.el | 41 ++--- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 70ec52bb9b..91a31d17d8 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -608,12 +608,13 @@ ;; .elc. ;; ;; todo: also test for warnings -(defun adoc-test-save-compile-load () +(defun adoctest-save-compile-load () (unwind-protect (progn (let ((buf-adoc-mode (find-buffer-visiting "adoc-mode.el")) (buf-adoc-mode-test (find-buffer-visiting "adoc-mode-test.el"))) + ;; adoc-mode (cond ((null buf-adoc-mode)) ;nop ((bufferp buf-adoc-mode) (save-buffer buf-adoc-mode)) @@ -621,6 +622,7 @@ (or (byte-compile-file (locate-library "adoc-mode.el" t)) (error "compile error")) (or (load "adoc-mode.el" nil nil t) (error "load error")) + ;; adoc-mode-test (cond ((null buf-adoc-mode-test)) ;nop ((bufferp buf-adoc-mode-test) (save-buffer buf-adoc-mode-test)) @@ -635,27 +637,20 @@ (defun adoc-test-run() (interactive) - (unwind-protect - (progn - ;; so after a test failed it can be re-run - (when (get-buffer "*ert*") - (kill-buffer "*ert*")) - - ;; so no tests are executed which no longer exists (e.g. because they - ;; were (temporarly) commented out) - (mapatoms -(lambda (x) (if (string-match "^adoctest-test-" (symbol-name x)) -(unintern x nil - - ;; todo: execute tests in an smart order: the basic/simple tests first, so - ;; when a complicated test fails one knows that the simple things do work - (adoc-test-save-compile-load) - (ert-run-tests-interactively "^adoctest-test-") - ) -(when (file-exists-p "adoc-mode.elc") - (delete-file "adoc-mode.elc")) -(when (file-exists-p "adoc-mode-test.elc") - (delete-file "adoc-mode-test.elc" -;;; adoc-mode-test.el ends here + ;; ensure that a failed test can be re-run + (when (get-buffer "*ert*") +(kill-buffer "*ert*")) + + ;; ensure no no-longer test defuns exist, which would otherwise be executed + (mapatoms + (lambda (x) (if (string-match "^adoctest-test-" (symbol-name x)) + (unintern x nil + + (adoctest-save-compile-load) + ;; todo: execute tests in an smart order: the basic/simple tests first, so + ;; when a complicated test fails one knows that the simple things do work + (ert-run-tests-interactively "^adoctest-test-")) + +;;; adoc-mode-test.el ends here
[nongnu] elpa/adoc-mode e36c0105ab 104/199: improved fontifying for footnotes
branch: elpa/adoc-mode commit e36c0105ab3778ddcd728b8b876364798b9e9a09 Author: sensorflo Commit: sensorflo improved fontifying for footnotes --- adoc-mode-test.el | 20 ++ adoc-mode.el | 79 +-- 2 files changed, 62 insertions(+), 37 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 16966854bf..b412a913fa 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -289,6 +289,26 @@ removed before TRANSFORM is evaluated. "bla bli bla blu" markup-reference-face "]" markup-meta-face )) +(ert-deftest adoctest-test-footnotes () + (adoctest-faces "footnotes" + ;; simple example + "footnote" markup-command-face ":" markup-meta-face + "[" markup-meta-face "lorem ipsum" markup-secondary-text-face + "]" markup-meta-face "\n" nil + + ;; footnote can be hard up against the preceding word + "lorem" 'no-face "footnote" markup-command-face ":" markup-meta-face + "[" markup-meta-face "ipsum" markup-secondary-text-face + "]" markup-meta-face "\n" nil + + ;; attribute-list is not really an attribute list but normal text, + ;; i.e. comma, equal, double quotes are not fontified as meta characters + "footnote" markup-command-face ":" markup-meta-face + "[" markup-meta-face + "lorem, ipsum=dolor, sit=\"amen\"" markup-secondary-text-face + "]" markup-meta-face "\n" nil + )) + (ert-deftest adoctest-test-images () (adoctest-faces "images" ;; block macros diff --git a/adoc-mode.el b/adoc-mode.el index c5a01e0e4d..575606451b 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1314,27 +1314,34 @@ text having adoc-reserved set to 'block-del." ;; opposed to named attributes, thus init with 0. (pos-or-name-of-attribute 0)) -;; for each attribute in current attribute list -(while (re-search-forward (adoc-re-attribute-list-elt) attribute-list-end t) - (when (match-beginning 1); i.e. when it'a named attribute -;; get attribute's name -(setq pos-or-name-of-attribute - (buffer-substring-no-properties (match-beginning 1) (match-end 1))) -;; fontify the attribute's name with markup-attribute-face +(if (eq 'entire-attribute-list prop-of-attribute-list) +;; The attribute list is not really an attribute list. As a whole +;; it counts as text. (put-text-property - (match-beginning 1) (match-end 1) 'face markup-attribute-face)) - - ;; fontify the attribute's value - (let ((match-group-of-attribute-value (if (match-beginning 2) 2 3)) -(attribute-value-face - (adoc-face-for-attribute pos-or-name-of-attribute prop-of-attribute-list))) -(put-text-property - (match-beginning match-group-of-attribute-value) - (match-end match-group-of-attribute-value) - 'face attribute-value-face)) - - (when (numberp pos-or-name-of-attribute) -(setq pos-or-name-of-attribute (1+ pos-or-name-of-attribute + (point) attribute-list-end + 'face markup-secondary-text-face) + + ;; for each attribute in current attribute list + (while (re-search-forward (adoc-re-attribute-list-elt) attribute-list-end t) +(when (match-beginning 1); i.e. when it'a named attribute + ;; get attribute's name + (setq pos-or-name-of-attribute +(buffer-substring-no-properties (match-beginning 1) (match-end 1))) + ;; fontify the attribute's name with markup-attribute-face + (put-text-property + (match-beginning 1) (match-end 1) 'face markup-attribute-face)) + +;; fontify the attribute's value +(let ((match-group-of-attribute-value (if (match-beginning 2) 2 3)) + (attribute-value-face + (adoc-face-for-attribute pos-or-name-of-attribute prop-of-attribute-list))) + (put-text-property + (match-beginning match-group-of-attribute-value) + (match-end match-group-of-attribute-value) + 'face attribute-value-face)) + +(when (numberp pos-or-name-of-attribute) + (setq pos-or-name-of-attribute (1+ pos-or-name-of-attribute) (goto-char attribute-list-end nil) @@ -1496,17 +1503,19 @@ When LITERAL-P is non-nil, the contained text is literal text." '(3 nil)) ; grumbl, I dont know how to get rid of it `(4 '(face ,(or del-face markup-meta-hide-face) adoc-reserved t) t))); close del -(defun adoc-kw-inline-macro (&optional cmd-name cmd-face target-faces target-meta-p attribute-list) +(defun adoc-kw-inline-macro (&optional cmd-name unconstrained cmd-face target-faces target-meta-p attribute-list) "Returns a kewyword which highlights an inline macr
[nongnu] elpa/adoc-mode 091f46e866 061/199: test: added test for goto-ref-label
branch: elpa/adoc-mode commit 091f46e866f05d64b20c3493fc5879a8d425c4f6 Author: Florian Kaufmann Commit: Florian Kaufmann test: added test for goto-ref-label --- adoc-mode-test.el | 17 + 1 file changed, 17 insertions(+) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 8990056ef1..c31212263b 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -554,6 +554,23 @@ (should (equal (adoc-xref-id-at-point) "foo"))) (kill-buffer "adoc-test"))) +(ert-deftest adoctest-test-goto-ref-label () + (unwind-protect + (progn + (set-buffer (get-buffer-create "adoc-test")) + (insert "[[foo]]\n";1 + "lorem ipsum\n";2 + "[[bar]]\n";3 + "dolor [[geil]]sit amen\n" ;4 + "anchor:cool[]\n") ;5 + (adoc-goto-ref-label "cool") + (should (equal (line-number-at-pos) 5)) + (adoc-goto-ref-label "geil") + (should (equal (line-number-at-pos) 4)) + (adoc-goto-ref-label "bar") + (should (equal (line-number-at-pos) 3))) +(kill-buffer "adoc-test"))) + (ert-deftest adoctest-pre-test-byte-compile () ;; todo: also test for warnings (when (file-exists-p "adoc-mode.elc")
[nongnu] elpa/adoc-mode 3226a938a6 131/199: Update the custom group
branch: elpa/adoc-mode commit 3226a938a626d10f2ebd8254075aef46d0266273 Author: Bozhidar Batsov Commit: Bozhidar Batsov Update the custom group --- adoc-mode.el | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index f83f4e57ed..f1d5abb838 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -8,7 +8,7 @@ ;; Created: 2009 ;; Version: 0.6.6 ;; Package-Requires: ((markup-faces "1.0.0")) -;; Keywords: wp AsciiDoc +;; Keywords: AsciiDoc ;; ;; This file is not part of GNU Emacs. ;; @@ -64,8 +64,9 @@ Most faces adoc-mode uses belong to the markup-faces customization group, see link below, and have to be customized there. adoc-mode has only a few faces of its own, which can be customized on this page." - :group 'wp - :link '(custom-group-link markup-faces)) + :group 'text + :prefix "adoc-" + :link '(url-link "https://github.com/emacsorphanage/adoc-mode";)) (defcustom adoc-script-raise '(-0.3 0.3) "How much to lower and raise subscript and superscript content.
[nongnu] elpa/adoc-mode 497f6c1999 195/199: Addresses #39. `source-language` is only a document attribute. Add comment with adoc manual reference.
branch: elpa/adoc-mode commit 497f6c19992f37c86e84508ce2b5156fc4bbeb35 Author: Tobias Zawada Commit: TobiasZawada Addresses #39. `source-language` is only a document attribute. Add comment with adoc manual reference. --- adoc-mode.el | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index a58f3926cb..2feaa4b234 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -2040,7 +2040,11 @@ START-SRC and END-SRC delimit the actual source code." (outer-brackets-and-delimiter (&rest stuff) (format "^\\[%s\\]\n\\(?2:+\\)\n" (apply #'concat stuff))) -(lang () ",[\t ]*\\(source-language[\t ]*=[\t ]*\\)?\\(?1:[^],]+\\)") +;; The language attribute is positional only (2nd slot). +;; It gets its default value from the document attribute `source-language`. +;; The leading space between the comma and the 2nd attribute is ignored. +;; See https://docs.asciidoctor.org/asciidoc/latest/attributes/element-attributes/#attribute-list. +(lang () ",[\t ]*\\(?1:[^],]+\\)") (optional-other-args () "\\(?:,[^]]+\\)?")) (outer-brackets-and-delimiter (rx-or
[nongnu] elpa/adoc-mode 0f7619cfce 027/199: enheanced inline-subst-boundaries test
branch: elpa/adoc-mode commit 0f7619cfcec09da983abcf0748d1d4eadee00f62 Author: Florian Kaufmann Commit: Florian Kaufmann enheanced inline-subst-boundaries test --- adoc-mode-test.el | 42 +- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index fb6a7309be..e2d4b992d0 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -206,29 +206,53 @@ (ert-deftest adoctest-test-inline-subst-boundaries () (adoctest-faces "inline-subst-boundaries" + ;; 1) don't cross title boundaries. + ;; 2) don't cross paragraph boundaries. + ;; 3) verify that the (un)constrained quotes would work however "== " markup-meta-hide-face "chapter ** 1" markup-title-1-face "\n" nil "lorem ** ipsum\n" 'no-face "\n" nil + "lorem " 'no-face "**" markup-meta-hide-face " ipsum " markup-strong-face "**" markup-meta-hide-face "\n" nil + "\n" nil - "== " markup-meta-hide-face "chapter ** 1" markup-title-1-face " ==" markup-meta-hide-face "\n" nil - "lorem ** ipsum\n" 'no-face + "== " markup-meta-hide-face "chapter __ 1" markup-title-1-face " ==" markup-meta-hide-face "\n" nil + "lorem __ ipsum\n" 'no-face + "\n" nil + "lorem " 'no-face "__" markup-meta-hide-face " ipsum " markup-emphasis-face "__" markup-meta-hide-face "\n" nil "\n" nil - "chapter ** 1" markup-title-1-face "\n" nil + "chapter ++ 1" markup-title-1-face "\n" nil "" markup-meta-hide-face "\n" nil - "lorem ** ipsum\n" 'no-face + "lorem ++ ipsum\n" 'no-face + "\n" nil + "lorem " 'no-face "++" markup-meta-hide-face " ipsum " markup-typewriter-face "++" markup-meta-hide-face "\n" nil "\n" nil - "." markup-meta-face "block ** title" markup-gen-face "\n" nil - "lorem ** ipsum\n" 'no-face + "." markup-meta-face "block ^title" markup-gen-face "\n" nil + "lorem^ ipsum\n" 'no-face "\n" nil + "lorem " 'no-face "^" markup-meta-hide-face " ipsum " markup-superscript-face "^" markup-meta-hide-face "\n" nil + "\n" nil + + ;; Being able to use a ** that potentially could be mistaken as an end + ;; delimiter as start delimiter + "== " markup-meta-hide-face "chapter ** 1" markup-title-1-face "\n" nil + "lorem " 'no-face "**" markup-meta-hide-face " ipsum " markup-strong-face "**" markup-meta-hide-face "\n" nil + "\n" nil + + ;; 1) don't cross list item boundaries + ;; 2) don't mistake a list item '**' as an unconstrained quote '**' (either start or end) + "-" markup-list-face " " nil "lorem ** ipsum\n" 'no-face + "-" markup-list-face " " nil "dolor ** sit\n" 'no-face + "**" markup-list-face " " nil "lorem ** ipsumt\n" 'no-face + "**" markup-list-face " " nil "dolor ** sit\n" 'no-face + ;; todo: not reaching into a labeled list item text does no yet work + ;; "lorem ** ipsum " markup-gen-face "::" markup-list-face " " nil "sit ** dolor\n" 'no-face ;; test also ;; - over beginning of labeled - ;; - over end of block title - ;; - over beginning of two line title - ;; - over end of one line title + )) ;; todo: also test for warnings
[nongnu] elpa/adoc-mode 168ffa3f8e 098/199: bugfix: no longer running adoc-mode-hook twice
branch: elpa/adoc-mode commit 168ffa3f8efc3a635cc8f9422b7117a3a99af804 Author: sensorflo Commit: sensorflo bugfix: no longer running adoc-mode-hook twice --- adoc-mode.el | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 8afa8cc231..f824b6f0b5 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -466,9 +466,6 @@ To become a customizable variable when regexps for list items become customizabl ("citetitle" . markup-secondary-text-face)) "An alist, key=attribute id, value=face.") -(defvar adoc-mode-hook nil - "Normal hook run when entering Adoc Text mode.") - (defvar adoc-mode-abbrev-table nil "Abbrev table in use in adoc-mode buffers.") @@ -2924,8 +2921,7 @@ Turning on Adoc mode runs the normal hook `adoc-mode-hook'." (make-local-variable 'compilation-error-regexp-alist) (add-to-list 'compilation-error-regexp-alist 'asciidoc)) - (easy-menu-add adoc-mode-menu) - (run-hooks 'adoc-mode-hook)) + (easy-menu-add adoc-mode-menu)) non-definitions evaluated during load
[nongnu] elpa/adoc-mode 2322c32185 076/199: extracted make-two-line-title-underline from make-two-line-title
branch: elpa/adoc-mode commit 2322c321852aa1aba6d79206132a6bce1c829a3b Author: Florian Kaufmann Commit: Florian Kaufmann extracted make-two-line-title-underline from make-two-line-title --- adoc-mode-test.el | 6 ++ adoc-mode.el | 26 +- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 7da1d10287..82ba796a2f 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -611,6 +611,12 @@ removed before TRANSFORM is evaluated. (should (equal (line-number-at-pos) 3))) (kill-buffer "adoc-test"))) +(ert-deftest adoctest-test-make-two-line-title-underline () + (should (equal (adoc-make-two-line-title-underline 0 6) +"==")) + (should (equal (adoc-make-two-line-title-underline 2) +""))) + ;; purpose ;; - ensure that the latest version, i.e. the one currently in buffer(s), of ;; adoc-mode and adoc-mode-test is used for the test diff --git a/adoc-mode.el b/adoc-mode.el index 7629b3fbd5..427a7e9884 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -503,19 +503,27 @@ match-data has his this sub groups: ;; 2nd line: underline (adoc-re-two-line-title-undlerline del))) -(defun adoc-make-two-line-title (del text) - "Returns a two line title using given DEL containing given TEXT." - (when (not (eq (length del) 2)) -(error "two line title delimiters must be 2 chars long")) - (let ((repetition-cnt (if (>= (length text) 2) (/ (length text) 2) 1)) -(result (concat text "\n"))) +(defun adoc-make-two-line-title (level text) + "Returns a two line title of given LEVEL containing given TEXT. +LEVEL starts at 1." + (concat text "\n" (adoc-make-two-line-title-underline level (length text + +(defun adoc-make-two-line-title-underline (level &optional length) + "Returns a two line title underline. +LEVEL is the level of the title, starting at 1. LENGTH is the +line of the title's text. When nil it defaults to 4." + (unless length +(setq length 4)) + (let* ((repetition-cnt (if (>= length 2) (/ length 2) 1)) +(del (nth level adoc-two-line-title-del)) +(result "")) (while (> repetition-cnt 0) (setq result (concat result del)) (setq repetition-cnt (- repetition-cnt 1))) -(when (eq (% (length text) 2) 1) +(when (eq (% length 2) 1) (setq result (concat result (substring del 0 1 result)) - + (defun adoc-re-oulisti (type &optional level sub-type) "Returns a regexp matching an (un)ordered list item. @@ -2009,7 +2017,7 @@ trailing delimiter ('== my title =='). (text (nth 3 descriptor))) (if (eq type 1) (adoc-make-one-line-title sub-type level text) - (adoc-make-two-line-title (nth level adoc-two-line-title-del) text + (adoc-make-two-line-title level text (defun adoc-modify-title (&optional new-level-rel new-level-abs new-type new-sub-type create) "Modify properties of title point is on.
[nongnu] elpa/adoc-mode 1cbd1297be 137/199: Restructure the README a bit
branch: elpa/adoc-mode commit 1cbd1297be03925ec4afeecf91cf0f4e57c23c4f Author: Bozhidar Batsov Commit: Bozhidar Batsov Restructure the README a bit --- README.md | 65 +++ 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index db478dcc2a..5b38ce57ec 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,30 @@ final output. What must be bold is bold, what must be italic is italic etc. Meta characters are naturally still visible, but in a faint way, so they can be easily ignored. +## Features + +Here are some of the main features of `adoc-mode`: + +- sophisticated highlighting +- promote / demote title +- toggle title type between one line title and two line title +- adjust underline length of a two line title to match title text's length +- goto anchor defining a given id, default reading from xref at point +- support for outline (however only with the one-line title style) + +### Demo + +The highlighting emphasizes on how the output will look like. _All_ +characters are visible, however meta characters are displayed in a faint way. + + + ## Installation `adoc-mode` is available on the community-maintained [MELPA Stable][] and [MELPA][] repos. -NonGNU ELPA and MELPA Stable are recommended as they have the latest stable version. +Using MELPA Stable is recommended as it has the latest stable version. MELPA has a development snapshot for users who don't mind breakage but don't want to run `adoc-mode` from a git checkout. @@ -30,48 +48,36 @@ You can install `adoc-mode` using the following command: M-x package-install [RET] adoc-mode [RET] -or if you'd rather keep it in your Emacs config: +If the installation doesn't work try refreshing the package list: + +M-x package-refresh-contents + +Alternative, you can add something like this to your Emacs config: ```emacs-lisp (unless (package-installed-p 'adoc-mode) (package-refresh-contents) (package-install 'adoc-mode)) -``` - -If the installation doesn't work try refreshing the package list: - -M-x package-refresh-contents +;; or if you're into use-package +(use-package adoc-mode + :ensure t) +``` ## Configuration -* According to an old AsciiDoc manual, .txt is the standard file extension of +* According to an old AsciiDoc manual, `.txt` is the standard file extension of AsciiDoc files. Add the following to your initialization file to open all - .txt files with adoc-mode as major mode automatically: `(add-to-list + `.txt` files with adoc-mode as major mode automatically: `(add-to-list 'auto-mode-alist (cons "\\.txt\\'" 'adoc-mode))`. More recent conventions for AsciiDoc file extensions include `.adoc` and - `.asciidoc`, these are associated automatically. + `.asciidoc`, these are associated with `adoc-mode` automatically. * If your default face is a fixed pitch (monospace) face, but in AsciiDoc files you liked to have normal text with a variable pitch face, - buffer-face-mode is for you: `(add-hook 'adoc-mode-hook (lambda() + `buffer-face-mode` is for you: `(add-hook 'adoc-mode-hook (lambda() (buffer-face-mode t)))` - -## Features - -- sophisticated highlighting - -- promote / demote title - -- toggle title type between one line title and two line title - -- adjust underline length of a two line title to match title text's length - -- goto anchor defining a given id, default reading from xref at point - -- support for outline (however only with the one-line title style) - ### Coming features The next features I plan to implement @@ -80,13 +86,6 @@ The next features I plan to implement - Outline support also for two line titles - Correctly highlighting backslash escapes -## Screenshot - -The highlighting emphasizes on how the output will look like. _All_ -characters are visible, however meta characters are displayed in a faint way. - - - ## Hacking adoc-mode uses [Eldev](https://github.com/doublep/eldev) for development, so
[nongnu] elpa/adoc-mode ead05da007 014/199: split up the current big test into smaller ones
branch: elpa/adoc-mode commit ead05da007442be97ea4bf4fbfe31f723c048db5 Author: Florian Kaufmann Commit: Florian Kaufmann split up the current big test into smaller ones --- adoc-mode-test.el | 64 +++ 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index f576cf44df..41b85047ff 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -3,8 +3,15 @@ ;; todo ;; test for font lock multiline property +;; todo +;; ! +;; Lock Support Mode must be set to nil +;; ! + +;; todo: test for presence of adoc-reserved (we do white-box testing here) + -(defun adoctest-make-buffer (&rest args) +(defun adoctest-faces (&rest args) (set-buffer (get-buffer-create "adoctest")) (delete-region (point-min) (point-max)) @@ -13,19 +20,22 @@ (setq args (cddr args))) (adoc-mode) - (font-lock-fontify-buffer)) - -(ert-deftest adoctest-foo () - ;; todo - ;; ! - ;; Lock Support Mode must be set to nil - ;; ! - - ;; todo: test for presence of adoc-reserved (we do white-box testing here) - + (font-lock-fontify-buffer) + (goto-char (point-min)) + (let ((not-done t)) +(while not-done + (let* ((tmp (get-text-property (point) 'adoctest)) +(tmp2 (get-text-property (point) 'face))) + (when tmp + (if (and (listp tmp2) (not (listp tmp))) + (ert-should (and (= 1 (length tmp2)) (equal tmp (car tmp2 + (ert-should (equal tmp tmp2 + (if (< (point) (point-max)) + (forward-char 1) + (setq not-done nil)) - ;; the white after = really is part of the delimiter - (adoctest-make-buffer +(ert-deftest adoctest-test-titles-simple () + (adoctest-faces "= " markup-meta-hide-face "document title" markup-title-0-face "\n" nil "\n" nil "== " markup-meta-hide-face "chapter 1" markup-title-1-face "\n" nil @@ -63,9 +73,10 @@ "^" markup-meta-hide-face "\n" nil "\n" nil "chapter 4" markup-title-4-face "\n" nil - "+" markup-meta-hide-face "\n" nil - "\n" nil + "+" markup-meta-hide-face "\n" nil)) +(ert-deftest adoctest-test-delimited-blocks-simple () + (adoctest-faces "" markup-meta-hide-face "\n" nil "comment line 1\ncomment line 2" markup-comment-face "\n" nil "" markup-meta-hide-face "\n" nil @@ -96,9 +107,10 @@ "\n" nil "--" markup-meta-hide-face "\n" nil "open block line 1\nopen block line 2" nil "\n" nil - "--" markup-meta-hide-face "\n" nil - "\n" nil + "--" markup-meta-hide-face "\n" nil)) +(ert-deftest adoctest-test-quotes-simple () + (adoctest-faces ;; note that in unconstraned quotes cases " ipsum " has spaces around, in ;; constrained quotes case it doesn't "Lorem " nil "`" markup-meta-hide-face "ipsum" '(markup-typewriter-face markup-verbatim-face) "`" markup-meta-hide-face " dolor\n" nil @@ -116,21 +128,7 @@ "Lorem " nil "##" markup-meta-hide-face " ipsum " markup-gen-face "##" markup-meta-hide-face " dolor\n" nil "Lorem " nil "#" markup-meta-hide-face "ipsum" markup-gen-face "#" markup-meta-hide-face " dolor\n" nil "Lorem " nil "~" markup-meta-hide-face " ipsum " markup-subscript-face "~" markup-meta-hide-face " dolor\n" nil - "Lorem " nil "^" markup-meta-hide-face " ipsum " markup-superscript-face "^" markup-meta-hide-face " dolor\n" nil - ) - - (goto-char (point-min)) - (let ((not-done t)) -(while not-done - (let* ((tmp (get-text-property (point) 'adoctest)) -(tmp2 (get-text-property (point) 'face))) - (when tmp - (if (and (listp tmp2) (not (listp tmp))) - (ert-should (and (= 1 (length tmp2)) (equal tmp (car tmp2 - (ert-should (equal tmp tmp2 - (if (< (point) (point-max)) - (forward-char 1) - (setq not-done nil)) + "Lorem " nil "^" markup-meta-hide-face " ipsum " markup-superscript-face "^" markup-meta-hide-face " dolor\n" nil)) -(ert-run-tests-interactively "^adoctest-") +(ert-run-tests-interactively "^adoctest-test-")
[nongnu] elpa/adoc-mode e0d08ee6d2 144/199: Delete obsolete Cask file
branch: elpa/adoc-mode commit e0d08ee6d29289a475796e22b2298b028c02b408 Author: Bozhidar Batsov Commit: Bozhidar Batsov Delete obsolete Cask file --- Cask | 7 --- 1 file changed, 7 deletions(-) diff --git a/Cask b/Cask deleted file mode 100644 index c33321b15e..00 --- a/Cask +++ /dev/null @@ -1,7 +0,0 @@ -(source marmalade) - -(package "adoc-mode" "0.6.2" "a major-mode for editing AsciiDoc files in Emacs") - -(development - (depends-on "adoc-mode") -)
[nongnu] elpa/adoc-mode de725c7910 156/199: [Fix #12] Replace the broken screenshot
branch: elpa/adoc-mode commit de725c791009eaf6b689b819cf97a3d89ac21d8a Author: Bozhidar Batsov Commit: Bozhidar Batsov [Fix #12] Replace the broken screenshot --- README.adoc | 2 +- images/adoc-mode.png | Bin 0 -> 193977 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 2795db89ef..9c4f559f0f 100644 --- a/README.adoc +++ b/README.adoc @@ -45,7 +45,7 @@ Here are some of the main features of `adoc-mode`: The highlighting emphasizes on how the output will look like. _All_ characters are visible, however meta characters are displayed in a faint way. -image:http://dl.dropbox.com/u/75789984/adoc-mode.png[alt=screenshot] +image:images/adoc-mode.png[alt=screenshot] == Installation diff --git a/images/adoc-mode.png b/images/adoc-mode.png new file mode 100755 index 00..0db12b7ac0 Binary files /dev/null and b/images/adoc-mode.png differ
[nongnu] elpa/adoc-mode 7aa44fea5b 089/199: in menu, unicode chars for (R) and (TM) were interchanged
branch: elpa/adoc-mode commit 7aa44fea5b29a30f80684129cf6e113edf418054 Author: FLKA Commit: FLKA in menu, unicode chars for (R) and (TM) were interchanged --- adoc-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 7e099ad2e9..474ef6e74f 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -2242,8 +2242,8 @@ new customization demands." :help ,adoc-help-ruler-line]) ("Text formatting - replacements" ["Copyright: (C) \u2192 \u00A9" tempo-template-adoc-copyright] - ["Trademark: (TM) \u2192 \u00AE" tempo-template-adoc-trademark] - ["Registered trademark: (R) \u2192 \u2122" tempo-template-adoc-registered-trademark] + ["Trademark: (TM) \u2192 \u2122" tempo-template-adoc-trademark] + ["Registered trademark: (R) \u2192 \u00AE" tempo-template-adoc-registered-trademark] ["Dash: -- \u2192 \u2014" tempo-template-adoc-dash] ["Ellipsis: ... \u2192 \u2026" tempo-template-adoc-ellipsis] ["Right arrow: -> \u2192 \u2192" tempo-template-adoc-right-arrow]
[nongnu] elpa/adoc-mode 65794ce2da 188/199: Addresses #33. Reduce formatting lag by `adoc-kwf-search`
branch: elpa/adoc-mode commit 65794ce2da5c3611f6d2194d0b4d19fbfc94e57f Author: Tobias Zawada Commit: TobiasZawada Addresses #33. Reduce formatting lag by `adoc-kwf-search` Replace `re-search-forward` by `adoc-kwf-search` in font-lock keywords. `adoc-kwf-search` continues search if the adoc-code-block text property is set at the matching position. --- adoc-mode.el | 32 +--- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 4d114bf88f..fa1fa11b2d 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1556,6 +1556,19 @@ Subgroups of returned regexp: font lock keywords +(defsubst adoc-kwf-search (regexp &optional bound noerror count) + "Keyword search for Adoc. +Like `re-search-forward' with the same arguments +REGEXP, BOUND, NOERROR and COUNT. +If a match for REGEXP is found where the text property +`adoc-code-block' is non-nil continue the search." + (let (ret) +(while (and +(setq ret (re-search-forward regexp bound noerror count)) +(get-text-property (point) 'adoc-code-block) +(null (eobp +ret)) + (defun adoc-kwf-std (end regexp &optional must-free-groups no-block-del-groups) "Standard function for keywords Intendent to be called from font lock keyword functions. END is @@ -1567,7 +1580,7 @@ text having adoc-reserved set to symbol `block-del'." (let ((found t) (prevented t) saved-point) (while (and found prevented (<= (point) end) (not (eobp))) (setq saved-point (point)) - (setq found (re-search-forward regexp end t)) + (setq found (adoc-kwf-search regexp end t)) (setq prevented (and found (or @@ -1679,7 +1692,7 @@ text having adoc-reserved set to symbol `block-del'." ;; matcher function `(lambda (end) (and adoc-enable-two-line-title - (re-search-forward ,(adoc-re-two-line-title del) end t) + (adoc-kwf-search ,(adoc-re-two-line-title del) end t) (< (abs (- (length (match-string 2)) (length (match-string 3 3) (or (not (numberp adoc-enable-two-line-title)) (not (equal adoc-enable-two-line-title (length (match-string 2) @@ -1754,7 +1767,7 @@ Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-llisti'." `(list ;; matcher function (lambda (end) - (and (re-search-forward "^[ \t]*\\(\\(?:CAUTION\\|WARNING\\|IMPORTANT\\|TIP\\|NOTE\\):\\)\\([ \t]+\\)" end t) + (and (adoc-kwf-search "^[ \t]*\\(\\(?:CAUTION\\|WARNING\\|IMPORTANT\\|TIP\\|NOTE\\):\\)\\([ \t]+\\)" end t) (not (text-property-not-all (match-beginning 0) (match-end 0) 'adoc-reserved nil ;; highlighers '(1 '(face adoc-complex-replacement-face adoc-reserved t)) @@ -1765,7 +1778,7 @@ Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-llisti'." (list ;; matcher function `(lambda (end) - (and (re-search-forward ,(adoc-re-verbatim-paragraph-sequence) end t) + (and (adoc-kwf-search ,(adoc-re-verbatim-paragraph-sequence) end t) (not (text-property-not-all (match-beginning 0) (match-end 0) 'adoc-reserved nil ;; highlighers '(1 '(face adoc-typewriter-face adoc-reserved t font-lock-multiline t @@ -1893,7 +1906,7 @@ meta characters." (while (and found prevented) (setq saved-point (point)) (setq found -(re-search-forward ,regexp end t)) +(adoc-kwf-search ,regexp end t)) (setq prevented ; prevented is only meaningful wenn found is non-nil (or (not found) ; the following is only needed when found @@ -1931,7 +1944,7 @@ meta characters." ;; line beginning would also be underlined, which looks akward. (defun adoc-flf-first-whites-fixed-width(end) ;; it makes no sense to do something with a blank line, so require at least one non blank char. - (and (re-search-forward "\\(^[ \t]+\\)[^ \t\n]" end t) + (and (adoc-kwf-search "\\(^[ \t]+\\)[^ \t\n]" end t) ;; don't replace a face with with adoc-align-face which already is a fixed with ;; font (most probably), because then it also won't look aligned (text-property-not-all (match-beginning 1) (match-end 1) 'face 'adoc-typewriter-face) @@ -2120,7 +2133,7 @@ Use this function as matching function MATCHER in `font-lock-keywords'." (font-lock-append-text-property start-src end-src+nl 'face 'adoc-native-code-face) (add-text-properties - start-src end-src+nl '(font-lock-fontified t font-lock-multiline t)) + start-src end-src+nl '(font-lock-fontified t font-lock-multiline t adoc-code-block t)) ))) t))) @@ -2154,9 +2167,7 @@ Use this function as matching function MATCHER in `font-lock-keywords'." (defun adoc-get-font-lock-keywords () "Return list of keywords for `adoc-mode'." (list - ;; Fontify code bl
[nongnu] elpa/adoc-mode 19f7f655b7 179/199: Address CI issues.
branch: elpa/adoc-mode commit 19f7f655b78ae68418cd45037887e1a831e02765 Author: Tobias Zawada Commit: Tobias Zawada Address CI issues. --- adoc-mode.el | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 7734433876..90badd145e 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1998,7 +1998,7 @@ START-SRC and END-SRC delimit the actual source code." (when (fboundp lang-mode) (let ((string (buffer-substring-no-properties start-src end-src)) (modified (buffer-modified-p)) -(adoc-buffer (current-buffer)) int pos next) +(adoc-buffer (current-buffer)) int) (remove-text-properties start-block end-block '(face nil adoc-code-block nil font-lock-fontified nil font-lock-multiline nil)) (with-current-buffer (get-buffer-create @@ -2011,7 +2011,6 @@ START-SRC and END-SRC delimit the actual source code." (insert string)) (unless (eq major-mode lang-mode) (funcall lang-mode)) (font-lock-ensure) - (setq pos (point-min)) (cl-loop for int being the intervals property 'face for pos = (car int) for next = (cdr int) @@ -2108,11 +2107,7 @@ Use this function as matching function MATCHER in `font-lock-keywords'." (start-src (match-beginning 1)) (end-src (match-end 1)) (end-src+nl (if (eq (char-after end-src) ?\n) (1+ end-src) end-src)) -(size (1+ (- end-src start-src))) -(bol-prev (progn (goto-char start-block) - (if (bolp) (line-beginning-position 0) (line-beginning-position -(eol-next (progn (goto-char end-block) - (if (bolp) (line-beginning-position 2) (line-beginning-position 3) +(size (1+ (- end-src start-src (if (if (numberp adoc-fontify-code-blocks-natively) (<= size adoc-fontify-code-blocks-natively) adoc-fontify-code-blocks-natively)
[nongnu] elpa/adoc-mode 4e13247892 058/199: test: added test for adjust-title-del
branch: elpa/adoc-mode commit 4e13247892729c190eaa7958d846ba1a30beb2fd Author: Florian Kaufmann Commit: Florian Kaufmann test: added test for adjust-title-del --- adoc-mode-test.el | 5 + 1 file changed, 5 insertions(+) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 51221b296a..6263e58fdb 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -531,6 +531,11 @@ (adoctest-trans "= five" "= five =" '(adoc-toggle-title-type t)) (adoctest-trans "= six =" "= six" '(adoc-toggle-title-type t))) +(ert-deftest adoctest-test-adjust-title-del () + (adoctest-trans "lorem!\n===!" "lorem\n=" '(adoc-adjust-title-del)) + (adoctest-trans "lorem!\n!" "lorem\n=" '(adoc-adjust-title-del)) + (adoctest-trans "lorem!\n=!" "lorem\n=" '(adoc-adjust-title-del))) + (ert-deftest adoctest-pre-test-byte-compile () ;; todo: also test for warnings (when (file-exists-p "adoc-mode.elc")
[nongnu] elpa/adoc-mode 9916b51199 113/199: small refactoring in field of the adoc-attribute-list text property
branch: elpa/adoc-mode commit 9916b5119992fd32f610f0b178df1d4e17950bce Author: sensorflo Commit: sensorflo small refactoring in field of the adoc-attribute-list text property --- adoc-mode.el | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 793c72a5a0..56392c7de6 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1358,12 +1358,12 @@ text having adoc-reserved set to 'block-del." ;; opposed to named attributes, thus init with 0. (pos-or-name-of-attribute 0)) -(if (eq 'entire-attribute-list prop-of-attribute-list) +(if (facep prop-of-attribute-list) ;; The attribute list is not really an attribute list. As a whole ;; it counts as text. (put-text-property (point) attribute-list-end - 'face markup-secondary-text-face) + 'face prop-of-attribute-list) ;; for each attribute in current attribute list (while (re-search-forward (adoc-re-attribute-list-elt) attribute-list-end t) @@ -2066,7 +2066,7 @@ meta characters." '("alt")) (adoc-kw-inline-macro "xref" nil nil nil '(markup-reference-face markup-internal-reference-face) t '(("caption") (("caption" . markup-reference-face - (adoc-kw-inline-macro "footnote" t nil nil nil nil 'entire-attribute-list) + (adoc-kw-inline-macro "footnote" t nil nil nil nil markup-secondary-text-face) (adoc-kw-inline-macro "footnoteref" t 'single-attribute nil nil nil '(("id") (("id" . markup-internal-reference-face (adoc-kw-inline-macro "footnoteref" t nil nil nil nil '("id" "text")) @@ -2903,6 +2903,7 @@ attribute. The value of ATTRIBUTE-LIST-PROP-VAL is one of the following: - nil +- FACE - POS-TO-NAME - (POS-TO-NAME LOCAL-ATTRIBUTE-FACE-ALIST) @@ -2911,6 +2912,10 @@ names. E.g. (\"foo\" \"bar\") means that the first positional attribute corresponds to the named attribute foo, and the 2nd positional attribute corresponds to the named attribute bar. +FACE is something that satisfies facep; in that case the whole +attribute list is fontified with that face. However that case is +handled outside this function. + An attribute name is first looked up in LOCAL-ATTRIBUTE-FACE-ALIST before it is looked up in `adoc-attribute-face-alist'."
[nongnu] elpa/adoc-mode fb170735f8 056/199: bugfixes and new tests for promote/denote/toggle title
branch: elpa/adoc-mode commit fb170735f8d5c5249058196e1e7c0ba2f0f1bf46 Author: Florian Kaufmann Commit: Florian Kaufmann bugfixes and new tests for promote/denote/toggle title --- adoc-mode-test.el | 71 --- adoc-mode.el | 40 +-- 2 files changed, 75 insertions(+), 36 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 16afb6500b..51221b296a 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -57,16 +57,29 @@ ;; tear-down (kill-buffer buf-name -(defun adoctest-trans (original-text expected-text transform-fn &optional args) - (let ((pos 0) - (line 0)) -(while (and (< pos (length original-text)) - (setq pos (string-match "\n\\|\\'" original-text pos))) - (adoctest-trans-inner original-text expected-text transform-fn args line) - (setq line (1+ line)) - (setq pos (1+ pos) - -(defun adoctest-trans-inner (original-text expected-text transform-fn args line) +(defun adoctest-trans (original-text expected-text transform) + (if (string-match "!" original-text) + ;; original-text has ! markers + (let ((pos 0) + (pos-old 0) + (pos-list) + (new-original-text "")) + ;; original-text -> new-original-text by removing ! and remembering their positions + (while (and (< pos (length original-text)) + (setq pos (string-match "!" original-text pos))) + (setq new-original-text (concat new-original-text (substring original-text pos-old pos))) + (setq pos-list (cons (length new-original-text) pos-list)) + (setq pos (1+ pos)) + (setq pos-old pos)) + (setq new-original-text (concat new-original-text (substring original-text pos-old pos))) + ;; run adoctest-trans-inner for each remembered pos + (while pos-list + (adoctest-trans-inner new-original-text expected-text transform (car pos-list)) + (setq pos-list (cdr pos-list +;; original-text has no ! markers +(adoctest-trans-inner original-text expected-text transform))) + +(defun adoctest-trans-inner (original-text expected-text transform &optional pos) (let ((not-done t) (font-lock-support-mode)) (unwind-protect @@ -76,9 +89,10 @@ (delete-region (point-min) (point-max)) (adoc-mode) (insert original-text) - (goto-line line) + (when pos + (goto-char pos)) ;; exercise - (funcall transform-fn args) + (eval transform) ;; verify (should (string-equal (buffer-substring (point-min) (point-max)) expected-text))) ;; tear-down @@ -489,24 +503,33 @@ "lorem ** ipsum " markup-gen-face "::" markup-list-face " " nil "sit ** dolor" 'no-face)) (ert-deftest adoctest-test-promote-title () - (adoctest-trans "= foo" "== foo" 'adoc-promote-title 1) - (adoctest-trans "= foo" "= foo" 'adoc-promote-title 1) - (adoctest-trans "== foo" " foo" 'adoc-promote-title 2) + (adoctest-trans "= foo" "== foo" '(adoc-promote-title 1)) + (adoctest-trans "= foo" "= foo" '(adoc-promote-title 1)) + (adoctest-trans "== foo" " foo" '(adoc-promote-title 2)) - (adoctest-trans "= foo =" "== foo ==" 'adoc-promote-title 1) - (adoctest-trans "= foo =" "= foo =" 'adoc-promote-title 1) - (adoctest-trans "== foo ==" " foo " 'adoc-promote-title 2) + (adoctest-trans "= foo =" "== foo ==" '(adoc-promote-title 1)) + (adoctest-trans "= foo =" "= foo =" '(adoc-promote-title 1)) + (adoctest-trans "== foo ==" " foo " '(adoc-promote-title 2)) - (adoctest-trans "foo\n===" "foo\n---" 'adoc-promote-title 1) - (adoctest-trans "foo\n+++" "foo\n===" 'adoc-promote-title 1) - (adoctest-trans "foo\n---" "foo\n^^^" 'adoc-promote-title 2)) + (adoctest-trans "foo!\n===!" "foo\n---" '(adoc-promote-title 1)) + (adoctest-trans "foo!\n+++!" "foo\n===" '(adoc-promote-title 1)) + (adoctest-trans "foo!\n---!" "foo\n^^^" '(adoc-promote-title 2))) ;; since it's a whitebox test we know denote and promote only differ by inverse ;; arg. So denote doesn't need to be throuhly tested again (ert-deftest adoctest-test-denote-title () - (adoctest-trans "= foo" "= foo" 'adoc-denote-title 1) - (adoctest-trans "= foo =" "= foo =" 'adoc-denote-title 1) - (adoctest-trans "foo\n===" "foo\n+++" 'adoc-denote-title 1)) + (adoctest-trans "= foo" "= foo" '(adoc-denote-title 1)) + (adoctest-trans "= foo =" "= foo =" '(adoc-denote-title 1)) + (adoctest-trans "foo!\n===!" "foo\n+++" '(adoc-denote-title 1))) + +;; todo: test after transition point is still on title lines +(ert-deftest adoctest-test-toggle-title-type () + (adoctest-trans "= one" "one\n===" '(adoc-toggle-title-type)) + (adoctest-trans "two!\n===!" "= two" '(adoc-toggle-title-type)) + (adoctest-trans "= three!\nbar" "three\n=\nbar" '(adoc-toggle-title-
[nongnu] elpa/adoc-mode 02f53a301b 124/199: Fix #43. Add missing quote before adoc-reserved in adoc-kw-verbatim-paragraph-sequence
branch: elpa/adoc-mode commit 02f53a301b8e5b6e4934b47ab326892f70719c32 Author: TobiasZawada Commit: TobiasZawada Fix #43. Add missing quote before adoc-reserved in adoc-kw-verbatim-paragraph-sequence --- adoc-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index 23435054ab..07deba26e8 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1528,7 +1528,7 @@ Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-llisti'." ;; matcher function `(lambda (end) (and (re-search-forward ,(adoc-re-verbatim-paragraph-sequence) end t) - (not (text-property-not-all (match-beginning 0) (match-end 0) adoc-reserved nil + (not (text-property-not-all (match-beginning 0) (match-end 0) 'adoc-reserved nil ;; highlighers '(1 '(face adoc-monospace adoc-reserved t font-lock-multiline t
[nongnu] elpa/adoc-mode b79c243241 059/199: adoc-re-anchor can now match a given id
branch: elpa/adoc-mode commit b79c243241b6b2ccfa452a14bde946b9c977c96e Author: Florian Kaufmann Commit: Florian Kaufmann adoc-re-anchor can now match a given id --- adoc-mode.el | 49 +++-- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index e9f5911495..ff2841cf34 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -670,13 +670,34 @@ Subgroups: 3 attribute list, exclusive brackets []" (concat "^\\(" (or cmd-name "[a-zA-Z0-9_]+") "\\)::\\([^ \t\n]*?\\)\\[\\(.*?\\)\\][ \t]*$")) -;; with attriblists: -;; inline macro special syntax: [\\]?\[\[(?P[\w"_:].*?)\]\] -;; inline macro biblio special syntax: [\\]?\[\[\[(?P[\w_:][\w_:.-]*?)\]\]\] -;; id/reftext given by special syntax -;; block id: ^\[\[(?P[\w\-_]+)(,(?P.*?))?\]\]$ -;; mixed: -;; inline macro default syntax: see adoc-re-inline-macro. the target is the id, the 1st pos arg is the xreflabel +(defun adoc-re-anchor (type &optional id) + "Returns a regexp matching an anchor. + +If ID is non-nil, the regexp matches an anchor defining exactly +this id. If ID is nil, the regexp matches any anchor." + (cond + ((eq type 'block-id) +;; ^\[\[(?P[\w\-_]+)(,(?P.*?))?\]\]$ +(concat "^\\[\\[" + "\\(" (or (regexp-quote id) "[-a-zA-Z0-9_]+") "\\)" + "\\(?:,?\\(.*?\\)\\)?" + "\\]\\][ \t]*$")) + + ((eq type 'inline-special) +;; [\\]?\[\[(?P[\w"_:].*?)\]\] +(concat "\\(\\[\\[\\)" + "\\(" (or (concat (regexp-quote id) "[ \t]*?") "[a-zA-Z0-9\"_:].*?") "\\)" + "\\(\\]\\]\\)")) + + ((eq type 'biblio) +;; [\\]?\[\[\[(?P[\w_:][\w_:.-]*?)\]\]\] +(concat "\\(\\[\\[\\)" + "\\(\\[" (or (regexp-quote id) "[a-zA-Z0-9_:][a-zA-Z0-9_:.-]*?") "\\]\\)" + "\\(\\]\\]\\)")) + + ((eq type 'inline-general) +(adoc-re-inline-macro "anchor" id + (defun adoc-re-anchor(type) "Returns a regexp matching an anchor." (cond @@ -795,9 +816,13 @@ subgroups: ;; (?http|https|ftp|file|irc|mailto|callto|image|link|anchor|xref|indexterm):(?P\S*?)\[(?P.*?)\] ;; # Default (catchall) inline macro is not implemented ;; # [\\]?(?P\w(\w|-)*?):(?P\S*?)\[(?P.*?)(?
[nongnu] elpa/adoc-mode e03d63e0b3 039/199: extened anchors unittest and fixed revealed bug
branch: elpa/adoc-mode commit e03d63e0b3d8baeaba995cbc111eff14acd07284 Author: Florian Kaufmann Commit: Florian Kaufmann extened anchors unittest and fixed revealed bug --- adoc-mode-test.el | 21 +++-- adoc-mode.el | 9 + 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 31161b9488..fcd84290cb 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -138,18 +138,27 @@ (adoctest-faces "anchors" ;; block id "[[" markup-meta-face "foo" markup-anchor-face "]]" markup-meta-face "\n" nil -"[[" markup-meta-face "foo" markup-anchor-face "," markup-meta-face "bar" markup-secondary-text-face "]]" markup-meta-face "\n" nil +"[[" markup-meta-face "foo" markup-anchor-face "," markup-meta-face + "bar" markup-secondary-text-face "]]" markup-meta-face "\n" nil + +;; special inline syntax: [[id]] [[id,xreftext]] +"lorem " 'no-face "[[" markup-meta-face "foo" markup-anchor-face "]]" + markup-meta-face "ipsum" 'no-face "\n" nil +"lorem " 'no-face "[[" markup-meta-face "foo" markup-anchor-face "," markup-meta-face + "bla bli bla blu" markup-secondary-text-face "]]" markup-meta-face "ipsum" 'no-face "\n" nil ;; general inline macro syntax "lorem " 'no-face "anchor" markup-command-face ":" markup-meta-face - "ipsum" markup-anchor-face - "[]" markup-meta-face "\n" nil + "foo" markup-anchor-face + "[]" markup-meta-face "ipsum" 'no-face "\n" nil "lorem " 'no-face "anchor" markup-command-face ":" markup-meta-face - "ipsum" markup-anchor-face - "[" markup-meta-face "dolor sit amet" markup-secondary-text-face"]" markup-meta-face "\n" nil + "foo" markup-anchor-face + "[" markup-meta-face "bla bli bla blu" markup-secondary-text-face "]" markup-meta-face + "ipsum" 'no-face "\n" nil ;; biblio -"[[" markup-meta-face "[X1]" markup-gen-face "]]" markup-meta-face " lorem ipsum\n" 'no-face +"lorem " 'no-face "[[" markup-meta-face "[foo]" markup-gen-face "]]" markup-meta-face + " ipsum\n" 'no-face )) (ert-deftest adoctest-test-images () diff --git a/adoc-mode.el b/adoc-mode.el index bee03fb92a..01473804fc 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -355,12 +355,13 @@ To become a customizable variable when regexps for list items become customizabl ;; not. And maybe markup-faces splits up markup-secondary-text-face into more ;; specific faces. (defvar adoc-attribute-face-alist - '(("caption" . markup-secondary-text-face) -("title" . markup-secondary-text-face) + '(("id" . markup-anchor-face) +("caption" . markup-secondary-text-face) +("xreflabel" . markup-secondary-text-face) ("alt" . markup-secondary-text-face) +("title" . markup-secondary-text-face) ("attribution" . markup-secondary-text-face) -("citetitle" . markup-secondary-text-face) -("xreflabel" . markup-secondary-text-face)) +("citetitle" . markup-secondary-text-face)) "An alist, key=attribute id, value=face.") (defvar adoc-mode-hook nil
[nongnu] elpa/adoc-mode 06f9792fcd 011/199: added further simple tests for constrained/uncronstrained quotes
branch: elpa/adoc-mode commit 06f9792fcd2c7d88abefa10e3c5bee2df20e7ffe Author: Florian Kaufmann Commit: Florian Kaufmann added further simple tests for constrained/uncronstrained quotes --- adoc-mode-test.el | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index f051ef2665..f576cf44df 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -99,12 +99,24 @@ "--" markup-meta-hide-face "\n" nil "\n" nil + ;; note that in unconstraned quotes cases " ipsum " has spaces around, in + ;; constrained quotes case it doesn't + "Lorem " nil "`" markup-meta-hide-face "ipsum" '(markup-typewriter-face markup-verbatim-face) "`" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "+++" markup-meta-hide-face " ipsum " '(markup-typewriter-face markup-verbatim-face) "+++" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "$$" markup-meta-hide-face " ipsum " '(markup-typewriter-face markup-verbatim-face) "$$" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "**" markup-meta-hide-face " ipsum " markup-strong-face "**" markup-meta-hide-face " dolor\n" nil "Lorem " nil "*" markup-meta-hide-face "ipsum" markup-strong-face "*" markup-meta-hide-face " dolor\n" nil - "Lorem " nil "**" markup-meta-hide-face "ipsum" markup-strong-face "**" markup-meta-hide-face " dolor\n" nil "Lorem " nil "``" markup-replacement-face "ipsum" nil "''" markup-replacement-face " dolor\n" nil "Lorem " nil "'" markup-meta-hide-face "ipsum" markup-emphasis-face "'" markup-meta-hide-face " dolor\n" nil "Lorem " nil "`" markup-replacement-face "ipsum" nil "'" markup-replacement-face " dolor\n" nil - "Lorem " nil "++" markup-meta-hide-face "ipsum" nil "++" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "++" markup-meta-hide-face " ipsum " markup-typewriter-face "++" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "+" markup-meta-hide-face "ipsum" markup-typewriter-face "+" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "__" markup-meta-hide-face " ipsum " markup-emphasis-face "__" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "_" markup-meta-hide-face "ipsum" markup-emphasis-face "_" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "##" markup-meta-hide-face " ipsum " markup-gen-face "##" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "#" markup-meta-hide-face "ipsum" markup-gen-face "#" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "~" markup-meta-hide-face " ipsum " markup-subscript-face "~" markup-meta-hide-face " dolor\n" nil + "Lorem " nil "^" markup-meta-hide-face " ipsum " markup-superscript-face "^" markup-meta-hide-face " dolor\n" nil ) (goto-char (point-min)) @@ -113,8 +125,8 @@ (let* ((tmp (get-text-property (point) 'adoctest)) (tmp2 (get-text-property (point) 'face))) (when tmp - (if (listp tmp2) - (ert-should (member tmp tmp2)) + (if (and (listp tmp2) (not (listp tmp))) + (ert-should (and (= 1 (length tmp2)) (equal tmp (car tmp2 (ert-should (equal tmp tmp2 (if (< (point) (point-max)) (forward-char 1)
[nongnu] elpa/adoc-mode d98541046a 087/199: bugfix: fixed regex in adoc-re-anchor
branch: elpa/adoc-mode commit d98541046a1747457dd5fc5e7c0eeffcf930d54a Author: Florian Kaufmann Commit: Florian Kaufmann bugfix: fixed regex in adoc-re-anchor --- adoc-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index 85989a5db8..dec1eeae95 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -980,7 +980,7 @@ this id. If ID is nil, the regexp matches any anchor." ;; ^\[\[(?P[\w\-_]+)(,(?P.*?))?\]\]$ (concat "^\\[\\[" "\\(" (if id (regexp-quote id) (adoc-re-id)) "\\)" - "\\(?:,?\\(.*?\\)\\)?" + "\\(?:,\\(.*?\\)\\)?" "\\]\\][ \t]*$")) ((eq type 'inline-special)
[nongnu] elpa/adoc-mode f1477f70cc 057/199: comment changes
branch: elpa/adoc-mode commit f1477f70cc1c8c2932e0c9592e7c8b28a1e239e5 Author: Florian Kaufmann Commit: Florian Kaufmann comment changes --- adoc-mode.el | 28 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index b14c2b8df4..e9f5911495 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -91,6 +91,9 @@ ;; - Is there something that would remove hard newlines within a paragraph, ;; but just for display, so the paragraph uses the whole buffer length. ;; - are there generic base packages to handle lists / tables? +;; - a readonly view mode where commands for navigation are on short key +;; bindings like alphanum letters +;; - study what other markup modes like rst offer ;; - AsciiDoc related features ;; - Two (or gruadualy fading) display modes: one emphasises to see the ;; AsciiDoc source text, the other emphasises to see how the output will @@ -100,12 +103,13 @@ ;; Bugs: ;; - delimited blocks are supported, but not well at all ;; - Most regexps for highlighting can spawn at most over two lines. -;; - font-lock's multi line capabilities are not used well enough +;; - font-lock's multi line capabilities are not used well enough. At least 2 +;; line spawns should be covered - replace all .*? by .*?\\(?:\n.*?\\)?? ;; ;;; Variables: -(require 'markup-faces) +(require 'markup-faces) ; https://github.com/sensorflo/markup-faces (require 'cl) ; I know, I should remove it, I will, eventually (defconst adoc-mode-version "0.4.0" @@ -1527,9 +1531,6 @@ When LITERAL-P is non-nil, the contained text is literal text." '("alt")) (adoc-kw-inline-macro "xref" nil '(markup-reference-face markup-internal-reference-face) t '(("caption") (("caption" . markup-reference-face - - ;; (list "\\b\\(xref:\\)\\([^ \t\n]*?\\)\\(\\[\\)\\(.*?\\)\\(,.*?\\)?\\(\\]\\)" - ;; '(1 adoc-hide-delimiter) '(2 adoc-delimiter) '(3 adoc-hide-delimiter) '(4 adoc-reference) '(5 adoc-delimiter nil t) '(6 adoc-hide-delimiter)) ;; Macros using default syntax and having default highlighting in adoc-mod (adoc-kw-inline-macro) @@ -1602,8 +1603,6 @@ When LITERAL-P is non-nil, the contained text is literal text." '(2 adoc-reference); link text = anchor id '(3 adoc-hide-delimiter)) ; >> - - ;; index terms ;; todo: ;; - copy asciidocs regexps below @@ -1725,16 +1724,13 @@ ARG is 0, see `adoc-adjust-title-del'." (interactive "p") (adoc-promote-title (- arg))) -;; (defun adoc-set-title-level (&optional arg) -;; "" -;; (interactive "P") -;; (cond -;;() -;; (adoc-modify-title nil arg) -;; (adoc-modify-title 1))) - +;; todo: +;; - adjust while user is typing title +;; - tempo template which uses alreay typed text to insert a 'new' title +;; - auto convert one line title to two line title. is easy&fast to type, but +;; gives two line titles for those liking them (defun adoc-adjust-title-del () - "Adjusts delimiter to match the length of the title's text. + "Adjusts underline length to match the length of the title's text. E.g. after editing a two line title, call `adoc-adjust-title-del' so the underline has the correct length."
[nongnu] elpa/adoc-mode 414e920433 121/199: Avoid some compilation warnings.
branch: elpa/adoc-mode commit 414e920433c5b5eccee9a223980b09a6229a7b28 Author: Tobias Zawada Commit: Tobias Zawada Avoid some compilation warnings. --- adoc-mode.el | 45 +++-- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index ba160e349f..90c02d795e 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -174,7 +174,7 @@ ;;; Variables: (require 'markup-faces) ; https://github.com/sensorflo/markup-faces -(require 'cl) ; I know, I should remove it, I will, eventually +(require 'cl-lib) ;; tempo or tempo-snippet is required later below @@ -333,12 +333,14 @@ AsciiDoc config file would the probably be '^[<>]-{4,}$'" ;; todo: limit value range to 1 or 2 (defcustom adoc-default-title-type 1 "Default title type, see `adoc-title-descriptor'." + :type 'integer :group 'adoc) ;; todo: limit value range to 1 or 2 (defcustom adoc-default-title-sub-type 1 "Default title sub type, see `adoc-title-descriptor'." - :group 'adoc ) + :type 'integer + :group 'adoc) (defcustom adoc-enable-two-line-title t "Wether or not two line titles shall be fontified. @@ -1329,17 +1331,17 @@ text having adoc-reserved set to 'block-del." (setq prevented (and found (or - (some (lambda(x) - (and (match-beginning x) - (text-property-not-all (match-beginning x) - (match-end x) - 'adoc-reserved nil))) - must-free-groups) - (some (lambda(x) - (and (match-beginning x)) - (text-property-any (match-beginning x) -(match-end x) -'adoc-reserved 'block-del)) + (cl-some (lambda(x) +(and (match-beginning x) + (text-property-not-all (match-beginning x) +(match-end x) +'adoc-reserved nil))) + must-free-groups) + (cl-some (lambda(x) +(and (match-beginning x)) +(text-property-any (match-beginning x) + (match-end x) + 'adoc-reserved 'block-del)) no-block-del-groups (when (and found prevented (<= (point) end)) (goto-char (1+ saved-point @@ -2267,7 +2269,8 @@ new customization demands." (setq adoc-font-lock-keywords (adoc-get-font-lock-keywords)) (when (and font-lock-mode (eq major-mode 'adoc-mode)) -(font-lock-fontify-buffer)) +(font-lock-flush) +(font-lock-ensure)) (adoc-easy-menu-define)) @@ -2766,9 +2769,6 @@ NEW-LEVEL-ABS defines the new level absolutely. When both NEW-LEVEL-REL and NEW-LEVEL-ABS are non-nil, NEW-LEVEL-REL takes precedence. When both are nil, level is not affected. -When ARG is nil, it defaults to 1. When ARG is negative, level is -demoted that many levels. If ARG is 0, see `adoc-adjust-title-del'. - When NEW-TYPE is nil, the title type is unaffected. If NEW-TYPE is t, the type is toggled. If it's 1 or 2, the new type is one line title or two line title respectively. @@ -2809,13 +2809,13 @@ and title's text are not preserved, afterwards its always one space." (error "Invalid title sub-type")) ((eq new-sub-type nil) sub-type) ((eq new-sub-type t) (if (eq sub-type 1) 2 1)) - (t (error "NEW-SUB-TYPE has invalid value" + (t (error "NEW-SUB-TYPE has invalid value" (level (nth 2 descriptor)) (new-level (cond ((or (null new-level-rel) (eq new-level-rel 0)) level) ((not (null new-level-rel)) - (let ((x (% (+ level arg) (+ adoc-title-max-level 1 + (let ((x (% (+ level new-level-rel) (+ adoc-title-max-level 1 (if (< x 0) (+ x adoc-title-max-level 1) x))) @@ -2826,7 +2826,7 @@ and title's text are not preserved, afterwards its always one space." (start (nth 4 descriptor)) (end (nth 5 descriptor)) (saved-col (current-column))) - + ;; set new title descriptor (setcar (nthcdr 0 descriptor) new-type-val) (setcar (nthcdr 1 descriptor) new-sub-type-val) @@ -2849,10 +2849,11 @@ and title's text are not preserved, afterwards its always one space." (fo
[nongnu] elpa/adoc-mode e6b8e69843 090/199: bugfix: empty AsciiDoc attributes (e.g. [, ]) caused adoc-mode to enter infinite loop
branch: elpa/adoc-mode commit e6b8e6984360b69ba3e05012f04723fe91fe81db Author: Philip Lord Commit: sensorflo bugfix: empty AsciiDoc attributes (e.g. [,]) caused adoc-mode to enter infinite loop --- adoc-mode-test.el | 14 ++ adoc-mode.el | 2 ++ 2 files changed, 16 insertions(+) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 3889e553da..68ca1efaa4 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -299,6 +299,20 @@ removed before TRANSFORM is evaluated. ;; multiple positional attributes "[" markup-meta-face "hello" markup-value-face "," markup-meta-face "world" markup-value-face "]" markup-meta-face "\n" nil +;; multiple positional attributes, however one or both are empty (really empty or only one space) +"[" markup-meta-face "hello" markup-value-face ",]" markup-meta-face "\n" nil +"[" markup-meta-face "hello" markup-value-face "," markup-meta-face " " markup-value-face "]" markup-meta-face "\n" nil +"[," markup-meta-face "hello" markup-value-face "]" markup-meta-face "\n" nil +"[" markup-meta-face " " markup-value-face "," markup-meta-face "hello" markup-value-face "]" markup-meta-face "\n" nil +"[,]" markup-meta-face "\n" nil +"[," markup-meta-face " " markup-value-face "]" markup-meta-face "\n" nil +"[" markup-meta-face " " markup-value-face ",]" markup-meta-face "\n" nil +"[" markup-meta-face " " markup-value-face "," markup-meta-face " " markup-value-face "]" markup-meta-face "\n" nil + +;; zero positional attributes +"[]" markup-meta-face "\n" nil +"[" markup-meta-face " " markup-value-face "]" markup-meta-face "\n" nil + ;; keyword attribute "[" markup-meta-face "salute" markup-attribute-face "=" markup-meta-face "hello" markup-value-face "]" markup-meta-face "\n" nil ;; keyword attribute where value is a string diff --git a/adoc-mode.el b/adoc-mode.el index 474ef6e74f..2de6492396 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1293,6 +1293,8 @@ text having adoc-reserved set to 'block-del." (face (adoc-attribute-elt-face pos-or-id (get-text-property (match-beginning 0) 'adoc-attribute-list (put-text-property (match-beginning group) (match-end group) 'face face)) (when (numberp pos-or-id) (setq pos-or-id (1+ pos-or-id))) + +(goto-char end2 nil) (defun adoc-facespec-subscript ()
[nongnu] elpa/adoc-mode 2682662c96 118/199: Use mode-* to set var require-final-newline
branch: elpa/adoc-mode commit 2682662c96b784bf6355b33ee94c6d9c05031c5c Author: Luke San Antonio Commit: Luke San Antonio Use mode-* to set var require-final-newline --- adoc-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index 87e9650664..ba160e349f 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -3016,7 +3016,7 @@ Turning on Adoc mode runs the normal hook `adoc-mode-hook'." ;; misc (set (make-local-variable 'page-delimiter) "^<<<+$") - (set (make-local-variable 'require-final-newline) t) + (set (make-local-variable 'require-final-newline) mode-require-final-newline) (set (make-local-variable 'parse-sexp-lookup-properties) t) ;; it's the user's decision whether he wants to set imenu-sort-function to
[nongnu] elpa/adoc-mode d0e5bb31f2 184/199: Remove the aggressive default background of native code blocks
branch: elpa/adoc-mode commit d0e5bb31f28af4313b804cf27f0d7bd12fd91e58 Author: Bozhidar Batsov Commit: Bozhidar Batsov Remove the aggressive default background of native code blocks --- adoc-mode.el | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 65d0ebdbf8..4cd8ddb67f 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -914,11 +914,10 @@ or for footnotes, or for floating text." (defvar adoc-secondary-text-face 'adoc-secondary-text-face) (defface adoc-native-code-face - 'background light)) - (:background "cornsilk" :extend t)) -(((background dark)) - (:background "saddlebrown" :extend t))) - "For code blocks that are highlighted natively." + '((t (:inherit fixed-pitch))) + "For code blocks that are highlighted natively. + +Use it to change the background of the code blocks." :group 'adoc-faces) (defvar adoc-native-code-face 'adoc-native-code-face)
[nongnu] elpa/adoc-mode 9c404a4e2d 042/199: test2
branch: elpa/adoc-mode commit 9c404a4e2d290bb69c0086b4282d2ab35822e1ba Author: Florian Kaufmann Commit: Florian Kaufmann test2 --- adoc-mode-test.el | 6 + adoc-mode.el | 80 +++ 2 files changed, 57 insertions(+), 29 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index e94641a626..2fb9279398 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -168,6 +168,12 @@ "lorem " 'no-face "xref" markup-command-face ":" markup-meta-face "foo" markup-internal-reference-face "[" markup-meta-face "bla bli bla blu" markup-reference-face "]" markup-meta-face "\n" nil + + "lorem " 'no-face "<<" markup-meta-hide-face "foo" markup-reference-face + ">>" markup-meta-hide-face "\n" nil + "lorem " 'no-face "<<" markup-meta-hide-face "foo" markup-internal-reference-face + "," markup-meta-hide-face "bla bli bla blu" markup-reference-face + ">>" markup-meta-hide-face "\n" nil )) (ert-deftest adoctest-test-images () diff --git a/adoc-mode.el b/adoc-mode.el index bc9bd785f9..86d948f453 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -643,20 +643,20 @@ Subgroups: ((eq type 'biblio) "\\(\\[\\[\\)\\(\\[[a-zA-Z0-9_:][a-zA-Z0-9_:.-]*?\\]\\)\\(\\]\\]\\)") ((eq type 'inline-general) (adoc-re-inline-macro "anchor" -(defun adoc-re-attribute-list-elt () +(defun adoc-re-attribute-list-elt (first) "Returns a regexp matching an attribute list elment. Subgroups: 1 attribute name 2 attribute value if given as string 3 attribute value if not given as string" (concat - ",?[ \t\n]*" + "\\=" (unless first ",") "[ \t\n]*" "\\(?:\\([a-zA-Z_]+\\)[ \t\n]*=[ \t\n]*\\)?" ; 1 "\\(?:" ;; regexp for string: See 'Mastering Regular Expressions', chapter 'The ;; Real "Unrolling-the-Loop" Pattern'. "\"\\([^\"\\]*\\(?:.[^\"\\]*\\)*\\)\"[ \t\n]*" "\\|" ; 2 - "\\([^,]+\\)" ; 3 + "\\([^,]*\\)" ; 3 "\\)")) (defun adoc-re-precond (&optional unwanted-chars backslash-allowed disallowed-at-bol) @@ -730,14 +730,14 @@ subgroups: (concat ;; added &<> because those are special chars which are substituted by a ;; entity, which ends in ;, which is prohibited in the ascidoc.conf regexp - (adoc-re-quote-precondition "A-Za-z0-9;:}&<>") + (adoc-re-quote-precondition "A-Za-z0-9_;:}&<>") "\\(\\[[^][]+?\\]\\)?" "\\(" qldel "\\)" "\\([^ \t\n]\\|[^ \t\n].*?\\(?:\n.*?\\)\\{,1\\}?[^ \t\n]\\)" "\\(" qrdel "\\)" ;; BUG: now that Emacs doesn't has look-ahead, the match is too long, and ;; adjancted quotes of the same type wouldn't be recognized. - "\\(?:[^A-Za-z0-9\n]\\|[ \t]*$\\)"))) + "\\(?:[^A-Za-z0-9_\n]\\|[ \t]*$\\)"))) (defun adoc-re-quote (type ldel &optional rdel) (cond @@ -835,7 +835,7 @@ Subgroups: (style "[demshalv]")) (concat "\\(?:" fullspan "\\)?\\(?:" align "\\)?\\(?:" style "\\)?"))) -(defun adoc-kwf-std (end regexp &optional must-free-groups no-block-del-groups) +(defun adoc-kwf-std (end regexp &optional must-free-groups no-block-del-groups attrib-list-group) "Standart function for keywords Intendent to be called from font lock keyword functions. END is @@ -864,6 +864,8 @@ value." no-block-del-groups (when (and found prevented (<= (point) end)) (goto-char (1+ saved-point +(when (and found (not prevented) attrib-list-group) + (adoc-put-text-properies-on-attrib-list (match-beginning attrib-list-group) (match-end attrib-list-group))) (and found (not prevented (defun adoc-kwf-attriblist (end) @@ -1043,19 +1045,19 @@ When LITERAL-P is non-nil, the contained text is literal text." '(3 nil)) ; grumbl, I dont know how to get rid of it `(4 '(face ,(or del-face markup-meta-hide-face) adoc-reserved t) t))); close del -(defun adoc-kw-inline-macro (&optional cmd-name cmd-face target-faces target-meta-p attribute-list) +(defun adoc-kw-inline-macro (&optional cmd-name cmd-face target-faces target-meta-p attribute-list-spec) (list - `(lambda (end) (adoc-kwf-std end ,(adoc-re-inline-macro cmd-name) '(1 2 4 5) '(0))) - `(1 '(face ,(or cmd-face markup-command-face) adoc-reserved t) t) - '(2 '(face markup-meta-face adoc-reserved t) t) ; : - `(3 ,(cond ((not target-faces) markup-meta-face) + `(lambda (end) (adoc-kwf-std end ,(adoc-re-inline-macro cmd-name) '(1 2 4 5) '(0) attribute-list-spec)) + `(1 '(face ,(or cmd-face markup-command-face) adoc-reserved t) t) ; cmd name + '(2 '(face markup-meta-face adoc-reserved t) t) ; : + `(3 ,(cond ((not target-faces) markup-meta-face) ; target ((listp target-faces) `(if (string= (match-string 5) "") ,(car target-faces) ,(cadr target-faces)))
[nongnu] elpa/adoc-mode 411eb48ce9 120/199: Sensorflo/pr35 (#3)
branch: elpa/adoc-mode commit 411eb48ce97ee4cd645d4b759f1de6b44b4d2f6c Author: TobiasZawada Commit: GitHub Sensorflo/pr35 (#3) * edit to remove some of the warnings from flycheck * Re-formulate first comment line of adoctest-trans. Additionally delete some trailing spaces. Co-authored-by: phelanm Co-authored-by: Tobias Zawada --- Cask | 7 adoc-mode-test.el | 100 +- 2 files changed, 60 insertions(+), 47 deletions(-) diff --git a/Cask b/Cask new file mode 100644 index 00..c33321b15e --- /dev/null +++ b/Cask @@ -0,0 +1,7 @@ +(source marmalade) + +(package "adoc-mode" "0.6.2" "a major-mode for editing AsciiDoc files in Emacs") + +(development + (depends-on "adoc-mode") +) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 51d7590c2e..1e48b32eb5 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -1,11 +1,11 @@ ;;; adoc-mode-test.el --- test suite for adoc-mode.el -;;; +;;; ;;; Commentary: -;; +;; ;; Call adoc-test-run to run the test suite -;; +;; ;;; Todo: -;; - test for font lock multiline property +;; - test for font lock multiline property ;; - test for presence of adoc-reserved (we do white-box testing here) ;; - test also with multiple versions of (X)Emacs ;; - compare adoc-mode fontification with actuall output from AsciiDoc, being @@ -22,6 +22,7 @@ ;; - beginning/end of paragraph ;; - side-to-side yes/no with next same construct (defun adoctest-faces (name &rest args) + "Todo document adoctest-faces NAME ARGS." (let ((not-done t) (font-lock-support-mode)) (with-temp-buffer @@ -52,13 +53,13 @@ (setq not-done nil))) (defun adoctest-trans (original-text expected-text transform) - "Calling TRANSFORM on EXPECTED-TEXT, ORIGINAL-TEXT `should' result. + "Calling TRANSFORM on ORIGINAL-TEXT `should' result in EXPECTED-TEXT. ORIGINAL-TEXT is put in an temporary buffer and TRANSFORM is -evaluated using `eval'. The resulting buffer content is compared +evaluated using `eval'. The resulting buffer content is compared to EXPECTED-TEXT. ORIGINAL-TEXT optionaly may contain the following special -charachters. Escaping them is not (yet) supported. They are +charachters. Escaping them is not (yet) supported. They are removed before TRANSFORM is evaluated. ! Position of point before TRANSFORM is evaluated @@ -86,7 +87,7 @@ removed before TRANSFORM is evaluated. (setq pos (1+ pos)) (setq pos-old pos)) (setq new-original-text (concat new-original-text (substring original-text pos-old pos))) - ;; run adoctest-trans-inner for each remembered pos + ;; run adoctest-trans-inner for each remembered pos (while pos-new-list (adoctest-trans-inner new-original-text expected-text transform (car pos-new-list)) (setq pos-new-list (cdr pos-new-list @@ -94,6 +95,7 @@ removed before TRANSFORM is evaluated. (adoctest-trans-inner original-text expected-text transform))) (defun adoctest-trans-inner (original-text expected-text transform &optional pos) + "Todo document adoctest-trans-inner ORIGINAL-TEXT EXPECTED-TEXT TRANSFORM POS." (let ((not-done t) (font-lock-support-mode)) (with-temp-buffer @@ -105,7 +107,7 @@ removed before TRANSFORM is evaluated. (goto-char (1+ (car pos))) (set-mark (1+ (cdr pos (pos - (goto-char (1+ pos + (goto-char (1+ pos ;; exercise (eval transform) ;; verify @@ -240,7 +242,7 @@ removed before TRANSFORM is evaluated. (ert-deftest adoctest-test-comments () (adoctest-faces "comments" -;; as block macro +;; as block macro "// lorem ipsum\n" markup-comment-face "\n" nil ;; as inline macro @@ -364,19 +366,19 @@ removed before TRANSFORM is evaluated. (adoctest-faces "images" ;; block macros ;; empty arglist - "image" markup-complex-replacement-face "::" markup-meta-face + "image" markup-complex-replacement-face "::" markup-meta-face "./foo/bar.png" markup-internal-reference-face "[]" markup-meta-face "\n" nil - ;; pos attribute 0 = alternate text - "image" markup-complex-replacement-face "::" markup-meta-face + ;; pos attribute 0 = alternate text + "image" markup-complex-replacement-face "::" markup-meta-face "./foo/bar.png" markup-internal-reference-face "[" markup-meta-face "lorem ipsum" markup-secondary-text-face "]" markup-meta-face "\n" nil ;; keyword title - "image" markup-complex-replacement-face "::" markup-meta-face + "image" markup-complex-replacement-face "::" markup-meta-face "./foo/bar.png" markup-internal-reference-face "[" markup-meta-face "alt" markup-attribute-face "=" markup-meta-face "lorem ipsum" markup-secondary-text-face "]" markup-meta-face "\n" nil ;; keyword alt and title - "
[nongnu] elpa/adoc-mode 504d490785 055/199: test: running the test is now more smoothly
branch: elpa/adoc-mode commit 504d4907858db9b63b4b0552b8a9a98b9e709a0a Author: Florian Kaufmann Commit: Florian Kaufmann test: running the test is now more smoothly --- adoc-mode-test.el | 37 + 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index d72a663edf..16afb6500b 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -53,9 +53,9 @@ (should (equal tmp tmp2) (if (< (point) (point-max)) (forward-char 1) - (setq not-done nil)) -;; tear-down -(kill-buffer buf-name))) + (setq not-done nil) + ;; tear-down + (kill-buffer buf-name (defun adoctest-trans (original-text expected-text transform-fn &optional args) (let ((pos 0) @@ -80,9 +80,9 @@ ;; exercise (funcall transform-fn args) ;; verify - (should (string-equal (buffer-substring (point-min) (point-max)) expected-text -;; tear-down -(kill-buffer "adoctest-trans"))) + (should (string-equal (buffer-substring (point-min) (point-max)) expected-text))) + ;; tear-down + (kill-buffer "adoctest-trans" (ert-deftest adoctest-test-titles-simple-one-line-before () (adoctest-faces "titles-simple-one-line-before" @@ -510,19 +510,32 @@ (ert-deftest adoctest-pre-test-byte-compile () ;; todo: also test for warnings + (when (file-exists-p "adoc-mode.elc") +(delete-file "adoc-mode.elc")) (should (byte-compile-file (locate-library "adoc-mode.el" t))) (should (load "adoc-mode.el" nil nil t)) + + (when (file-exists-p "adoc-mode-test.elc") +(delete-file "adoc-mode-test.elc")) (should (byte-compile-file (locate-library "adoc-mode-test.el" t))) (should (load "adoc-mode-test.el" nil nil t))) (defun adoc-test-run() (interactive) - (save-buffer "adoc-mode.el") - (save-buffer "adoc-mode-test.el") - ;; todo: execute tests in an smart order: the basic/simple tests first, so - ;; when a complicated test fails one knows that the simple things do work - (ert-run-tests-interactively "^adoctest-pre-test-byte-compile") - (ert-run-tests-interactively "^adoctest-test-")) + (unwind-protect + (progn + (when (get-buffer "*ert*") + (kill-buffer "*ert*")) ; so after a test failed it can be re-run + (save-buffer "adoc-mode.el") + (save-buffer "adoc-mode-test.el") + ;; todo: execute tests in an smart order: the basic/simple tests first, so + ;; when a complicated test fails one knows that the simple things do work + (ert-run-tests-interactively "^adoctest-pre-test-byte-compile") + (ert-run-tests-interactively "^adoctest-test-")) +(when (file-exists-p "adoc-mode.elc") + (delete-file "adoc-mode.elc")) +(when (file-exists-p "adoc-mode-test.elc") + (delete-file "adoc-mode-test.elc" ;;; adoc-mode-test.el ends here
[nongnu] elpa/adoc-mode a805bd9787 071/199: bump version to 0.5.1
branch: elpa/adoc-mode commit a805bd9787febf0ae4ce30a0a03a3245efe5c072 Author: Florian Kaufmann Commit: Florian Kaufmann bump version to 0.5.1 --- adoc-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index a96c0268c8..7629b3fbd5 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -6,7 +6,7 @@ ;; URL: Current official: http://code.google.com/p/adoc-mode/ ;; Develop, future official: https://github.com/sensorflo/adoc-mode ;; Created: 2009 -;; Version: 0.5.0 +;; Version: 0.5.1 ;; Keywords: wp AsciiDoc ;; ;; This file is not part of GNU Emacs. @@ -112,7 +112,7 @@ (require 'markup-faces) ; https://github.com/sensorflo/markup-faces (require 'cl) ; I know, I should remove it, I will, eventually -(defconst adoc-mode-version "0.5.0" +(defconst adoc-mode-version "0.5.1" "adoc mode version number. Based upon AsciiDoc version 8.5.2. I.e. regexeps and rules are
[nongnu] elpa/adoc-mode 21bb167f67 108/199: improved comments and whites
branch: elpa/adoc-mode commit 21bb167f67ad7d4ecf9319e47e4abcf88785e978 Author: sensorflo Commit: sensorflo improved comments and whites --- adoc-mode.el | 37 +++-- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 0ec9216885..7e895caf02 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -677,14 +677,18 @@ To become a customizable variable when regexps for list items become customizabl ;;; Code: + regexps +;; from AsciiDoc manual: The attribute name/value syntax is a single line ... ;; from asciidoc.conf: ;; ^:(?P\w[^.]*?)(\.(?P.*?))?:(\s+(?P.*))?$ - regexps +;; asciidoc src code: AttributeEntry.isnext shows that above regexp is matched +;; against single line. (defun adoc-re-attribute-entry () (concat "^\\(:[a-zA-Z0-9_][^.\n]*?\\(?:\\..*?\\)?:[ \t]*\\)\\(.*?\\)$")) -;; from asciidoc.conf: -;; ^= +(?P[\S].*?)( +=)?$ +;; from asciidoc.conf: ^= +(?P[\S].*?)( +=)?$ +;; asciidoc src code: Title.isnext reads two lines, which are then parsed by +;; Title.parse. The second line is only for the underline of two line titles. (defun adoc-re-one-line-title (level) "Returns a regex matching a one line title of the given LEVEL. When LEVEL is nil, a one line title of any level is matched. @@ -703,8 +707,8 @@ match-data has these sub groups: (make-string (+ level 1) ?=) (concat "=\\{1," (+ adoc-title-max-level 1) "\\}" (concat - "^\\(" del "[ \t]+\\)" ; 1 - "\\([^ \t\n].*?\\)" ; 2 + "^\\(" del "[ \t]+\\)" ; 1 + "\\([^ \t\n].*?\\)" ; 2 ;; using \n instad $ is important so group 3 is guaranteed to be at least 1 ;; char long (except when at the end of the buffer()). That is important to ;; to have a place to put the text property adoc-reserved on. @@ -715,7 +719,8 @@ match-data has these sub groups: (let ((del (make-string (+ level 1) ?=))) (concat del " " text (when (eq sub-type 2) (concat " " del) -;; AsciiDoc handles that by source code, there is no regexp in AsciiDoc +;; AsciiDoc handles that by source code, there is no regexp in AsciiDoc. See +;; also adoc-re-one-line-title. (defun adoc-re-two-line-title-undlerline (&optional del) "Returns a regexp matching the underline of a two line title. @@ -738,8 +743,8 @@ a two line title underline, see also `adoc-re-two-line-title'." ;; also here use \n instead $ "\\)[ \t]*\\(?:\n\\|\\'\\)")) -;; asciidoc.conf regexps for _first_ line -;; ^(?P.*?)$ +;; asciidoc.conf: regexp for _first_ line +;; ^(?P.*?)$ additionally, must contain (?u)\w, see Title.parse (defun adoc-re-two-line-title (del) "Returns a regexps that matches a two line title. @@ -756,9 +761,9 @@ match-data has these sub groups: (when (not (eq (length del) 2)) (error "two line title delimiters must be 2 chars long")) (concat - ;; 1st line: title text must contain at least one \w character. You don't see - ;; that in asciidoc.conf, only in asciidoc source code. - "\\(^.*?[a-zA-Z0-9_].*?\\)[ \t]*\n" + ;; 1st line: title text must contain at least one \w character, see + ;; asciidoc src, Title.parse, + "\\(^.*?[a-zA-Z0-9_].*?\\)[ \t]*\n" ;; 2nd line: underline (adoc-re-two-line-title-undlerline del))) @@ -956,7 +961,8 @@ Subgroups: ;; ^\.(?P([^.\s].*)|(\.[^.\s].*))$ ;; Isn't that asciidoc.conf regexp the same as: ^\.(?P(.?[^.\s].*))$ -;; insertion: so that this whole regex doesn't mistake a line starting with a cell specifier like .2+| as a block title +;; insertion: so that this whole regex doesn't mistake a line starting with a +;; cell specifier like .2+| as a block title (defun adoc-re-block-title () "Returns a regexp matching an block title @@ -974,7 +980,10 @@ Subgroups: "\\|[^. \t\n]\\).*\\)" "\\(\n\\|\\'\\)")) -;; (?u)^(?Pimage|unfloat)::(?P\S*?)(\[(?P.*?)\])$ +;; (?u)^(?Pimage|unfloat|toc)::(?P\S*?)(\[(?P.*?)\])$ +;; note that altough it hasn't got the s Python regular expression flag, it +;; still can spawn multiple lines. Probably asciidoc removes newlines before +;; it applies the regexp above (defun adoc-re-block-macro (&optional cmd-name) "Returns a regexp matching an attribute list elment. Subgroups: @@ -1165,7 +1174,7 @@ subgroups: (error "Invalid type" ;; Macros using default syntax. From asciidoc.conf: -;; (?http|https|ftp|file|irc|mailto|callto|image|link|anchor|xref|indexterm):(?P\S*?)\[(?P.*?)\] +;; (?su)(?http|https|ftp|file|irc|mailto|callto|image|link|anchor|xref|indexterm):(?P\S*?)\[(?P.*?)\] ;; ;; asciidoc.conf itself says: Default (catchall) inline macro is not ;; implemented. It _would_ be
[nongnu] elpa/adoc-mode 888a38beb2 154/199: Bundle the mode's menu definition with the mode's keymap
branch: elpa/adoc-mode commit 888a38beb2287f2bde0ce91f4baec9343aaf8eeb Author: Bozhidar Batsov Commit: Bozhidar Batsov Bundle the mode's menu definition with the mode's keymap --- adoc-mode.el | 331 +-- 1 file changed, 163 insertions(+), 168 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 24cdf9d436..21c8eb09be 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -358,6 +358,168 @@ To become a customizable variable when regexps for list items become customizabl (define-key map "\C-c\C-p" 'adoc-promote) (define-key map "\C-c\C-t" 'adoc-toggle-title-type) (define-key map "\C-c\C-g" 'adoc-goto-ref-label) +(easy-menu-define adoc-mode-menu map "Menu for adoc mode" +`("AsciiDoc" + ["Promote" adoc-promote] + ["Demote" adoc-demote] + ["Toggle title type" adoc-toggle-title-type] + ["Adjust title underline" adoc-adjust-title-del] + ["Goto anchor" adoc-goto-ref-label] + "---" + ;; names|wording / rough order/ help texts are from asciidoc manual + ("Templates / cheat sheet" + ("Text formatting - constrained quotes" +:help ,adoc-help-constrained-quotes +["_Emphasis_" tempo-template-adoc-emphasis + :help ,adoc-help-emphasis ] +["*Strong*" tempo-template-adoc-strong + :help ,adoc-help-strong ] +["+Monospaced+" tempo-template-adoc-monospace + :help ,adoc-help-monospace] +["`Monospaced literal`" tempo-template-adoc-monospace-literal ; redundant to the one in the passthrough section + :help ,adoc-help-monospace-literal] +["`Single quote'" tempo-template-adoc-single-quote + :help ,adoc-help-single-quote] +["``Double quote''" tempo-template-adoc-double-quote + :help ,adoc-help-double-quote] +;; TODO: insert underline, overline, strikethrough, big, small +["[attributes]##text##" tempo-template-adoc-attributed + :help ,adoc-help-attributed]) + ("Text formatting - unconstrained quotes" +:help ,adoc-help-unconstrained-quotes +["^Superscript^" tempo-template-adoc-superscript] +["~Subscript~" tempo-template-adoc-subscript] +["__Emphasis__" tempo-template-adoc-emphasis-uc + :help ,adoc-help-emphasis ] +["**Strong**" tempo-template-adoc-strong-uc + :help ,adoc-help-strong ] +["++Monospaced++" tempo-template-adoc-monospace-uc + :help ,adoc-help-monospace] +["[attributes]##text##" tempo-template-adoc-attributed-uc + :help ,adoc-help-attributed]) + ("Text formatting - misc" +["Line break: +" tempo-template-adoc-line-break + :help ,adoc-help-line-break] +["Page break: <<<" tempo-template-adoc-page-break + :help ,adoc-help-page-break] +["Ruler line: ---" tempo-template-adoc-ruler-line + :help ,adoc-help-ruler-line]) + ("Text formatting - replacements" +["Copyright: (C) \u2192 \u00A9" tempo-template-adoc-copyright] +["Trademark: (TM) \u2192 \u2122" tempo-template-adoc-trademark] +["Registered trademark: (R) \u2192 \u00AE" tempo-template-adoc-registered-trademark] +["Dash: -- \u2192 \u2014" tempo-template-adoc-dash] +["Ellipsis: ... \u2192 \u2026" tempo-template-adoc-ellipsis] +["Right arrow: -> \u2192 \u2192" tempo-template-adoc-right-arrow] +["Left arrow: <- \u2192 \u2190" tempo-template-adoc-left-arrow] +["Right double arrow: => \u2192 \u21D2" tempo-template-adoc-right-double-arrow] +["Left double arrow: <= \u2192 \u21D0" tempo-template-adoc-left-double-arrow] +"---" +["Character entity reference: &...;" tempo-template-adoc-entity-reference + :help ,adoc-help-entity-reference]) + ("Titles" +[,(concat "Document title (level 0): " (adoc-template-str-title 0)) + tempo-template-adoc-title-1] +[,(concat "Section title (level 1): " (adoc-template-str-title 1)) + tempo-template-adoc-title-2] +[,(concat "Section title (level 2): " (adoc-template-str-title 2)) + tempo-template-adoc-title-3] +[,(concat "Section title (level 3): " (adoc-template-str-title 3)) + tempo-template-adoc-title-4] +[,(concat "Section title (level 4): " (adoc-template-str-title 4)) + tempo-template-adoc-title-5] +["Block title: .foo" tempo-template-adoc-block-title] +["BlockId: [[id]]" tempo-template-adoc-anchor]) ; redundant to anchor below + ("Paragraphs" +["Literal paragraph" tempo-template-adoc-literal-paragraph + :help ,adoc-help-literal-paragraph] +"---" +["TIP: " tempo-template-adoc-paragraph-tip] +["NOTE: " tempo-template-adoc-paragraph-note] +["IMPORTANT: " tempo-template-adoc-paragraph-important] +["WARNING: " tempo-template-adoc-paragraph-warning] +["CAUTION: " tempo-template-a
[nongnu] elpa/adoc-mode 303019657d 060/199: many things with xref and anchor
branch: elpa/adoc-mode commit 303019657d2ed5424e4164031649596460a19b0b Author: Florian Kaufmann Commit: Florian Kaufmann many things with xref and anchor enhanced adoc-goto-ref-label added adoc-xref-id-at-point refactored out literal regexp in keyword list to adoc-re-xref bugfix in adoc-re-anchor & adoc-re-inline-macro --- adoc-mode-test.el | 18 adoc-mode.el | 126 +++--- 2 files changed, 109 insertions(+), 35 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index 6263e58fdb..8990056ef1 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -536,6 +536,24 @@ (adoctest-trans "lorem!\n!" "lorem\n=" '(adoc-adjust-title-del)) (adoctest-trans "lorem!\n=!" "lorem\n=" '(adoc-adjust-title-del))) +(ert-deftest adoctest-test-xref-at-point-1 () + (unwind-protect + (progn + (set-buffer (get-buffer-create "adoc-test")) + (insert "lorem xref:bogous1[] ipsum xref:foo[bla\nbli] dolor xref:bogous2[]") + (re-search-backward "bli") ; move point within ref + (should (equal (adoc-xref-id-at-point) "foo"))) +(kill-buffer "adoc-test"))) + +(ert-deftest adoctest-test-xref-at-point-2 () + (unwind-protect + (progn + (set-buffer (get-buffer-create "adoc-test")) + (insert "lorem ipsum <> dolor") + (re-search-backward "bli") ; move point within ref + (should (equal (adoc-xref-id-at-point) "foo"))) +(kill-buffer "adoc-test"))) + (ert-deftest adoctest-pre-test-byte-compile () ;; todo: also test for warnings (when (file-exists-p "adoc-mode.elc") diff --git a/adoc-mode.el b/adoc-mode.el index ff2841cf34..b50b786993 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -670,41 +670,67 @@ Subgroups: 3 attribute list, exclusive brackets []" (concat "^\\(" (or cmd-name "[a-zA-Z0-9_]+") "\\)::\\([^ \t\n]*?\\)\\[\\(.*?\\)\\][ \t]*$")) -(defun adoc-re-anchor (type &optional id) +(defun adoc-re-anchor (&optional type id) "Returns a regexp matching an anchor. +If TYPE is non-nil, only that type is matched. If TYPE is nil, +all types are matched. + If ID is non-nil, the regexp matches an anchor defining exactly this id. If ID is nil, the regexp matches any anchor." (cond ((eq type 'block-id) ;; ^\[\[(?P[\w\-_]+)(,(?P.*?))?\]\]$ (concat "^\\[\\[" - "\\(" (or (regexp-quote id) "[-a-zA-Z0-9_]+") "\\)" + "\\(" (if id (regexp-quote id) "[-a-zA-Z0-9_]+") "\\)" "\\(?:,?\\(.*?\\)\\)?" "\\]\\][ \t]*$")) ((eq type 'inline-special) ;; [\\]?\[\[(?P[\w"_:].*?)\]\] (concat "\\(\\[\\[\\)" - "\\(" (or (concat (regexp-quote id) "[ \t]*?") "[a-zA-Z0-9\"_:].*?") "\\)" + "\\(" (if id (concat (regexp-quote id) "[ \t]*?") "[a-zA-Z0-9\"_:].*?") "\\)" "\\(\\]\\]\\)")) ((eq type 'biblio) ;; [\\]?\[\[\[(?P[\w_:][\w_:.-]*?)\]\]\] (concat "\\(\\[\\[\\)" - "\\(\\[" (or (regexp-quote id) "[a-zA-Z0-9_:][a-zA-Z0-9_:.-]*?") "\\]\\)" + "\\(\\[" (if id (regexp-quote id) "[a-zA-Z0-9_:][a-zA-Z0-9_:.-]*?") "\\]\\)" "\\(\\]\\]\\)")) ((eq type 'inline-general) -(adoc-re-inline-macro "anchor" id +(adoc-re-inline-macro "anchor" id)) + + ((null type) +(mapconcat + (lambda (x) (adoc-re-anchor x id)) + '(block-id inline-special biblio inline-general) + "\\|")) + + (t +(error "Unknown type" -(defun adoc-re-anchor(type) - "Returns a regexp matching an anchor." +(defun adoc-re-xref (&optional type) + "Returns a regexp matching a reference" (cond - ((eq type 'block-id) "^\\[\\[\\([-a-zA-Z0-9_]+\\)\\(?:,?\\(.*?\\)\\)?\\]\\][ \t]*$") - ((eq type 'inline-special) "\\(\\[\\[\\)\\([a-zA-Z0-9\"_:].*?\\)\\(\\]\\]\\)") - ((eq type 'biblio) "\\(\\[\\[\\)\\(\\[[a-zA-Z0-9_:][a-zA-Z0-9_:.-]*?\\]\\)\\(\\]\\]\\)") - ((eq type 'inline-general) (adoc-re-inline-macro "anchor" + ((eq type 'inline-special-with-caption) +;; (?su)[\\]?<<(?P[\w"].*?)>>=xref2 +"\\(<<\\)\\([a-zA-Z0-9\"].*?\\)\\(,\\)\\(.*?\\(?:\n.*?\\)??\\)\\(>>\\)") + + ((eq type 'inline-special-no-caption) +;; asciidoc.conf uses the same regexp as for without caption +"\\(<<\\)\\([a-zA-Z0-9\"].*?\\(?:\n.*?\\)??\\)\\(>>\\)") + + ((eq type 'inline-general-macro) +(adoc-re-inline-macro "xref")) + + ((null type) +(mapconcat + (lambda (x) (adoc-re-xref x)) + '(inline-special-with-caption inline-special-no-caption inline-general-macro) + "\\|")) + + (t (error "unknown type" (defun adoc-re-attribute-list-elt () "Returns a regexp matching an attribute list elment. @@ -831,10 +857,10 @@ Subgroups of returned regexp: 6 ]" ;; !!! \< is not exactly what AsciiDoc does, see regex above (concat - "\\(\\<" (or (regexp-quote cmd-name) "\\w+") "\\)" + "\\(\\<" (if cmd-name (regexp-quote cmd-name) "\\w+") "\\)" "\\(:\\)" - "\\(" (or (regexp-quote
[nongnu] elpa/adoc-mode 0ea3de138a 091/199: refactored adoc-kwf-attriblist
branch: elpa/adoc-mode commit 0ea3de138a7b9b3e059aeb7ed1d56a3657532b11 Author: sensorflo Commit: sensorflo refactored adoc-kwf-attriblist - moved let form deeper down - renamed end2 -> attribute-list-end - added comments --- adoc-mode.el | 40 +--- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 2de6492396..5d05c16011 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1276,25 +1276,27 @@ text having adoc-reserved set to 'block-del." (and found (not prevented (defun adoc-kwf-attriblist (end) - (let* ((end2 end) -pos-or-id) -(while (< (point) end) - (goto-char (or (text-property-not-all (point) end 'adoc-attribute-list nil) -end)) - (when (< (point) end) - (setq pos-or-id 0) - (setq end2 (or (text-property-any (point) end 'adoc-attribute-list nil) - end)) - (while (re-search-forward (adoc-re-attribute-list-elt) end2 t) - (when (match-beginning 1) - (setq pos-or-id (buffer-substring-no-properties (match-beginning 1) (match-end 1))) - (put-text-property (match-beginning 1) (match-end 1) 'face markup-attribute-face)) - (let ((group (if (match-beginning 2) 2 3)) - (face (adoc-attribute-elt-face pos-or-id (get-text-property (match-beginning 0) 'adoc-attribute-list - (put-text-property (match-beginning group) (match-end group) 'face face)) - (when (numberp pos-or-id) (setq pos-or-id (1+ pos-or-id))) - -(goto-char end2 + ;; for each attribute list before END + (while (< (point) end) +(goto-char (or (text-property-not-all (point) end 'adoc-attribute-list nil) + end)) +(when (< (point) end) + (let ((attribute-list-end + (or (text-property-any (point) end 'adoc-attribute-list nil) + end)) +(pos-or-id 0)) + +;; for each attribute in current attribute list +(while (re-search-forward (adoc-re-attribute-list-elt) attribute-list-end t) + (when (match-beginning 1) +(setq pos-or-id (buffer-substring-no-properties (match-beginning 1) (match-end 1))) +(put-text-property (match-beginning 1) (match-end 1) 'face markup-attribute-face)) + (let ((group (if (match-beginning 2) 2 3)) +(face (adoc-attribute-elt-face pos-or-id (get-text-property (match-beginning 0) 'adoc-attribute-list +(put-text-property (match-beginning group) (match-end group) 'face face)) + (when (numberp pos-or-id) (setq pos-or-id (1+ pos-or-id + +(goto-char attribute-list-end nil) (defun adoc-facespec-subscript ()
[nongnu] elpa/adoc-mode d3517e596d 102/199: all special inline macros are now fontified before the general inline macro
branch: elpa/adoc-mode commit d3517e596db60fdcee88629fe8128894535c65f4 Author: sensorflo Commit: sensorflo all special inline macros are now fontified before the general inline macro --- adoc-mode.el | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index a2407c47e3..0faa49e3b1 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -2011,13 +2011,6 @@ considered to be meta characters." '("alt")) (adoc-kw-inline-macro "xref" nil '(markup-reference-face markup-internal-reference-face) t '(("caption") (("caption" . markup-reference-face - - ;; Macros using default syntax and having default highlighting in adoc-mod - (adoc-kw-inline-macro) - - ;; URLs & Email addresses - (adoc-kw-standalone-urls) - (list "\\(\\bfootnote:\\)\\(\\[\\)\\(.*?\\(?:\n.*?\\)?\\)\\(\\]\\)" '(1 adoc-delimiter); name '(2 adoc-hide-delimiter) ; [ @@ -2036,7 +2029,10 @@ considered to be meta characters." '(3 adoc-reference); reference-id to footnote ;; '(3 (adoc-facespec-superscript)) bug: does also fontify the version having anchor-id '(4 adoc-hide-delimiter)) ; ] + (adoc-kw-standalone-urls) + ;; Macros using default syntax and having default highlighting in adoc-mod + (adoc-kw-inline-macro) ;; bibliographic anchor ala [[[id]]] ;; actually in AsciiDoc the part between the innermost brackets is an
[nongnu] elpa/adoc-mode b2d2bcb2cd 138/199: Really kill all the tabs
branch: elpa/adoc-mode commit b2d2bcb2cd592705282bf61a14d9290a9ffea2b1 Author: Bozhidar Batsov Commit: Bozhidar Batsov Really kill all the tabs + some indentation fixes. --- adoc-mode.el | 78 ++-- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index e59771e88b..34e00482d2 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -2692,9 +2692,9 @@ and title's text are not preserved, afterwards its always one space." (+ x adoc-title-max-level 1) x))) ((not (null new-level-abs)) - new-level-abs) - (t - level))) +new-level-abs) + (t +level))) (start (nth 4 descriptor)) (end (nth 5 descriptor)) (saved-col (current-column))) @@ -2706,15 +2706,15 @@ and title's text are not preserved, afterwards its always one space." ;; replace old title by new (let ((end-char (char-before end))) - (beginning-of-line) - (when (and (eq type 2) (looking-at (adoc-re-two-line-title-undlerline))) - (forward-line -1) - (beginning-of-line)) - (delete-region start end) - (insert (adoc-make-title descriptor)) - (when (equal end-char ?\n) - (insert "\n") - (forward-line -1))) +(beginning-of-line) +(when (and (eq type 2) (looking-at (adoc-re-two-line-title-undlerline))) + (forward-line -1) + (beginning-of-line)) +(delete-region start end) +(insert (adoc-make-title descriptor)) +(when (equal end-char ?\n) + (insert "\n") + (forward-line -1))) ;; reposition point (when (and (eq new-type-val 2) (eq type 1)) @@ -2750,18 +2750,18 @@ knowing it. E.g. when `adoc-unichar-name-resolver' is nil." (save-match-data (let (ch) (setq ch -(cond - ;; hex - ((string-match "\\([0-9a-fA-F]+?\\);" entity) - (string-to-number (match-string 1 entity) 16)) - ;; dec - ((string-match "\\([0-9]+?\\);" entity) - (string-to-number (match-string 1 entity))) - ;; name - ((and adoc-unichar-name-resolver - (string-match "&\\(.+?\\);" entity)) - (funcall adoc-unichar-name-resolver - (match-string 1 entity) +(cond + ;; hex + ((string-match "\\([0-9a-fA-F]+?\\);" entity) + (string-to-number (match-string 1 entity) 16)) + ;; dec + ((string-match "\\([0-9]+?\\);" entity) + (string-to-number (match-string 1 entity))) + ;; name + ((and adoc-unichar-name-resolver + (string-match "&\\(.+?\\);" entity)) + (funcall adoc-unichar-name-resolver + (match-string 1 entity) (when (characterp ch) (make-string 1 ch) (defun adoc-face-for-attribute (pos-or-name &optional attribute-list-prop-val) @@ -2796,16 +2796,16 @@ An attribute name is first looked up in LOCAL-ATTRIBUTE-FACE-ALIST before it is looked up in `adoc-attribute-face-alist'." (let* ((has-pos-to-name (listp attribute-list-prop-val)) -(has-local-alist (and has-pos-to-name (listp (car-safe attribute-list-prop-val -(pos-to-name (cond ((not has-pos-to-name) nil) - (has-local-alist (car attribute-list-prop-val)) - (t attribute-list-prop-val))) -(local-attribute-face-alist (when has-local-alist (cadr attribute-list-prop-val))) -(name (cond ((stringp pos-or-name) pos-or-name) - ((numberp pos-or-name) (nth pos-or-name pos-to-name) + (has-local-alist (and has-pos-to-name (listp (car-safe attribute-list-prop-val + (pos-to-name (cond ((not has-pos-to-name) nil) +(has-local-alist (car attribute-list-prop-val)) +(t attribute-list-prop-val))) + (local-attribute-face-alist (when has-local-alist (cadr attribute-list-prop-val))) + (name (cond ((stringp pos-or-name) pos-or-name) + ((numberp pos-or-name) (nth pos-or-name pos-to-name) (or (when name (or (cdr (assoc name local-attribute-face-alist)) -(cdr (assoc name adoc-attribute-face-alist - markup-value-face))) + (cdr (assoc name adoc-attribute-face-alist +markup-value-face))) (defun adoc-imenu-create-index () (let* ((index-alist) @@ -2873,9 +2873,9 @@ Turning on Adoc mode runs the normal hook `adoc-mode-hook'." ;; font lock (set (make-local-variable 'font-lock-defaults) '(adoc-font-lock-keywords -nil nil nil nil -(fon
[nongnu] elpa/adoc-mode 46e8ea4126 129/199: Add Eldev and a GHA workflow based on it
branch: elpa/adoc-mode commit 46e8ea4126ef047c0cc78b394742963c41944142 Author: Bozhidar Batsov Commit: Bozhidar Batsov Add Eldev and a GHA workflow based on it I've also added a bunch of hacking guidelines for potential contributors. --- .github/workflows/test.yml | 34 .gitignore | 1 + Eldev | 1 + README.md | 66 ++ 4 files changed, 102 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00..2767f9852c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: CI + +on: + push: +paths-ignore: ['**.md', '**.adoc'] + pull_request: +paths-ignore: ['**.md', '**.adoc'] + +jobs: + test: +runs-on: ubuntu-latest +continue-on-error: ${{matrix.emacs_version == 'snapshot'}} + +strategy: + matrix: +# Earliest supported + latest in each stable branch + snapshot. +emacs_version: ['25.1', '25.3', '26.3', '27.1', '28.1', 'snapshot'] + +steps: +- name: Set up Emacs + uses: purcell/setup-emacs@master + with: +version: ${{matrix.emacs_version}} + +- name: Install Eldev + run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh + +- name: Check out the source code + uses: actions/checkout@v2 + +- name: Test the project + run: | +eldev -p -dtT -C test --expect 100 +eldev -dtT -C compile --warnings-as-errors diff --git a/.gitignore b/.gitignore index d27fb030ab..3e4ada4c83 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.elc #*# TAGS +.eldev diff --git a/Eldev b/Eldev new file mode 100644 index 00..c51ddaa95a --- /dev/null +++ b/Eldev @@ -0,0 +1 @@ +(eldev-use-package-archive 'melpa) diff --git a/README.md b/README.md index b5185065a4..82e650c062 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[](https://github.com/emacsorphanage/adoc-mode/actions?query=workflow%3ACI) [![MELPA][melpa-badge]][melpa-package] [![MELPA Stable][melpa-stable-badge]][melpa-stable-package] @@ -85,6 +86,71 @@ characters are visible, however meta characters are displayed in a faint way.  +## Hacking + +adoc-mode uses [Eldev](https://github.com/doublep/eldev) for development, so +you should install the tool first. + +The easiest and "purest" way to run adoc-mode is to execute: + +$ eldev emacs + +This will start a separate Emacs process with adoc-mode and its +dependencies available, but _without_ your normal packages installed. +However, you can use `Eldev-local` to add some packages with +`(eldev-add-extra-dependencies 'emacs ...)` forms. See Eldev +documentation for details. + +Alternatively, if you want to load adoc-mode from source code in the Emacs +you use for editing: + +- Generate autoloads file (that's done automatically when installing +via `package.el` but you'll have to do it manually in this case): + +``` shellsession +$ eldev build :autoloads +``` + +- Add to your `.emacs`: + +``` emacs-lisp +;; load adoc-mode from its source code +(add-to-list 'load-path "~/projects/adoc-mode") +(load "adoc-mode-autoloads" t t) +``` + +### Changing the code + +It's perfectly fine to load adoc-mode from `package.el` and then to start making +experiments by changing existing code and adding new code. + +A very good workflow is to just open the source code you've cloned and start +evaluating the code you've altered/added with commands like `C-M-x`, +`eval-buffer` and so on. + +Once you've evaluated the new code, you can invoke some interactive command that +uses it internally or open a Emacs Lisp REPL and experiment with it there. You +can open an Emacs Lisp REPL with `M-x ielm`. + +You can also quickly evaluate some Emacs Lisp code in the minibuffer with `M-:`. + +### Running the tests + +Run all tests with: + + $ eldev test + +NOTE: Tests may not run correctly inside Emacs' `shell-mode` buffers. Running +them in a terminal is recommended. + +You can also check for compliance with a variety of coding standards in batch mode (including docstrings): + + $ eldev lint + +To check for byte-compilation warnings you can just compile the project with Eldev: + + $ eldev compile + ## License Copyright © 2010-2013 Florian Kaufmann
[nongnu] elpa/adoc-mode 2da645a750 040/199: attribute-list can have a local face alist / two faces for target of an inline macro can be specified
branch: elpa/adoc-mode commit 2da645a750e6a96ef4c39054eeff12c9b0c40f01 Author: Florian Kaufmann Commit: Florian Kaufmann attribute-list can have a local face alist / two faces for target of an inline macro can be specified --- adoc-mode.el | 37 + 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 01473804fc..00baff0489 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1043,12 +1043,17 @@ When LITERAL-P is non-nil, the contained text is literal text." '(3 nil)) ; grumbl, I dont know how to get rid of it `(4 '(face ,(or del-face markup-meta-hide-face) adoc-reserved t) t))); close del -(defun adoc-kw-inline-macro (&optional cmd-name cmd-face target-face target-meta-p attribute-list) +(defun adoc-kw-inline-macro (&optional cmd-name cmd-face target-faces target-meta-p attribute-list) (list `(lambda (end) (adoc-kwf-std end ,(adoc-re-inline-macro cmd-name) '(1 2 4 5) '(0))) `(1 '(face ,(or cmd-face markup-command-face) adoc-reserved t) t) '(2 '(face markup-meta-face adoc-reserved t) t) ; : - `(3 ,(or target-face markup-meta-face) ,(if target-meta-p t 'append)) + `(3 ,(cond ((not target-faces) markup-meta-face) + ((listp target-faces) '(if (string= (match-string 5) "") +(car target-faces) + (cadr target-faces))) + (t target-faces)) + ,(if target-meta-p t 'append)) '(4 '(face markup-meta-face adoc-reserved t) t) ; [ `(5 '(face markup-meta-face adoc-attribute-list ,(or attribute-list t)) t) '(6 '(face markup-meta-face adoc-reserved t) t))) ; ] @@ -1477,7 +1482,12 @@ When LITERAL-P is non-nil, the contained text is literal text." ;; Macros using default syntax, but having special highlighting in adoc-mode (adoc-kw-inline-macro "anchor" nil markup-anchor-face t '("xreflabel")) (adoc-kw-inline-macro "image" markup-complex-replacement-face markup-internal-reference-face t '("alt")) + ;; (adoc-kw-inline-macro "xref" nil markup-internal-reference-face t + ;; '(("alt") (("" . ))) + ;; (list "\\b\\(xref:\\)\\([^ \t\n]*?\\)\\(\\[\\)\\(.*?\\)\\(,.*?\\)?\\(\\]\\)" + ;; '(1 adoc-hide-delimiter) '(2 adoc-delimiter) '(3 adoc-hide-delimiter) '(4 adoc-reference) '(5 adoc-delimiter nil t) '(6 adoc-hide-delimiter)) + ;; Macros using default syntax and having default highlighting in adoc-mod (adoc-kw-inline-macro) @@ -1521,9 +1531,9 @@ When LITERAL-P is non-nil, the contained text is literal text." ;; bibliographic anchor ala [[[id]]] - ;; actually the part between the innermost brackets is an attribute list, for - ;; simplicity adoc-mode doesn't really treat it as such. The attrib list can - ;; only contain one element anyway. + ;; actually in AsciiDoc the part between the innermost brackets is an + ;; attribute list, for simplicity adoc-mode doesn't really treat it as such. + ;; The attrib list can only contain one element anyway. (list `(lambda (end) (adoc-kwf-std end ,(adoc-re-anchor 'biblio) '(1 3) '(0))) '(1 '(face markup-meta-face adoc-reserved t) t) ; [[ '(2 markup-gen-face) ; [id] @@ -1548,8 +1558,6 @@ When LITERAL-P is non-nil, the contained text is literal text." '(1 adoc-hide-delimiter) ; << '(2 adoc-reference); link text = anchor id '(3 adoc-hide-delimiter)) ; >> - (list "\\b\\(xref:\\)\\([^ \t\n]*?\\)\\(\\[\\)\\(.*?\\)\\(,.*?\\)?\\(\\]\\)" - '(1 adoc-hide-delimiter) '(2 adoc-delimiter) '(3 adoc-hide-delimiter) '(4 adoc-reference) '(5 adoc-delimiter nil t) '(6 adoc-hide-delimiter)) @@ -1851,11 +1859,16 @@ knowing it. E.g. when `adoc-unichar-name-resolver' is nil." (defun adoc-attribute-elt-face (pos-or-id &optional attribute-list-prop-val) "Returns the face to be used for the given id or position" - (let ((id (cond ((stringp pos-or-id) pos-or-id) - ((and (numberp pos-or-id) (listp attribute-list-prop-val) - (nth pos-or-id attribute-list-prop-val))) - (t nil -(or (when id (cdr (assoc id adoc-attribute-face-alist))) + (let* ((has-pos-to-id (listp attribute-list-prop-val)) +(has-local-alist (and has-pos-to-id (listp (car-safe attribute-list-prop-val +(pos-to-id (cond ((not has-pos-to-id) nil) + (has-local-alist (car attribute-list-prop-val)) + (t attribute-list-prop-val))) +(local-attribute-face-alist (when has-local-alist (cadr attribute-list-prop-val))) +(id (cond ((stringp pos-or-id) pos-or-id) + ((numberp pos-or-id) (nth pos-or-id pos-to-id) +(or (when id (or (cdr (assoc id local-attribute-face-alist)) +(cdr (assoc id adoc-attribute-face-alist markup-value-face))) (def
[nongnu] elpa/adoc-mode 66cd5645a0 130/199: Clean up the front-matter
branch: elpa/adoc-mode commit 66cd5645a00b1f90e9d73e82550a187e296e98cb Author: Bozhidar Batsov Commit: Bozhidar Batsov Clean up the front-matter Basically the whole README was repeated there, which is quite wasteful. I've also killed all the trailing whitespace. --- adoc-mode.el | 394 --- 1 file changed, 131 insertions(+), 263 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 07deba26e8..f83f4e57ed 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1,16 +1,17 @@ ;;; adoc-mode.el --- a major-mode for editing AsciiDoc files in Emacs ;; -;; Copyright 2010-2013 Florian Kaufmann +;; Copyright 2009-2014 Florian Kaufmann +;; Copyright 2022 adoc-mode contributors ;; ;; Author: Florian Kaufmann -;; URL: https://github.com/sensorflo/adoc-mode/wiki +;; URL: https://github.com/emacsorphanage/adoc-mode ;; Created: 2009 ;; Version: 0.6.6 ;; Package-Requires: ((markup-faces "1.0.0")) ;; Keywords: wp AsciiDoc -;; +;; ;; This file is not part of GNU Emacs. -;; +;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) @@ -25,153 +26,21 @@ ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. -;; -;; -;; The syntax of the following commentary section is Markdown, so the same text -;; can be used for the wiki page on GitHub. Also, each paragraph, including list -;; items, are separated by blank lines, so it also looks good on Marmalade. + ;;; Commentary: -;; -;; # Introduction -;; -;; [AsciiDoc](http://www.methods.co.nz/asciidoc/) is a text document format for + +;; AsciiDoc is a text document format for ;; writing short documents, articles, books and UNIX man pages. AsciiDoc files ;; can be translated to HTML and DocBook markups. -;; +;; ;; adoc-mode is an Emacs major mode for editing AsciiDoc files. It emphasizes on ;; the idea that the document is highlighted so it pretty much looks like the ;; final output. What must be bold is bold, what must be italic is italic etc. ;; Meta characters are naturally still visible, but in a faint way, so they can ;; be easily ignored. -;; -;; -;; # Download -;; -;; The raw file (adoc-mode.el) can be found -;; [here](https://raw.github.com/sensorflo/adoc-mode/master/adoc-mode.el). -;; Optionally you can get the sources from the [git -;; repository](https://github.com/sensorflo/adoc-mode). -;; -;; You will also need to download the library -;; [markup-faces](https://github.com/sensorflo/markup-faces). If you install -;; adoc-mode via Emacs Lisp Packages, see below, markup-faces is installed -;; automatically if you don't have it yet. -;; -;; -;; # Installation -;; -;; Installation is as usual, so if you are proficient with Emacs you don't need -;; to read this. -;; -;; ## Install the traditional way -;; -;; 1. Copy the file adoc-mode.el to a directory in your load-path, e.g. -;;\~/.emacs.d. To add a specific directory to the load path, add this to our -;;initialization file (probably ~/.emacs): `(add-to-list 'load-path -;;"mypath")` -;; -;; 2. Add either of the two following lines to your initialization file. The -;;first only loads adoc mode when necessary, the 2nd always during startup -;;of Emacs. -;; -;;* `(autoload 'adoc-mode "adoc-mode" nil t)` -;; -;;* `(require 'adoc-mode)` -;; -;; 3. Optionally byte compile adoc-mode.el for faster startup: `M-x -;;byte-compile` -;; -;; 4. To use adoc mode, call adoc-mode after you opened an AsciiDoc file: `M-x -;;adoc-mode` -;; -;; -;; ## Install via Emacs Lisp Packages (on Marmalade) -;; -;; For this way you either need packages.el from -;; [here](https://github.com/technomancy/package.el) and or Emacs 24, where the -;; packages library is already included. adoc-mode is on the -;; [Marmalade](http://marmalade-repo.org/) package archive. -;; -;; * Type `M-x package-install RET adoc-mode RET`. -;; -;; -;; ## Possible steps after installation -;; -;; Each of the following is optional -;; -;; * According to an old AsciiDoc manual, .txt is the standard file extension of -;; AsciiDoc files. Add the following to your initialization file to open all -;; .txt files with adoc-mode as major mode automatically: `(add-to-list -;; 'auto-mode-alist (cons "\\.txt\\'" 'adoc-mode))`. -;; More recent conventions for AsciiDoc file extensions include `.adoc` and -;; `.asciidoc`, these are associated automatically. -;; -;; * If your default face is a fixed pitch (monospace) face, but in AsciiDoc -;; files you liked to have normal text with a variable pitch face, -;; buffer-face-mode is for you: `(add-hook 'adoc-mode-hook (lambda() -;; (buffer-face-mode t)))` -;; -;; -;; # Features -;; -;; - sophis
[nongnu] elpa/adoc-mode c3d738dd7d 169/199: Fix a typo
branch: elpa/adoc-mode commit c3d738dd7ded1a9bed70727ac52629f7fd2c6848 Author: Bozhidar Batsov Commit: Bozhidar Batsov Fix a typo --- adoc-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc-mode.el b/adoc-mode.el index 5bb07132b6..4381323168 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -2691,7 +2691,7 @@ passed the on-region argument." on-region)) (defun adoc-forward-xref (&optional bound) - "Move forward to next xref and return it's id. + "Move forward to next xref and return its id. Match data is the one of the found xref. Returns nil if there was no xref found."
[nongnu] elpa/adoc-mode 22bd99a194 075/199: test: Use with-temp-buffer instead home-brewed solution
branch: elpa/adoc-mode commit 22bd99a194aecdf61f53a94c27721ff20737d870 Author: Florian Kaufmann Commit: Florian Kaufmann test: Use with-temp-buffer instead home-brewed solution --- adoc-mode-test.el | 93 --- 1 file changed, 41 insertions(+), 52 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index b4259323db..7da1d10287 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -23,39 +23,33 @@ ;; - side-to-side yes/no with next same construct (defun adoctest-faces (name &rest args) (let ((not-done t) - (font-lock-support-mode) - (buf-name (concat "adoctest-" name))) -(unwind-protect - (progn - ;; setup - (set-buffer (get-buffer-create buf-name)) - (delete-region (point-min) (point-max)) - (while args - (insert (propertize (car args) 'adoctest (cadr args))) - (setq args (cddr args))) - - ;; exercise - (adoc-mode) - (font-lock-fontify-buffer) - - ;; verify - (goto-char (point-min)) - (while not-done - (let* ((tmp (get-text-property (point) 'adoctest)) - (tmp2 (get-text-property (point) 'face))) - (cond - ((null tmp)) ; nop - ((eq tmp 'no-face) - (should (null tmp2))) - (t - (if (and (listp tmp2) (not (listp tmp))) - (should (and (= 1 (length tmp2)) (equal tmp (car tmp2 - (should (equal tmp tmp2) - (if (< (point) (point-max)) - (forward-char 1) - (setq not-done nil) - ;; tear-down - (kill-buffer buf-name + (font-lock-support-mode)) +(with-temp-buffer + ;; setup + (while args + (insert (propertize (car args) 'adoctest (cadr args))) + (setq args (cddr args))) + + ;; exercise + (adoc-mode) + (font-lock-fontify-buffer) + + ;; verify + (goto-char (point-min)) + (while not-done + (let* ((tmp (get-text-property (point) 'adoctest)) + (tmp2 (get-text-property (point) 'face))) + (cond + ((null tmp)) ; nop + ((eq tmp 'no-face) + (should (null tmp2))) + (t + (if (and (listp tmp2) (not (listp tmp))) + (should (and (= 1 (length tmp2)) (equal tmp (car tmp2 + (should (equal tmp tmp2) + (if (< (point) (point-max)) + (forward-char 1) + (setq not-done nil))) (defun adoctest-trans (original-text expected-text transform) "Calling TRANSFORM on EXPECTED-TEXT, ORIGINAL-TEXT `should' result. @@ -102,25 +96,20 @@ removed before TRANSFORM is evaluated. (defun adoctest-trans-inner (original-text expected-text transform &optional pos) (let ((not-done t) (font-lock-support-mode)) -(unwind-protect - (progn - ;; setup - (set-buffer (get-buffer-create "adoctest-trans")) - (delete-region (point-min) (point-max)) - (adoc-mode) - (insert original-text) - (cond ; 1+: buffer pos starts at 1, but string pos at 0 - ((consp pos) - (goto-char (1+ (car pos))) - (set-mark (1+ (cdr pos - (pos - (goto-char (1+ pos - ;; exercise - (eval transform) - ;; verify - (should (string-equal (buffer-substring (point-min) (point-max)) expected-text))) - ;; tear-down - (kill-buffer "adoctest-trans" +(with-temp-buffer + ;; setup + (adoc-mode) + (insert original-text) + (cond ; 1+: buffer pos starts at 1, but string pos at 0 + ((consp pos) + (goto-char (1+ (car pos))) + (set-mark (1+ (cdr pos + (pos + (goto-char (1+ pos + ;; exercise + (eval transform) + ;; verify + (should (string-equal (buffer-substring (point-min) (point-max)) expected-text) (ert-deftest adoctest-test-titles-simple-one-line-before () (adoctest-faces "titles-simple-one-line-before"
[nongnu] elpa/adoc-mode ff382b94de 181/199: Improve the configuration docs
branch: elpa/adoc-mode commit ff382b94de9f9c80be896297dc5fc7a3373527e9 Author: Bozhidar Batsov Commit: Bozhidar Batsov Improve the configuration docs --- README.adoc | 59 --- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/README.adoc b/README.adoc index 71fb83755d..5dc1aca01c 100644 --- a/README.adoc +++ b/README.adoc @@ -86,24 +86,30 @@ or if you're into `use-package`: === General -* According to an old AsciiDoc manual, `.txt` is the standard file extension of - AsciiDoc files. Add the following to your initialization file to open all - `.txt` files with adoc-mode as major mode automatically: `(add-to-list - 'auto-mode-alist (cons "\\.txt\\'" 'adoc-mode))`. - More recent conventions for AsciiDoc file extensions include `.adoc` and - `.asciidoc`, these are associated with `adoc-mode` automatically. - -* If your default face is a fixed pitch (monospace) face, but in AsciiDoc - files you liked to have normal text with a variable pitch face, - `buffer-face-mode` is for you: `(add-hook 'adoc-mode-hook (lambda() - (buffer-face-mode t)))` - -* Settings regarding native fontification of source blocks: -** Native fontification of source blocks can be switched off by setting `adoc-fontify-code-blocks-natively` to `nil`. -** Native fontification of lengthy code blocks can cause performance problems. If the value of `adoc-fontify-code-blocks-natively` is an integer only those code blocks are fontified natively whose length is less or equal to that value. -** To avoid performance problems with code block beginnings that do not have a matching end yet the scanning for the code block end is delimited by `adoc-font-lock-extend-after-change-max`. -** All programming languages `XYZ` that have an Emacs major mode `XYZ-mode` and use `font-lock` are automatically supported. Some other languages not fitting into that name scheme are supported through the alist `adoc-code-lang-modes`. You can add your own languages and modes there if they work based on `font-lock` and are not automatically supported. -** The fall-back language mode is `prog-mode` without any fontification. You can set your own default by `adoc-fontify-code-block-default-mode`. +According to an old AsciiDoc manual, `.txt` is the standard file extension of +AsciiDoc files. Add the following to your initialization file to open all `.txt` +files with adoc-mode as major mode automatically: + +[source,emacs-lisp] + +(add-to-list 'auto-mode-alist (cons "\\.txt\\'" 'adoc-mode)) + + +Modern conventions for AsciiDoc file extensions favor `.adoc` and +`.asciidoc` and they are associated with `adoc-mode` automatically. + +You can see a list of all configuration options offered by `adoc-mode` by running the following command - kbd:[M-x] `customize-group adoc`. + +=== Native Syntax Highlighting of Source Code Blocks + +Out-of-the-box `adoc-mode` will try to apply native font-locking to source code blocks (e.g. the same font-locking that `ruby-mode` would use for Ruby code blocks). +This can be tweaked by several configuration options: + +* Native fontification of source blocks can be switched off by setting `adoc-fontify-code-blocks-natively` to `nil`. +* Native fontification of lengthy code blocks can cause performance problems. If the value of `adoc-fontify-code-blocks-natively` is an integer only those code blocks are fontified natively whose length is less or equal to that value. +* To avoid performance problems with code block beginnings that do not have a matching end yet the scanning for the code block end is delimited by `adoc-font-lock-extend-after-change-max`. +* All programming languages `XYZ` that have an Emacs major mode `XYZ-mode` and use `font-lock` are automatically supported. Some other languages not fitting into that name scheme are supported through the alist `adoc-code-lang-modes`. You can add your own languages and modes there if they work based on `font-lock` and are not automatically supported. +* The fall-back language mode is `prog-mode` without any fontification. You can set your own default by `adoc-fontify-code-block-default-mode`. === Syntax Highlighting Customization @@ -126,7 +132,7 @@ kbd:[M-x] `describe-face` One possible solution to change the look of a face is to use the built-in `use-package` feature `:custom-face`. -Example +Example: [source,emacs-lisp] @@ -139,6 +145,21 @@ Example Of course, this is only one way to do it. Emacs has a few ways to customize faces. Simply, pick the one you prefer. +If your default face is a fixed pitch (monospace) face, but in AsciiDoc files +you liked to have normal text with a variable pitch face, `buffer-face-mode` +is one good options for you: + +[source,emacs-lisp] + +(defun my-buffer-face-mode-variable () + "Set font to a variable width (proportional) fonts in current buffer." + (interactive) + (setq buffer-face-mode-face '(:family "DejaVu Sans"
[nongnu] elpa/adoc-mode d80b29ebc9 072/199: test: bugfix: point was wronly positioned in adoctest-trans
branch: elpa/adoc-mode commit d80b29ebc93e24109db3d9be3eb7bbdc9d88bed4 Author: Florian Kaufmann Commit: Florian Kaufmann test: bugfix: point was wronly positioned in adoctest-trans --- adoc-mode-test.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adoc-mode-test.el b/adoc-mode-test.el index d91ed4915f..70ec52bb9b 100644 --- a/adoc-mode-test.el +++ b/adoc-mode-test.el @@ -90,7 +90,7 @@ (adoc-mode) (insert original-text) (when pos - (goto-char pos)) + (goto-char (1+ pos))) ; buffer pos starts at 1, but string pos at 0 ;; exercise (eval transform) ;; verify @@ -650,7 +650,8 @@ ;; todo: execute tests in an smart order: the basic/simple tests first, so ;; when a complicated test fails one knows that the simple things do work (adoc-test-save-compile-load) - (ert-run-tests-interactively "^adoctest-test-")) + (ert-run-tests-interactively "^adoctest-test-") + ) (when (file-exists-p "adoc-mode.elc") (delete-file "adoc-mode.elc")) (when (file-exists-p "adoc-mode-test.elc")