No NARF, only DOOM
This commit is contained in:
parent
a984bf4f26
commit
ad225d2591
104 changed files with 1404 additions and 1409 deletions
|
@ -1,6 +1,6 @@
|
|||
;;; defuns-cc.el --- for module-cc.el
|
||||
|
||||
(defun narf--c-lineup-inclass (langelem)
|
||||
(defun doom--c-lineup-inclass (langelem)
|
||||
(let ((inclass (assoc 'inclass c-syntactic-context)))
|
||||
(save-excursion
|
||||
(goto-char (c-langelem-pos inclass))
|
||||
|
@ -10,7 +10,7 @@
|
|||
'++))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/c-lineup-arglist (orig-fun &rest args)
|
||||
(defun doom/c-lineup-arglist (orig-fun &rest args)
|
||||
"Improve indentation of continued C++11 lambda function opened as argument."
|
||||
(if (and (eq major-mode 'c++-mode)
|
||||
(ignore-errors
|
||||
|
@ -23,7 +23,7 @@
|
|||
(apply orig-fun args)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|init-c/c++-settings ()
|
||||
(defun doom|init-c/c++-settings ()
|
||||
(when (memq major-mode '(c-mode c++-mode objc-mode))
|
||||
(c-toggle-electric-state -1)
|
||||
(c-toggle-auto-newline -1)
|
||||
|
@ -33,7 +33,7 @@
|
|||
(c-set-offset 'brace-list-open '+) ; all "opens" should be indented by the c-indent-level
|
||||
(c-set-offset 'case-label '+) ; indent case labels by c-indent-level, too
|
||||
(c-set-offset 'access-label '-)
|
||||
(c-set-offset 'inclass 'narf--c-lineup-inclass)
|
||||
(c-set-offset 'inclass 'doom--c-lineup-inclass)
|
||||
(c-set-offset 'arglist-intro '+)
|
||||
(c-set-offset 'arglist-close '0)
|
||||
;; Certain mappings interfere with smartparens and custom bindings
|
||||
|
@ -52,11 +52,11 @@
|
|||
(define-key c++-mode-map "}" nil)
|
||||
;; FIXME: fix smartparens
|
||||
;; (define-key c++-mode-map ">" nil)
|
||||
(map! :map (c-mode-base-map c++-mode-map) :i ">" 'narf/autoclose->-maybe)
|
||||
(map! :map (c-mode-base-map c++-mode-map) :i ">" 'doom/autoclose->-maybe)
|
||||
(define-key c++-mode-map "<" nil)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/autoclose->-maybe ()
|
||||
(defun doom/autoclose->-maybe ()
|
||||
"For some reason smartparens won't autoskip >'s, this hack does."
|
||||
(interactive)
|
||||
(if (save-excursion
|
||||
|
@ -65,22 +65,22 @@
|
|||
(forward-char)
|
||||
(call-interactively 'self-insert-command)))
|
||||
|
||||
(defun narf--copy-face (new-face face)
|
||||
(defun doom--copy-face (new-face face)
|
||||
"Define NEW-FACE from existing FACE."
|
||||
(copy-face face new-face)
|
||||
(eval `(defvar ,new-face nil))
|
||||
(set new-face new-face))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|init-c++-C11-highlights ()
|
||||
(defun doom|init-c++-C11-highlights ()
|
||||
;; C++11 syntax support (until cc-mode is updated)
|
||||
(require 'font-lock)
|
||||
;; labels, case, public, private, protected, namespace-tags
|
||||
(narf--copy-face 'font-lock-label-face 'font-lock-keyword-face)
|
||||
(doom--copy-face 'font-lock-label-face 'font-lock-keyword-face)
|
||||
;; comment markups such as Javadoc-tags
|
||||
(narf--copy-face 'font-lock-doc-markup-face 'font-lock-doc-face)
|
||||
(doom--copy-face 'font-lock-doc-markup-face 'font-lock-doc-face)
|
||||
;; comment markups
|
||||
(narf--copy-face 'font-lock-doc-string-face 'font-lock-comment-face)
|
||||
(doom--copy-face 'font-lock-doc-string-face 'font-lock-comment-face)
|
||||
(setq font-lock-maximum-decoration t)
|
||||
|
||||
;; We could place some regexes into `c-mode-common-hook', but
|
||||
|
@ -119,7 +119,7 @@
|
|||
) t))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/append-semicolon ()
|
||||
(defun doom/append-semicolon ()
|
||||
"Append a semicolon to the end of this (or each selected) non-empty line."
|
||||
(interactive)
|
||||
(let ((beg (if (evil-visual-state-p) evil-visual-beginning (line-beginning-position)))
|
||||
|
@ -137,12 +137,12 @@
|
|||
(evil-normal-state))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sp-point-is-template-p (id action context)
|
||||
(defun doom/sp-point-is-template-p (id action context)
|
||||
(and (sp-in-code-p id action context)
|
||||
(sp-point-after-word-p id action context)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sp-point-after-include-p (id action context)
|
||||
(defun doom/sp-point-after-include-p (id action context)
|
||||
(and (sp-in-code-p id action context)
|
||||
(save-excursion
|
||||
(goto-char (line-beginning-position))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-scss.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/css-toggle-inline-or-block ()
|
||||
(defun doom/css-toggle-inline-or-block ()
|
||||
"Toggles between a SCSS multiline block and one-line block."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
|
@ -28,10 +28,10 @@
|
|||
(just-one-space)))))
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'narf/sass-build 'narf/scss-build)
|
||||
(defalias 'doom/sass-build 'doom/scss-build)
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/scss-build ()
|
||||
(defun doom/scss-build ()
|
||||
"Compile all sass/scss files in project"
|
||||
(interactive)
|
||||
(let ((scss-dir (f-slash (or (f-traverse-upwards (lambda (d)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
;;; defuns-eshell.el ---
|
||||
;;; defuns-eshell.el
|
||||
|
||||
(defun narf--eshell-in-prompt-p (&optional offset)
|
||||
(defun doom--eshell-in-prompt-p (&optional offset)
|
||||
(>= (- (point) (or offset 0)) (save-excursion (eshell-bol) (point))))
|
||||
|
||||
(defun narf--eshell-current-git-branch ()
|
||||
(defun doom--eshell-current-git-branch ()
|
||||
(let ((branch (car (loop for match in (split-string (shell-command-to-string "git branch") "\n")
|
||||
when (string-match "^\*" match)
|
||||
collect match))))
|
||||
|
@ -12,48 +12,48 @@
|
|||
"")))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-prompt ()
|
||||
(defun doom/eshell-prompt ()
|
||||
(concat (propertize (abbreviate-file-name (eshell/pwd)) 'face 'eshell-prompt)
|
||||
(propertize (narf--eshell-current-git-branch) 'face 'font-lock-function-name-face)
|
||||
(propertize (doom--eshell-current-git-branch) 'face 'font-lock-function-name-face)
|
||||
(propertize " $ " 'face 'font-lock-constant-face)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-append ()
|
||||
(defun doom/eshell-evil-append ()
|
||||
(interactive)
|
||||
(goto-char (point-max))
|
||||
(call-interactively 'evil-append))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-append-maybe ()
|
||||
(defun doom/eshell-evil-append-maybe ()
|
||||
(interactive)
|
||||
(if (narf--eshell-in-prompt-p)
|
||||
(if (doom--eshell-in-prompt-p)
|
||||
(call-interactively 'evil-insert)
|
||||
(narf/eshell-append)))
|
||||
(doom/eshell-append)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-prepend ()
|
||||
(defun doom/eshell-evil-prepend ()
|
||||
(interactive)
|
||||
(eshell-bol)
|
||||
(call-interactively 'evil-insert))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-prepend-maybe ()
|
||||
(defun doom/eshell-evil-prepend-maybe ()
|
||||
(interactive)
|
||||
(if (narf--eshell-in-prompt-p)
|
||||
(if (doom--eshell-in-prompt-p)
|
||||
(call-interactively 'evil-insert)
|
||||
(narf/eshell-prepend)))
|
||||
(doom/eshell-prepend)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-replace-maybe ()
|
||||
(defun doom/eshell-evil-replace-maybe ()
|
||||
(interactive)
|
||||
(if (narf--eshell-in-prompt-p)
|
||||
(if (doom--eshell-in-prompt-p)
|
||||
(call-interactively 'evil-replace)
|
||||
(user-error "Cannot edit read-only region")))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-replace-state-maybe ()
|
||||
(defun doom/eshell-evil-replace-state-maybe ()
|
||||
(interactive)
|
||||
(if (narf--eshell-in-prompt-p)
|
||||
(if (doom--eshell-in-prompt-p)
|
||||
(call-interactively 'evil-replace-state)
|
||||
(user-error "Cannot edit read-only region")))
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
;;; defuns-go.el
|
||||
|
||||
;; TODO Implement narf:go-get-package
|
||||
(defun narf--go-get-package ())
|
||||
;; TODO Implement doom:go-get-package
|
||||
(defun doom--go-get-package ())
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:go-test-run-all ()
|
||||
(defun doom:go-test-run-all ()
|
||||
(interactive)
|
||||
(async-shell-command (format "cd '%s' && go test" (narf/project-root))))
|
||||
(async-shell-command (format "cd '%s' && go test" (doom/project-root))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:go-test-run-package ()
|
||||
(defun doom:go-test-run-package ()
|
||||
(interactive)
|
||||
(error "Not yet implemented")
|
||||
(async-shell-command (format "cd '%s' && go test %s" (narf/project-root) (narf--go-get-package))))
|
||||
(async-shell-command (format "cd '%s' && go test %s" (doom/project-root) (doom--go-get-package))))
|
||||
|
||||
(provide 'defuns-go)
|
||||
;;; defuns-go.el ends here
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
;;; defuns-java.el ---
|
||||
;;; defuns-java.el
|
||||
|
||||
;; yasnippet defuns
|
||||
;;;###autoload
|
||||
(defun narf/java-android-mode-is-layout-file ()
|
||||
(defun doom/java-android-mode-is-layout-file ()
|
||||
(and android-mode
|
||||
(eq major-mode 'nxml-mode)
|
||||
(string-equal (file-name-base (directory-file-name default-directory)) "layout")))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/java-android-mode-in-tags (&rest tags)
|
||||
(defun doom/java-android-mode-in-tags (&rest tags)
|
||||
(-contains? tags (android-mode-tag-name)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/java-android-mode-tag-name ()
|
||||
(defun doom/java-android-mode-tag-name ()
|
||||
(save-excursion
|
||||
(let (beg end)
|
||||
(nxml-backward-up-element)
|
||||
|
@ -23,13 +23,13 @@
|
|||
(buffer-substring-no-properties beg end))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|android-mode-enable-maybe ()
|
||||
(let ((root (narf/project-root)))
|
||||
(when (or (narf/project-has-files "local.properties" root)
|
||||
(narf/project-has-files "AndroidManifest.xml" root)
|
||||
(narf/project-has-files "src/main/AndroidManifest.xml" root))
|
||||
(defun doom|android-mode-enable-maybe ()
|
||||
(let ((root (doom/project-root)))
|
||||
(when (or (doom/project-has-files "local.properties" root)
|
||||
(doom/project-has-files "AndroidManifest.xml" root)
|
||||
(doom/project-has-files "src/main/AndroidManifest.xml" root))
|
||||
(android-mode +1)
|
||||
(narf/set-build-command "./gradlew %s" "build.gradle"))))
|
||||
(doom/set-build-command "./gradlew %s" "build.gradle"))))
|
||||
|
||||
(provide 'defuns-java)
|
||||
;;; defuns-java.el ends here
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-julia.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/julia-repl ()
|
||||
(defun doom/julia-repl ()
|
||||
"Run an inferior instance of `julia' inside Emacs."
|
||||
(interactive)
|
||||
(let ((buffer (get-buffer-create "*Julia*")))
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
;;; defuns-lisp.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/elisp-find-function-at-pt ()
|
||||
(defun doom/elisp-find-function-at-pt ()
|
||||
(interactive)
|
||||
(let ((func (function-called-at-point)))
|
||||
(if func (find-function func))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/elisp-find-function-at-pt-other-window ()
|
||||
(defun doom/elisp-find-function-at-pt-other-window ()
|
||||
(interactive)
|
||||
(let ((func (function-called-at-point)))
|
||||
(if func (find-function-other-window func))))
|
||||
|
||||
(defun narf--ert-pre ()
|
||||
(defun doom--ert-pre ()
|
||||
(save-buffer)
|
||||
(eval-buffer))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ert-run-test ()
|
||||
(defun doom/ert-run-test ()
|
||||
(interactive)
|
||||
(let (case-fold-search)
|
||||
(narf--ert-pre)
|
||||
(doom--ert-pre)
|
||||
(aif (thing-at-point 'defun t)
|
||||
(if (string-match "(ert-deftest \\([^ ]+\\)" it)
|
||||
(ert-run-tests-interactively (substring it (match-beginning 1) (match-end 1)))
|
||||
|
@ -28,34 +28,34 @@
|
|||
(user-error "No test found at point"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ert-rerun-test ()
|
||||
(defun doom/ert-rerun-test ()
|
||||
(interactive)
|
||||
(let (case-fold-search)
|
||||
(narf--ert-pre)
|
||||
(doom--ert-pre)
|
||||
(aif (car-safe ert--selector-history)
|
||||
(ert-run-tests-interactively it)
|
||||
(message "No test found in history, looking for test at point")
|
||||
(narf/ert-run-test))))
|
||||
(doom/ert-run-test))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ert-run-all-tests ()
|
||||
(defun doom/ert-run-all-tests ()
|
||||
(interactive)
|
||||
(ert-delete-all-tests)
|
||||
(narf--ert-pre)
|
||||
(doom--ert-pre)
|
||||
(ert-run-tests-interactively t))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/elisp-auto-compile ()
|
||||
(defun doom/elisp-auto-compile ()
|
||||
(when (let ((file-name (buffer-file-name)))
|
||||
(and (f-exists? (f-expand (concat (f-base file-name) ".elc") (f-dirname file-name)))
|
||||
(--any? (f-child-of? file-name it)
|
||||
(append (list narf-core-dir narf-modules-dir
|
||||
narf-core-dir narf-modules-dir
|
||||
narf-private-dir)))))
|
||||
(narf:compile-el)))
|
||||
(append (list doom-core-dir doom-modules-dir
|
||||
doom-core-dir doom-modules-dir
|
||||
doom-private-dir)))))
|
||||
(doom:compile-el)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/elisp-inf-ielm ()
|
||||
(defun doom/elisp-inf-ielm ()
|
||||
(ielm)
|
||||
(let ((buf (current-buffer)))
|
||||
(bury-buffer)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-lua.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/inf-lua ()
|
||||
(defun doom/inf-lua ()
|
||||
(interactive)
|
||||
(lua-start-process "lua" "lua")
|
||||
(pop-to-buffer lua-process-buffer))
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
;;; defuns-markdown.el --- for module-markdown.el
|
||||
;;; defuns-markdown.el
|
||||
|
||||
;; Implement strike-through formatting
|
||||
(defvar narf--markdown-regex-del
|
||||
(defvar doom--markdown-regex-del
|
||||
"\\(^\\|[^\\]\\)\\(\\(~\\{2\\}\\)\\([^ \n \\]\\|[^ \n ]\\(?:.\\|\n[^\n]\\)*?[^\\ ]\\)\\(\\3\\)\\)")
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/markdown-insert-del ()
|
||||
(defun doom/markdown-insert-del ()
|
||||
"Surround region in github strike-through delimiters."
|
||||
(interactive)
|
||||
(let ((delim "~~"))
|
||||
|
@ -13,13 +13,12 @@
|
|||
;; Active region
|
||||
(let ((bounds (markdown-unwrap-things-in-region
|
||||
(region-beginning) (region-end)
|
||||
narf--markdown-regex-del 2 4)))
|
||||
doom--markdown-regex-del 2 4)))
|
||||
(markdown-wrap-or-insert delim delim nil (car bounds) (cdr bounds)))
|
||||
;; Bold markup removal, bold word at point, or empty markup insertion
|
||||
(if (thing-at-point-looking-at narf--markdown-regex-del)
|
||||
(if (thing-at-point-looking-at doom--markdown-regex-del)
|
||||
(markdown-unwrap-thing-at-point nil 2 4)
|
||||
(markdown-wrap-or-insert delim delim 'word nil nil)))))
|
||||
|
||||
|
||||
(provide 'defuns-markdown)
|
||||
;;; defuns-markdown.el ends here
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
;;; defuns-org-notebook.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org ()
|
||||
(defun doom/org ()
|
||||
(interactive)
|
||||
(find-file (f-expand "inbox.org" org-directory)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-notebook-new ()
|
||||
(defun doom/org-notebook-new ()
|
||||
(interactive)
|
||||
(projectile-invalidate-cache nil)
|
||||
(let* ((default-directory org-directory)
|
||||
(dir (projectile-complete-dir))
|
||||
(narf-org-quicknote-dir dir))
|
||||
(doom-org-quicknote-dir dir))
|
||||
(when dir
|
||||
(narf/org-notebook-quick-note))))
|
||||
(doom/org-notebook-quick-note))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-notebook-quick-note ()
|
||||
(defun doom/org-notebook-quick-note ()
|
||||
(interactive)
|
||||
(let (text)
|
||||
(when (evil-visual-state-p)
|
||||
(setq text (buffer-substring-no-properties evil-visual-beginning evil-visual-end)))
|
||||
(switch-to-buffer (generate-new-buffer "*quick-note*"))
|
||||
(setq default-directory narf-org-quicknote-dir)
|
||||
(setq default-directory doom-org-quicknote-dir)
|
||||
(erase-buffer)
|
||||
(insert text)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-download-dnd (uri action)
|
||||
(defun doom/org-download-dnd (uri action)
|
||||
(if (eq major-mode 'org-mode)
|
||||
(narf:org-attach uri)
|
||||
(doom:org-attach uri)
|
||||
(let ((dnd-protocol-alist
|
||||
(rassq-delete-all 'narf/org-download-dnd (copy-alist dnd-protocol-alist))))
|
||||
(rassq-delete-all 'doom/org-download-dnd (copy-alist dnd-protocol-alist))))
|
||||
(dnd-handle-one-url nil action uri))))
|
||||
|
||||
;;;###autoload (autoload 'narf:org-attach "defuns-org-notebook" nil t)
|
||||
(evil-define-command narf:org-attach (&optional uri)
|
||||
;;;###autoload (autoload 'doom:org-attach "defuns-org-notebook" nil t)
|
||||
(evil-define-command doom:org-attach (&optional uri)
|
||||
(interactive "<a>")
|
||||
(unless (eq major-mode 'org-mode)
|
||||
(user-error "Not in an org-mode buffer"))
|
||||
|
@ -51,22 +51,22 @@
|
|||
(if (evil-visual-state-p)
|
||||
(org-insert-link nil (format "./%s" rel-path)
|
||||
(concat (buffer-substring-no-properties (region-beginning) (region-end))
|
||||
" " (narf/org-attach-icon rel-path)))
|
||||
" " (doom/org-attach-icon rel-path)))
|
||||
|
||||
(insert (if image-p
|
||||
(format "[[./%s]]" rel-path)
|
||||
(format "%s [[./%s][%s]]"
|
||||
(narf/org-attach-icon rel-path)
|
||||
(doom/org-attach-icon rel-path)
|
||||
rel-path (f-filename rel-path)))))
|
||||
(when (string-match-p (regexp-opt '("jpg" "jpeg" "gif" "png")) (f-ext rel-path))
|
||||
(org-toggle-inline-images)))
|
||||
(let ((attachments (narf-org-attachments)))
|
||||
(let ((attachments (doom-org-attachments)))
|
||||
(unless attachments
|
||||
(user-error "No attachments in this file"))
|
||||
(helm :sources (helm-build-sync-source "Attachments" :candidates attachments)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-attach-icon (path)
|
||||
(defun doom/org-attach-icon (path)
|
||||
(char-to-string (pcase (downcase (f-ext path))
|
||||
("jpg" ?) ("jpeg" ?) ("png" ?) ("gif" ?)
|
||||
("pdf" ?)
|
||||
|
@ -79,7 +79,7 @@
|
|||
(t ?))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-attachments ()
|
||||
(defun doom/org-attachments ()
|
||||
"Retrieves a list of all the attachments pertinent to the currect org-mode buffer."
|
||||
(org-save-outline-visibility nil
|
||||
(let ((attachments '())
|
||||
|
@ -100,15 +100,15 @@
|
|||
(-distinct attachments))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-cleanup-attachments ()
|
||||
(defun doom/org-cleanup-attachments ()
|
||||
"Deletes any attachments that are no longer present in the org-mode buffer."
|
||||
(let* ((attachments (narf/org-attachments))
|
||||
(to-delete (-difference narf-org-attachments-list attachments)))
|
||||
(let* ((attachments (doom/org-attachments))
|
||||
(to-delete (-difference doom-org-attachments-list attachments)))
|
||||
(mapc (lambda (f)
|
||||
(message "Deleting attachment: %s" f)
|
||||
(delete-file f t))
|
||||
to-delete)
|
||||
(setq narf-org-attachments-list attachments)))
|
||||
(setq doom-org-attachments-list attachments)))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -117,10 +117,10 @@
|
|||
|
||||
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
|
||||
;; regexp.
|
||||
;;;###autoload (autoload 'narf:org-helm-search "defuns-org-notebook" nil t)
|
||||
(evil-define-operator narf:org-helm-search (beg end &optional search bang)
|
||||
;;;###autoload (autoload 'doom:org-helm-search "defuns-org-notebook" nil t)
|
||||
(evil-define-operator doom:org-helm-search (beg end &optional search bang)
|
||||
(interactive "<r><a><!>")
|
||||
(narf:helm-ag-search beg end (if bang (concat "^\\*+.*" search ".*$") search) t org-directory))
|
||||
(doom:helm-ag-search beg end (if bang (concat "^\\*+.*" search ".*$") search) t org-directory))
|
||||
|
||||
(provide 'defuns-org-notebook)
|
||||
;;; defuns-org-notebook.el ends here
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
;;; defuns-org.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-find-file-in-notes ()
|
||||
(defun doom/org-find-file-in-notes ()
|
||||
(interactive)
|
||||
(in! (f-slash org-directory)
|
||||
(helm-projectile-find-file)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-find-file ()
|
||||
(defun doom/org-find-file ()
|
||||
(interactive)
|
||||
(in! (f-slash org-directory)
|
||||
(helm-find-files nil)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-find-exported-file ()
|
||||
(defun doom/org-find-exported-file ()
|
||||
(interactive)
|
||||
(in! (f-slash narf-org-export-directory)
|
||||
(in! (f-slash doom-org-export-directory)
|
||||
(helm-find-files nil)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-get-property (name)
|
||||
(defun doom/org-get-property (name)
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char 1)
|
||||
|
@ -27,7 +27,7 @@
|
|||
(buffer-substring-no-properties (match-beginning 1) (match-end 1))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-indent ()
|
||||
(defun doom/org-indent ()
|
||||
(interactive)
|
||||
(cond
|
||||
((and (org-on-heading-p)
|
||||
|
@ -37,7 +37,7 @@
|
|||
(t (call-interactively 'self-insert-command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-dedent ()
|
||||
(defun doom/org-dedent ()
|
||||
(interactive)
|
||||
(cond
|
||||
((and (org-on-heading-p)
|
||||
|
@ -47,7 +47,7 @@
|
|||
(t (call-interactively 'self-insert-command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-insert-item (direction)
|
||||
(defun doom/org-insert-item (direction)
|
||||
"Inserts a new heading or item, depending on the context. I use this instead of
|
||||
`org-insert-item' or `org-insert-heading' because they try to do too much and end up doing
|
||||
this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
||||
|
@ -74,7 +74,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
('below
|
||||
(org-table-insert-row))
|
||||
('above
|
||||
(narf/org-table-prepend-row-or-shift-up))))
|
||||
(doom/org-table-prepend-row-or-shift-up))))
|
||||
(t
|
||||
(let ((level (save-excursion
|
||||
(org-back-to-heading)
|
||||
|
@ -104,7 +104,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
(evil-append-line 1)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-toggle-checkbox ()
|
||||
(defun doom/org-toggle-checkbox ()
|
||||
(interactive)
|
||||
(let ((context (org-element-lineage (org-element-context) '(item) t)))
|
||||
(when context
|
||||
|
@ -116,7 +116,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
(insert "[ ] ")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-dwim-at-point ()
|
||||
(defun doom/org-dwim-at-point ()
|
||||
(interactive)
|
||||
(let* ((scroll-pt (window-start))
|
||||
(context (org-element-context))
|
||||
|
@ -160,14 +160,14 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
((memq type '(link))
|
||||
(let ((path (org-element-property :path (org-element-lineage (org-element-context) '(link) t))))
|
||||
(if (and path (image-type-from-file-name path))
|
||||
(narf/org-refresh-inline-images)
|
||||
(doom/org-refresh-inline-images)
|
||||
(org-open-at-point))))
|
||||
|
||||
(t (narf/org-refresh-inline-images)))
|
||||
(t (doom/org-refresh-inline-images)))
|
||||
(set-window-start nil scroll-pt)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-refresh-inline-images ()
|
||||
(defun doom/org-refresh-inline-images ()
|
||||
(interactive)
|
||||
(if (> (length org-inline-image-overlays) 0)
|
||||
(org-remove-inline-images)
|
||||
|
@ -182,7 +182,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
|
||||
;; Formatting shortcuts
|
||||
;;;###autoload
|
||||
(defun narf/org-surround (delim)
|
||||
(defun doom/org-surround (delim)
|
||||
(if (region-active-p)
|
||||
(save-excursion
|
||||
(goto-char (region-beginning))
|
||||
|
@ -193,7 +193,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
(save-excursion (insert delim))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-word-count (beg end &optional count-footnotes?)
|
||||
(defun doom/org-word-count (beg end &optional count-footnotes?)
|
||||
"Report the number of words in the Org mode buffer or selected region.
|
||||
Ignores:
|
||||
- comments
|
||||
|
@ -265,7 +265,7 @@ COUNT-FOOTNOTES? is non-nil."
|
|||
(if mark-active "region" "buffer")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-remove-link ()
|
||||
(defun doom/org-remove-link ()
|
||||
"Replace an org link by its description or if empty its address"
|
||||
(interactive)
|
||||
(if (org-in-regexp org-bracket-link-regexp 1)
|
||||
|
@ -277,52 +277,52 @@ COUNT-FOOTNOTES? is non-nil."
|
|||
(insert description))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-next-row ()
|
||||
(defun doom/org-table-next-row ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (org-table-next-row) (org-down-element)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-previous-row ()
|
||||
(defun doom/org-table-previous-row ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (narf--org-table-previous-row) (org-up-element)))
|
||||
(if (org-at-table-p) (doom--org-table-previous-row) (org-up-element)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-next-field ()
|
||||
(defun doom/org-table-next-field ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (org-table-next-field) (org-end-of-line)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-previous-field ()
|
||||
(defun doom/org-table-previous-field ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (org-table-previous-field) (org-beginning-of-line)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-append-field-or-shift-right ()
|
||||
(defun doom/org-table-append-field-or-shift-right ()
|
||||
(interactive)
|
||||
(org-shiftmetaright)
|
||||
(when (org-at-table-p) (org-metaright)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-prepend-field-or-shift-left ()
|
||||
(defun doom/org-table-prepend-field-or-shift-left ()
|
||||
(interactive)
|
||||
(if (org-at-table-p)
|
||||
(org-shiftmetaright)
|
||||
(org-shiftmetaleft)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-append-row-or-shift-down ()
|
||||
(defun doom/org-table-append-row-or-shift-down ()
|
||||
(interactive)
|
||||
(org-shiftmetadown)
|
||||
(when (org-at-table-p) (org-metadown)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-prepend-row-or-shift-up ()
|
||||
(defun doom/org-table-prepend-row-or-shift-up ()
|
||||
(interactive)
|
||||
(if (org-at-table-p)
|
||||
(org-shiftmetadown)
|
||||
(org-shiftmetaup)))
|
||||
|
||||
(defun narf--org-table-previous-row ()
|
||||
(defun doom--org-table-previous-row ()
|
||||
"Go to the previous row (same column) in the current table. Before doing so,
|
||||
re-align the table if necessary. (Necessary because org-mode has a
|
||||
`org-table-next-row', but not `org-table-previous-row')"
|
||||
|
@ -340,8 +340,8 @@ re-align the table if necessary. (Necessary because org-mode has a
|
|||
(skip-chars-backward "^|\n\r")
|
||||
(when (org-looking-at-p " ") (forward-char))))
|
||||
|
||||
;;;###autoload (autoload 'narf:org-link "defuns-org" nil t)
|
||||
(evil-define-command narf:org-link (link)
|
||||
;;;###autoload (autoload 'doom:org-link "defuns-org" nil t)
|
||||
(evil-define-command doom:org-link (link)
|
||||
"Add LINK to the org buffer. If a selection is active, link selection to LINK."
|
||||
(interactive "<a>")
|
||||
(unless (eq major-mode 'org-mode)
|
||||
|
@ -351,7 +351,7 @@ re-align the table if necessary. (Necessary because org-mode has a
|
|||
(org-insert-link nil link (when (and beg end) (buffer-substring-no-properties beg end)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sp-org-skip-asterisk (ms mb me)
|
||||
(defun doom/sp-org-skip-asterisk (ms mb me)
|
||||
(or (and (= (line-beginning-position) mb)
|
||||
(eq 32 (char-after (1+ mb))))
|
||||
(and (= (1+ (line-beginning-position)) me)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
;;; defuns-python.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*anaconda-mode-doc-buffer ()
|
||||
(defun doom*anaconda-mode-doc-buffer ()
|
||||
"Delete the window on escape or C-g."
|
||||
(with-current-buffer (get-buffer "*anaconda-doc*")
|
||||
(local-set-key [escape] 'anaconda-nav-quit)
|
||||
(local-set-key [?\C-g] 'anaconda-nav-quit)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/inf-python ()
|
||||
(defun doom/inf-python ()
|
||||
(run-python python-shell-interpreter t t))
|
||||
|
||||
(provide 'defuns-python)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
;;; defuns-regex.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|reb-cleanup ()
|
||||
(defun doom|reb-cleanup ()
|
||||
(replace-regexp "^[ \n]*" "" nil (point-min) (point-max))
|
||||
(text-scale-set 2)
|
||||
(goto-char 2))
|
||||
|
||||
;;;###autoload (autoload 'narf:regex "defuns-regex" nil t)
|
||||
(evil-define-operator narf:regex (beg end type &optional regexstr bang)
|
||||
;;;###autoload (autoload 'doom:regex "defuns-regex" nil t)
|
||||
(evil-define-operator doom:regex (beg end type &optional regexstr bang)
|
||||
"Either a) converts selected (or entered-in) pcre regex into elisp
|
||||
regex, OR b) opens up re-builder."
|
||||
:move-point nil
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-sh.el
|
||||
|
||||
(defvar sh-extra-font-lock--keywords
|
||||
`((narf/sh-extra-font-lock--match-var-in-double-quoted-string
|
||||
`((doom/sh-extra-font-lock--match-var-in-double-quoted-string
|
||||
(2 font-lock-variable-name-face prepend))
|
||||
(,(concat
|
||||
"\\<"
|
||||
|
@ -10,13 +10,13 @@
|
|||
(0 'font-lock-builtin-face))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sh-extra-font-lock--is-in-double-quoted-string ()
|
||||
(defun doom/sh-extra-font-lock--is-in-double-quoted-string ()
|
||||
"Non-nil if point in inside a double-quoted string."
|
||||
(let ((state (syntax-ppss)))
|
||||
(eq (nth 3 state) ?\")))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sh-extra-font-lock--match-var-in-double-quoted-string (limit)
|
||||
(defun doom/sh-extra-font-lock--match-var-in-double-quoted-string (limit)
|
||||
"Search for variables in double-quoted strings bounded by LIMIT."
|
||||
(let (res)
|
||||
(while
|
||||
|
@ -24,11 +24,11 @@
|
|||
(re-search-forward
|
||||
"\\$\\({#?\\)?\\([[:alpha:]_][[:alnum:]_]*\\|[-#?@!]\\)"
|
||||
limit t))
|
||||
(not (narf/sh-extra-font-lock--is-in-double-quoted-string))))
|
||||
(not (doom/sh-extra-font-lock--is-in-double-quoted-string))))
|
||||
res))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|sh-extra-font-lock-activate ()
|
||||
(defun doom|sh-extra-font-lock-activate ()
|
||||
"Activate sh-extra-font-lock."
|
||||
(interactive)
|
||||
(font-lock-add-keywords nil sh-extra-font-lock--keywords)
|
||||
|
@ -39,7 +39,7 @@
|
|||
(font-lock-fontify-buffer)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/inf-shell ()
|
||||
(defun doom/inf-shell ()
|
||||
(let* ((dest-sh (symbol-name sh-shell))
|
||||
(sh-shell-file dest-sh))
|
||||
(sh-shell-process t)
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
;;; defuns-web.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/web-html-email2mailto (beg end)
|
||||
(defun doom/web-html-email2mailto (beg end)
|
||||
(interactive "r")
|
||||
(replace-regexp "\\b\\([a-zA-Z0-9._+-%]+@[a-zA-Z0-9-.]+\\.[a-zA-Z]+\\)\\b"
|
||||
"<a href=\"mailto:\\1\">\\1</a>"
|
||||
nil beg end))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/web-html-url2anchor (beg end)
|
||||
(defun doom/web-html-url2anchor (beg end)
|
||||
(interactive "r")
|
||||
(replace-regexp "\\bhttps?://.+?\\b"
|
||||
"<a href=\"\\1\">\\1</a>"
|
||||
nil beg end))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/web-refresh-browser ()
|
||||
(defun doom/web-refresh-browser ()
|
||||
(interactive)
|
||||
(call-process-shell-command "osascript -e 'tell application \"Google Chrome\" to tell the active tab of its first window to reload' &" nil 0))
|
||||
|
||||
;;;###autoload (autoload 'narf/html-entities "defuns-web" nil t)
|
||||
(evil-define-operator narf/html-entities (bang beg end)
|
||||
;;;###autoload (autoload 'doom/html-entities "defuns-web" nil t)
|
||||
(evil-define-operator doom/html-entities (bang beg end)
|
||||
"HTML encode/decode the selected region. Based on Xah's replace HTML named entities
|
||||
function @ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html"
|
||||
(interactive "<!><r>")
|
||||
|
|
|
@ -4,20 +4,20 @@
|
|||
(defmacro define-org-section! (type directory &optional id-func link-glob)
|
||||
(setq directory (f-slash directory))
|
||||
(let* ((type-str (symbol-name type))
|
||||
(link-sym (intern (format "narf/org-link-%s" type-str)))
|
||||
(link-sym (intern (format "doom/org-link-%s" type-str)))
|
||||
(dir-var (intern (format "org-directory-%s" type-str))))
|
||||
`(progn
|
||||
;; Variable containing directory: `org-directory-%s'
|
||||
(defvar ,dir-var ,(expand-file-name directory org-directory))
|
||||
|
||||
;; Open helm in directory: `narf/helm-org-%s'
|
||||
(evil-define-command ,(intern (format "narf:org-search-%s" type-str)) ()
|
||||
;; Open helm in directory: `doom/helm-org-%s'
|
||||
(evil-define-command ,(intern (format "doom:org-search-%s" type-str)) ()
|
||||
(interactive)
|
||||
(let ((default-directory (concat ,dir-var "/" (format-time-string "%Y") "/")))
|
||||
(helm-find-files nil)))
|
||||
|
||||
;; Open helm in directory: `narf/helm-org-%s'
|
||||
(defun ,(intern (format "narf/helm-org-find-file-in-%s" type-str)) ()
|
||||
;; Open helm in directory: `doom/helm-org-%s'
|
||||
(defun ,(intern (format "doom/helm-org-find-file-in-%s" type-str)) ()
|
||||
(interactive)
|
||||
(helm-do-ag (f-slash ,dir-var)))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue