Skip to content

Commit 4d44c6a

Browse files
committed
Fix lint warnings and byte compilation warnings
1 parent f285a34 commit 4d44c6a

File tree

1 file changed

+99
-96
lines changed

1 file changed

+99
-96
lines changed

markdown-mode.el

+99-96
Original file line numberDiff line numberDiff line change
@@ -3384,76 +3384,6 @@ the buffer)."
33843384
(defun markdown-match-yaml-metadata-key (last)
33853385
(markdown-match-propertized-text 'markdown-metadata-key last))
33863386

3387-
(defun markdown-fontify-wiki-links (last)
3388-
"Add text properties to next wiki link from point to LAST."
3389-
(when (and markdown-enable-wiki-links
3390-
(markdown-match-inline-generic markdown-regex-wiki-link last))
3391-
(let* ((begin (match-beginning 1))
3392-
(end (match-end 1))
3393-
(beg2 (match-beginning 2))
3394-
(end2 (match-end 2))
3395-
(beg3 (match-beginning 3))
3396-
(end3 (match-end 3))
3397-
(beg4 (match-beginning 4))
3398-
(end4 (match-end 4))
3399-
(beg5 (match-beginning 5))
3400-
(end5 (match-end 5))
3401-
(beg6 (match-beginning 6))
3402-
(end6 (match-end 6))
3403-
(part1 (match-string-no-properties 3))
3404-
(part2 (match-string-no-properties 5))
3405-
(aliasp (string-equal (match-string-no-properties 4) "|"))
3406-
(file-name (markdown-convert-wiki-link-to-filename (markdown-wiki-link-link)))
3407-
(file-missing-p (not (file-exists-p file-name))))
3408-
(if (or (markdown-in-comment-p begin)
3409-
(markdown-in-comment-p end)
3410-
(markdown-inline-code-at-pos-p begin)
3411-
(markdown-inline-code-at-pos-p end)
3412-
(markdown-code-block-at-pos begin))
3413-
(progn (goto-char (min (1+ begin) last))
3414-
(when (< (point) last)
3415-
(markdown-fontify-wiki-links last)))
3416-
;; Add text properties for hiding markup
3417-
(progn
3418-
;; Propertize opening and closing brackets
3419-
(remove-text-properties begin end '(font-lock-face nil))
3420-
(add-text-properties beg2 end2 markup-props)
3421-
(add-face-text-property beg2 end2 'markdown-markup-face)
3422-
(add-text-properties beg6 end6 markup-props)
3423-
(add-face-text-property beg6 end6 'markdown-markup-face)
3424-
(if aliasp
3425-
(progn
3426-
;; Propertize pipe separating URL from link text
3427-
(add-text-properties beg4 end4 markup-props)
3428-
(add-face-text-property beg4 end4 'markdown-markup-face)
3429-
(if markdown-wiki-link-alias-first
3430-
(progn
3431-
;; Properties alias portion of link
3432-
(add-text-properties beg3 end3 (link-props part2))
3433-
(add-face-text-property beg3 end3 'markdown-link-face)
3434-
(add-text-properties beg5 end5 url-props)
3435-
(add-text-properties beg5 end5 '(invisible markdown-markup))
3436-
(add-face-text-property beg5 end5 'markdown-url-face)
3437-
(when (and file-missing-p markdown-wiki-link-fontify-missing)
3438-
(put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face)))
3439-
(progn
3440-
;; Properties URL portion of link
3441-
(add-text-properties beg3 end3 url-props)
3442-
(add-text-properties beg3 end3 '(invisible markdown-markup))
3443-
(add-face-text-property beg3 end3 'markdown-url-face)
3444-
(add-text-properties beg5 end5 (link-props part1))
3445-
(add-face-text-property beg5 end5 'markdown-link-face)
3446-
(when (and file-missing-p markdown-wiki-link-fontify-missing)
3447-
(put-text-property beg5 end5 'font-lock-face 'markdown-missing-link-face)))))
3448-
(progn
3449-
;; Properties link as link text
3450-
(add-text-properties beg3 end3 (link-props part1))
3451-
(add-face-text-property beg3 end3 'markdown-link-face)
3452-
(when (and file-missing-p markdown-wiki-link-fontify-missing)
3453-
(put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face)))))
3454-
(set-match-data (list begin end))
3455-
t))))
3456-
34573387
(defun markdown-match-inline-attributes (last)
34583388
"Match inline attributes from point to LAST."
34593389
;; #428 re-search-forward markdown-regex-inline-attributes is very slow.
@@ -5757,6 +5687,29 @@ Assumes match data is available for `markdown-regex-italic'."
57575687
"Keymap for `gfm-mode'.
57585688
See also `markdown-mode-map'.")
57595689

5690+
5691+
;;; Text Properties ===========================================================
5692+
5693+
(defconst markdown--markup-props (list 'invisible 'markdown-markup
5694+
'rear-nonsticky t
5695+
'font-lock-multiline t))
5696+
5697+
(defconst markdown--url-props (list 'invisible 'markdown-markup
5698+
'keymap markdown-mode-mouse-map
5699+
'mouse-face 'markdown-highlight-face
5700+
'font-lock-multiline t))
5701+
5702+
(defconst markdown--title-props (list 'invisible 'markdown-markup
5703+
'font-lock-multiline t))
5704+
5705+
(defun markdown--link-props (url &optional title)
5706+
"Return a property list for URL with optional TITLE."
5707+
(let ((echo-text (if title (concat title "\n" url) url)))
5708+
(list 'keymap markdown-mode-mouse-map
5709+
'mouse-face 'markdown-highlight-face
5710+
'font-lock-multiline t
5711+
'help-echo echo-text)))
5712+
57605713

57615714
;;; Menu ======================================================================
57625715

@@ -8222,26 +8175,6 @@ Translate filenames using `markdown-filename-translate-function'."
82228175
(markdown--browse-url (markdown-link-url)))
82238176
(user-error "Point is not at a Markdown link or URL")))
82248177

8225-
(defconst markup-props (list 'invisible 'markdown-markup
8226-
'rear-nonsticky t
8227-
'font-lock-multiline t))
8228-
8229-
(defconst url-props (list 'invisible 'markdown-markup
8230-
'keymap markdown-mode-mouse-map
8231-
'mouse-face 'markdown-highlight-face
8232-
'font-lock-multiline t))
8233-
8234-
(defconst title-props (list 'invisible 'markdown-markup
8235-
'font-lock-multiline t))
8236-
8237-
(defun link-props (url &optional title)
8238-
"Return a property list for URL with optional TITLE."
8239-
(let ((echo-text (if title (concat title "\n" url) url)))
8240-
(list 'keymap markdown-mode-mouse-map
8241-
'mouse-face 'markdown-highlight-face
8242-
'font-lock-multiline t
8243-
'help-echo echo-text)))
8244-
82458178
(defun markdown-fontify-inline-links (last)
82468179
"Add text properties to next inline link from point to LAST."
82478180
(when (markdown-match-generic-links last nil)
@@ -8256,17 +8189,17 @@ Translate filenames using `markdown-filename-translate-function'."
82568189
(url-char (markdown--first-displayable markdown-url-compose-char)))
82578190
(dolist (g '(1 2 4 5 8))
82588191
(when (match-end g)
8259-
(add-text-properties (match-beginning g) (match-end g) markup-props)
8192+
(add-text-properties (match-beginning g) (match-end g) markdown--markup-props)
82608193
(add-face-text-property (match-beginning g) (match-end g) 'markdown-markup-face)))
82618194
;; Preserve existing faces applied to link part (e.g., inline code)
82628195
(when link-start
8263-
(add-text-properties link-start link-end (link-props url title))
8196+
(add-text-properties link-start link-end (markdown--link-props url title))
82648197
(add-face-text-property link-start link-end 'markdown-link-face))
82658198
(when url-start
8266-
(add-text-properties url-start url-end url-props)
8199+
(add-text-properties url-start url-end markdown--url-props)
82678200
(add-face-text-property url-start url-end 'markdown-url-face))
82688201
(when title-start
8269-
(add-text-properties url-end title-end title-props)
8202+
(add-text-properties url-end title-end markdown--title-props)
82708203
(add-face-text-property url-end title-end 'markdown-link-title-face))
82718204
(when (and markdown-hide-urls url-start)
82728205
(compose-region url-start (or title-end url-end) url-char))
@@ -8296,7 +8229,7 @@ Translate filenames using `markdown-filename-translate-function'."
82968229
'font-lock-multiline t)))
82978230
(dolist (g '(1 2 4 5 8))
82988231
(when (match-end g)
8299-
(add-text-properties (match-beginning g) (match-end g) markup-props)
8232+
(add-text-properties (match-beginning g) (match-end g) markdown--markup-props)
83008233
(add-face-text-property (match-beginning g) (match-end g) 'markdown-markup-face)))
83018234
(when link-start
83028235
(add-text-properties link-start link-end lp)
@@ -8308,6 +8241,76 @@ Translate filenames using `markdown-filename-translate-function'."
83088241
(compose-region ref-start ref-end url-char)))
83098242
t)))
83108243

8244+
(defun markdown-fontify-wiki-links (last)
8245+
"Add text properties to next wiki link from point to LAST."
8246+
(when (and markdown-enable-wiki-links
8247+
(markdown-match-inline-generic markdown-regex-wiki-link last))
8248+
(let* ((begin (match-beginning 1))
8249+
(end (match-end 1))
8250+
(beg2 (match-beginning 2))
8251+
(end2 (match-end 2))
8252+
(beg3 (match-beginning 3))
8253+
(end3 (match-end 3))
8254+
(beg4 (match-beginning 4))
8255+
(end4 (match-end 4))
8256+
(beg5 (match-beginning 5))
8257+
(end5 (match-end 5))
8258+
(beg6 (match-beginning 6))
8259+
(end6 (match-end 6))
8260+
(part1 (match-string-no-properties 3))
8261+
(part2 (match-string-no-properties 5))
8262+
(aliasp (string-equal (match-string-no-properties 4) "|"))
8263+
(file-name (markdown-convert-wiki-link-to-filename (markdown-wiki-link-link)))
8264+
(file-missing-p (not (file-exists-p file-name))))
8265+
(if (or (markdown-in-comment-p begin)
8266+
(markdown-in-comment-p end)
8267+
(markdown-inline-code-at-pos-p begin)
8268+
(markdown-inline-code-at-pos-p end)
8269+
(markdown-code-block-at-pos begin))
8270+
(progn (goto-char (min (1+ begin) last))
8271+
(when (< (point) last)
8272+
(markdown-fontify-wiki-links last)))
8273+
;; Add text properties for hiding markup
8274+
(progn
8275+
;; Propertize opening and closing brackets
8276+
(remove-text-properties begin end '(font-lock-face nil))
8277+
(add-text-properties beg2 end2 markdown--markup-props)
8278+
(add-face-text-property beg2 end2 'markdown-markup-face)
8279+
(add-text-properties beg6 end6 markdown--markup-props)
8280+
(add-face-text-property beg6 end6 'markdown-markup-face)
8281+
(if aliasp
8282+
(progn
8283+
;; Propertize pipe separating URL from link text
8284+
(add-text-properties beg4 end4 markdown--markup-props)
8285+
(add-face-text-property beg4 end4 'markdown-markup-face)
8286+
(if markdown-wiki-link-alias-first
8287+
(progn
8288+
;; Properties alias portion of link
8289+
(add-text-properties beg3 end3 (markdown--link-props part2))
8290+
(add-face-text-property beg3 end3 'markdown-link-face)
8291+
(add-text-properties beg5 end5 markdown--url-props)
8292+
(add-text-properties beg5 end5 '(invisible markdown-markup))
8293+
(add-face-text-property beg5 end5 'markdown-url-face)
8294+
(when (and file-missing-p markdown-wiki-link-fontify-missing)
8295+
(put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face)))
8296+
(progn
8297+
;; Properties URL portion of link
8298+
(add-text-properties beg3 end3 markdown--url-props)
8299+
(add-text-properties beg3 end3 '(invisible markdown-markup))
8300+
(add-face-text-property beg3 end3 'markdown-url-face)
8301+
(add-text-properties beg5 end5 (markdown--link-props part1))
8302+
(add-face-text-property beg5 end5 'markdown-link-face)
8303+
(when (and file-missing-p markdown-wiki-link-fontify-missing)
8304+
(put-text-property beg5 end5 'font-lock-face 'markdown-missing-link-face)))))
8305+
(progn
8306+
;; Properties link as link text
8307+
(add-text-properties beg3 end3 (markdown--link-props part1))
8308+
(add-face-text-property beg3 end3 'markdown-link-face)
8309+
(when (and file-missing-p markdown-wiki-link-fontify-missing)
8310+
(put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face)))))
8311+
(set-match-data (list begin end))
8312+
t))))
8313+
83118314
(defun markdown-fontify-angle-uris (last)
83128315
"Add text properties to angle URIs from point to LAST."
83138316
(when (markdown-match-angle-uris last)
@@ -8319,7 +8322,7 @@ Translate filenames using `markdown-filename-translate-function'."
83198322
'mouse-face 'markdown-highlight-face
83208323
'font-lock-multiline t)))
83218324
(dolist (g '(1 3))
8322-
(add-text-properties (match-beginning g) (match-end g) markup-props))
8325+
(add-text-properties (match-beginning g) (match-end g) markdown--markup-props))
83238326
(add-text-properties url-start url-end up)
83248327
t)))
83258328

0 commit comments

Comments
 (0)