💥 lang/org: conform to new name conventions

This commit is contained in:
Henrik Lissner 2019-07-21 02:38:42 +02:00
parent 149b2617b0
commit 8147bc1aee
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
10 changed files with 198 additions and 196 deletions

View file

@ -10,30 +10,3 @@
(rassq-delete-all '+org-attach-download-dnd
(copy-alist dnd-protocol-alist))))
(dnd-handle-one-url nil action uri))))
;;;###autoload
(defun +org-dragndrop*insert-link (_link filename)
"Produces and inserts a link to FILENAME into the document.
If FILENAME is an image, produce an attach:%s path, otherwise use file:%s (with
an file icon produced by `+org-attach--icon')."
(if (looking-back "^[ \t]+" (line-beginning-position))
(delete-region (match-beginning 0) (match-end 0))
(newline))
(cond ((image-type-from-file-name filename)
(insert
(concat (if (= org-download-image-html-width 0) ""
(format "#+attr_html: :width %dpx\n" org-download-image-html-width))
(if (= org-download-image-latex-width 0) ""
(format "#+attr_latex: :width %dcm\n" org-download-image-latex-width))
(cond ((file-in-directory-p filename org-attach-directory)
(format "[[attach:%s]]" (file-relative-name filename org-attach-directory)))
((file-in-directory-p filename org-directory)
(format org-download-link-format (file-relative-name filename org-directory)))
((format org-download-link-format filename)))))
(org-display-inline-images))
((insert
(format "%s [[./%s][%s]] "
(+org-attach--icon filename)
(file-relative-name filename (file-name-directory buffer-file-name))
(file-name-nondirectory (directory-file-name filename)))))))

View file

@ -2,7 +2,7 @@
;;;###if (featurep! +ipython)
;;;###autoload
(defun +org*ob-ipython-initiate-session (&optional session params)
(defun +org-ob-ipython-initiate-session-a (&optional session params)
"Create a session named SESSION according to PARAMS."
(if (string= session "none")
(error
@ -54,7 +54,7 @@ Make sure your src block has a :session param.")
(format "*%s*" proc))))
;;;###autoload
(defun +org*ob-ipython--create-repl (name &optional params)
(defun +org-ob-ipython-create-repl-a (name &optional params)
"Create repl based on NAME and PARAMS.
If PARAMS specifies remote kernel, copy the kernel config from remote server and
create a repl connecting to remote session."
@ -88,7 +88,7 @@ create a repl connecting to remote session."
(format "*%s*" process-name))))))
;;;###autoload
(defun +org*babel-execute:ipython (body params)
(defun +org-babel-execute:ipython-a (body params)
"Execute a BODY of IPython code with PARAMS in org-babel.
This function is called by `org-babel-execute-src-block'."
(message default-directory)
@ -100,7 +100,7 @@ This function is called by `org-babel-execute-src-block'."
;; * org-src-edit
;;;###autoload
(defun +org*babel-edit-prep:ipython (info)
(defun +org-babel-edit-prep:ipython-a (info)
(let* ((params (nth 2 info))
(session (cdr (assoc :session params))))
(org-babel-ipython-initiate-session session params))
@ -144,7 +144,7 @@ The optional arg SCALE is scale factor, and defaults to 2."
(substring filename pos))))
;;;###autoload
(defun +org*ob-ipython--write-base64-string (oldfunc &rest args)
(defun +org-ob-ipython-write-base64-string-a (oldfunc &rest args)
(let ((file (car args))
(b64-string (cdr args)))
(let ((file2x (+org--ob-ipython-mac-2x-image-file-name file)))

View file

@ -16,7 +16,7 @@
;;; Hooks
;;;###autoload
(defun +org-present|add-overlays ()
(defun +org-present-add-overlays-h ()
(add-to-invisibility-spec '(+org-present))
(save-excursion
;; hide org-mode options starting with #+
@ -36,14 +36,14 @@
(remove-from-invisibility-spec '(+org-present)))
;;;###autoload
(defun +org-present|detect-slide ()
(defun +org-present-detect-slide-h ()
(outline-show-all)
(if (member "title" (org-get-tags-at))
(text-scale-set 10)
(text-scale-set +org-present-text-scale)))
;;;###autoload
(defun +org-present|init-org-tree-window ()
(defun +org-present-init-org-tree-window-h ()
"Set up the org window for presentation."
(doom/window-maximize-buffer)
(let ((cwm-use-vertical-padding t)

View file

@ -15,7 +15,7 @@
"TODO")
;;;###autoload
(defun +org-capture|cleanup-frame ()
(defun +org-capture-cleanup-frame-h ()
"Closes the org-capture frame once done adding an entry."
(when (+org-capture-frame-p)
(delete-frame nil t)))
@ -59,7 +59,7 @@ you're done. This can be called from an external shell script."
if (buffer-local-value 'org-capture-mode buf)
return buf)))
(with-current-buffer buf
(add-hook 'kill-buffer-hook #'+org-capture|cleanup-frame nil t))
(add-hook 'kill-buffer-hook #'+org-capture-cleanup-frame-h nil t))
(delete-frame frame))))))
('error
(message "org-capture: %s" (error-message-string ex))

View file

@ -298,7 +298,7 @@ wrong places)."
(org-toggle-checkbox '(4)))
;;;###autoload
(defalias #'+org/toggle-fold #'+org|cycle-only-current-subtree)
(defalias #'+org/toggle-fold #'+org-cycle-only-current-subtree-h)
;;;###autoload
(defun +org/open-fold ()
@ -348,7 +348,7 @@ another level of headings on each invocation."
;;; Hooks
;;;###autoload
(defun +org|delete-backward-char-and-realign-table-maybe ()
(defun +org-delete-backward-char-and-realign-table-maybe-h ()
"TODO"
(when (eq major-mode 'org-mode)
(org-check-before-invisible-edit 'delete-backward)
@ -371,7 +371,7 @@ another level of headings on each invocation."
t))))
;;;###autoload
(defun +org|indent-maybe ()
(defun +org-indent-maybe-h ()
"Indent the current item (header or item), if possible.
Made for `org-tab-first-hook' in evil-mode."
(interactive)
@ -395,7 +395,7 @@ Made for `org-tab-first-hook' in evil-mode."
t)))
;;;###autoload
(defun +org|realign-table-maybe ()
(defun +org-realign-table-maybe-h ()
"Auto-align table under cursor and re-calculate formulas."
(when (and (org-at-table-p) org-table-may-need-update)
(let ((pt (point))
@ -405,14 +405,14 @@ Made for `org-tab-first-hook' in evil-mode."
(goto-char pt))))
;;;###autoload
(defun +org|update-cookies ()
(defun +org-update-cookies-h ()
"Update counts in headlines (aka \"cookies\")."
(when (and buffer-file-name (file-exists-p buffer-file-name))
(let (org-hierarchical-todo-statistics)
(org-update-parent-todo-statistics))))
;;;###autoload
(defun +org|yas-expand-maybe ()
(defun +org-yas-expand-maybe-h ()
"Tries to expand a yasnippet snippet, if one is available. Made for
`org-tab-first-hook'."
(when (bound-and-true-p yas-minor-mode)
@ -430,7 +430,7 @@ Made for `org-tab-first-hook' in evil-mode."
t))))
;;;###autoload
(defun +org|cycle-only-current-subtree (&optional arg)
(defun +org-cycle-only-current-subtree-h (&optional arg)
"Toggle the local fold at the point (as opposed to cycling through all levels
with `org-cycle')."
(interactive "P")
@ -449,14 +449,14 @@ with `org-cycle')."
t)))))
;;;###autoload
(defun +org|remove-occur-highlights ()
(defun +org-remove-occur-highlights-h ()
"Remove org occur highlights on ESC in normal mode."
(when org-occur-highlights
(org-remove-occur-highlights)
t))
;;;###autoload
(defun +org|unfold-to-2nd-level-or-point ()
(defun +org-unfold-to-2nd-level-or-point-h ()
"My version of the 'overview' #+STARTUP option: expand first-level headings.
Expands the first level, but no further. If point was left somewhere deeper,
unfold to point on startup."
@ -470,39 +470,39 @@ unfold to point on startup."
(org-show-subtree))))))
;;;###autoload
(defun +org|enable-auto-reformat-tables ()
(defun +org-enable-auto-reformat-tables-h ()
"Realign tables & update formulas when exiting insert mode (`evil-mode')."
(when (featurep 'evil)
(add-hook 'evil-insert-state-exit-hook #'+org|realign-table-maybe nil t)
(add-hook 'evil-replace-state-exit-hook #'+org|realign-table-maybe nil t)
(advice-add #'evil-replace :after #'+org*realign-table-maybe)))
(add-hook 'evil-insert-state-exit-hook #'+org-realign-table-maybe-h nil t)
(add-hook 'evil-replace-state-exit-hook #'+org-realign-table-maybe-h nil t)
(advice-add #'evil-replace :after #'+org-realign-table-maybe-a)))
;;;###autoload
(defun +org|enable-auto-update-cookies ()
(defun +org-enable-auto-update-cookies-h ()
"Update statistics cookies when saving or exiting insert mode (`evil-mode')."
(when (featurep 'evil)
(add-hook 'evil-insert-state-exit-hook #'+org|update-cookies nil t))
(add-hook 'before-save-hook #'+org|update-cookies nil t))
(add-hook 'evil-insert-state-exit-hook #'+org-update-cookies-h nil t))
(add-hook 'before-save-hook #'+org-update-cookies-h nil t))
;;
;;; Advice
;;;###autoload
(defun +org*fix-newline-and-indent-in-src-blocks ()
(defun +org-fix-newline-and-indent-in-src-blocks-a ()
"Try to mimic `newline-and-indent' with correct indentation in src blocks."
(when (org-in-src-block-p t)
(org-babel-do-in-edit-buffer
(call-interactively #'indent-for-tab-command))))
;;;###autoload
(defun +org*realign-table-maybe (&rest _)
(defun +org-realign-table-maybe-a (&rest _)
"Auto-align table under cursor and re-calculate formulas."
(when (eq major-mode 'org-mode)
(+org|realign-table-maybe)))
(+org-realign-table-maybe-h)))
;;;###autoload
(defun +org*evil-org-open-below (orig-fn count)
(defun +org-evil-org-open-below-a (orig-fn count)
"Fix o/O creating new list items in the middle of nested plain lists. Only has
an effect when `evil-org-special-o/O' has `item' in it (not the default)."
(cl-letf (((symbol-function 'end-of-visible-line)
@ -513,7 +513,7 @@ an effect when `evil-org-special-o/O' has `item' in it (not the default)."
(funcall orig-fn count)))
;;;###autoload
(defun +org*display-link-in-eldoc (orig-fn &rest args)
(defun +org-display-link-in-eldoc-a (orig-fn &rest args)
"Display the link at point in eldoc."
(or (when-let (link (org-element-property :raw-link (org-element-context)))
(format "Link: %s" link))