diff options
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/.emacs.d/init/ycp-buffer.el | 2 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-libgen.el | 2 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/wiki.el | 24 |
3 files changed, 17 insertions, 11 deletions
diff --git a/emacs/.emacs.d/init/ycp-buffer.el b/emacs/.emacs.d/init/ycp-buffer.el index 3c9f339..bb8b1dd 100644 --- a/emacs/.emacs.d/init/ycp-buffer.el +++ b/emacs/.emacs.d/init/ycp-buffer.el @@ -71,7 +71,7 @@ ;; Scrolling behaviour (setq-default scroll-conservatively 1 ; affects `scroll-step' scroll-margin 0 - next-screen-context-lines 0) + next-screen-context-lines 2) (mouse-wheel-mode 1) (define-key global-map (kbd "C-M-<mouse-3>") #'tear-off-window)) diff --git a/emacs/.emacs.d/lisp/my/my-libgen.el b/emacs/.emacs.d/lisp/my/my-libgen.el index 09a663a..c7fad33 100644 --- a/emacs/.emacs.d/lisp/my/my-libgen.el +++ b/emacs/.emacs.d/lisp/my/my-libgen.el @@ -151,7 +151,7 @@ (format "%s/main/%s" my-libgen-library-host (alist-get 'md5 info)) (format "\\.%s$" (alist-get 'extension info)))) - (format "%s/%s" my-libgen-download-dir + (format "%s/%s" (expand-file-name my-libgen-download-dir) (my-libgen-format-filename info))))) (defvar my-libgen-button-keymap diff --git a/emacs/.emacs.d/lisp/my/wiki.el b/emacs/.emacs.d/lisp/my/wiki.el index 03a13ec..c1ea064 100644 --- a/emacs/.emacs.d/lisp/my/wiki.el +++ b/emacs/.emacs.d/lisp/my/wiki.el @@ -63,8 +63,9 @@ (cons "'''[^ \t\n'].*?[^ \t\n']'''" 'wiki-bold) (cons "''[^ \t\n'].*?[^ \t\n']''" 'wiki-italic) (cons "^ .*$" 'wiki-pre-face) + '(wiki-activate-external-links) + '(wiki-activate-internal-links) )) -(defvar wiki-font-lock-keywords nil) (defvar wiki-outline-regexp "=+.*=+\ *$") @@ -75,24 +76,30 @@ 6))) ;; Like `org-activate-links' -(defun wiki-activate-links (link-re) +(defun wiki-activate-links (link-re limit) (save-excursion (goto-char (point-min)) - (while (re-search-forward link-re nil t) + (while (re-search-forward link-re limit t) (let ((start (match-beginning 0)) (end (match-end 0)) (visible-start (or (match-beginning 2) (match-beginning 1))) (visible-end (or (match-end 2) (match-end 1))) ) (put-text-property start visible-start 'invisible t) - (put-text-property visible-start visible-end 'font-lock-face 'wiki-link) + (put-text-property start end 'font-lock-face 'wiki-link) (put-text-property visible-end end 'invisible t) (add-text-properties (1- visible-start) visible-start - '(rear-nonsticky invisible)) - (add-text-properties (1- visible-start) visible-start - '(rear-nonsticky invisible)) + '(rear-nonsticky (invisible))) + (add-text-properties (1- visible-end) visible-end + '(rear-nonsticky (invisible))) )))) +(defun wiki-activate-internal-links (limit) + (wiki-activate-links wiki-internal-link-re limit)) + +(defun wiki-activate-external-links (limit) + (wiki-activate-links wiki-external-link-re limit)) + (define-derived-mode wiki-mode outline-mode "Wiki" "A wikitext mode." @@ -103,8 +110,7 @@ (setq-local font-lock-defaults '(wiki-font-lock-keywords t nil nil nil)) (setq-local outline-regexp wiki-outline-regexp) (setq-local outline-level 'wiki-outline-level) - (wiki-activate-links wiki-external-link-re) - (wiki-activate-links wiki-internal-link-re)) + ) (provide 'wiki) ;;; wiki.el ends here |