Add function to format org files
Change default line numbers to be relative
This commit is contained in:
22
config.el
22
config.el
@@ -40,7 +40,8 @@
|
|||||||
|
|
||||||
;; This determines the style of line numbers in effect. If set to `nil', line
|
;; This determines the style of line numbers in effect. If set to `nil', line
|
||||||
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
||||||
(setq display-line-numbers-type t)
|
;; (setq display-line-numbers-type t)
|
||||||
|
(setq display-line-numbers-type 'relative)
|
||||||
|
|
||||||
;; If you use `org' and don't want your org files in the default location below,
|
;; If you use `org' and don't want your org files in the default location below,
|
||||||
;; change `org-directory'. It must be set before org loads!
|
;; change `org-directory'. It must be set before org loads!
|
||||||
@@ -138,3 +139,22 @@
|
|||||||
(append exec-path
|
(append exec-path
|
||||||
(split-string (getenv "PATH") path-separator t)))))
|
(split-string (getenv "PATH") path-separator t)))))
|
||||||
(setenv "PATH" (mapconcat 'identity (delete-dups path) path-separator))))
|
(setenv "PATH" (mapconcat 'identity (delete-dups path) path-separator))))
|
||||||
|
|
||||||
|
;; Based off https://github.com/alphapapa/unpackaged.el#ensure-blank-lines-between-headings-and-before-contents
|
||||||
|
;;;###autoload
|
||||||
|
(defun org-format (&optional prefix)
|
||||||
|
"Ensure blank lines exist after each org entry (before each heading).
|
||||||
|
With prefix, operate on whole buffer"
|
||||||
|
(interactive "P")
|
||||||
|
(org-map-entries (lambda ()
|
||||||
|
(let ((end (org-entry-end-position)))
|
||||||
|
(goto-char end)
|
||||||
|
(unless (string-equal (string (char-before)) "\n")
|
||||||
|
;; Insert blank line after entry end
|
||||||
|
(insert "\n"))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
t (if prefix
|
||||||
|
nil
|
||||||
|
'tree))
|
||||||
|
)
|
||||||
|
|||||||
@@ -15,9 +15,3 @@
|
|||||||
("csh" . sh) ("ksh88" . sh) ("oash" . sh) ("pdksh" . sh) ("mksh" . sh)
|
("csh" . sh) ("ksh88" . sh) ("oash" . sh) ("pdksh" . sh) ("mksh" . sh)
|
||||||
("posix" . sh) ("wksh" . sh) ("wsh" . sh) ("zsh" . sh) ("cs" . csharp)
|
("posix" . sh) ("wksh" . sh) ("wsh" . sh) ("zsh" . sh) ("cs" . csharp)
|
||||||
("rpm" . sh))))
|
("rpm" . sh))))
|
||||||
(custom-set-faces
|
|
||||||
;; custom-set-faces was added by Custom.
|
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
|
||||||
;; Your init file should contain only one such instance.
|
|
||||||
;; If there is more than one, they won't work right.
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user