branch: externals/org-remark commit 048c0e806e988d631cbaccca1d88ae2a7fd4287a Author: Noboru Ota <m...@nobiot.com> Commit: Noboru Ota <m...@nobiot.com>
intrnl: Update most functions to return t/nil Striving to be more functional. Some functions do not return a value/list. In this case, functions should return t if an expected operation for the args occured in addtion to enact the (intended) side effect (e.g. change a variable). I don't think I am strict about it -- e.g. I left the `sort-highlights` function mostly non-fp style -- it assumes a buffer-local variable is used, instead of importing it as an arg, and sets the variable after sorting distructively. It was not worth updating it -- it returns t when the side effect is enacted (sorting distructively). --- .gitignore | 6 ++++++ README.org | 12 ++++++------ org-marginalia.el | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..47f208c0b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*/#marginalia.org# +*.bak +*.log + +/demo/2020-12-24_10-00-13.png +/demo/Copy of 2020-12-24_10-00-13.png diff --git a/README.org b/README.org index f8f763de9d..9c089d5cbc 100644 --- a/README.org +++ b/README.org @@ -166,11 +166,11 @@ This work is licensed under a GPLv3 license. For a full copy of the licese, refe :END: This section is used as a demonstration and a collection of my ideas for this package. -** defun om/next +** :PROPERTIES: :marginalia-id: 33710cc4 -:marginalia-source-beg: 15735 -:marginalia-source-end: 15748 +:marginalia-source-beg: 21414 +:marginalia-source-end: 21414 :END: [[file:~/local-repos/org-marginalia/org-marginalia.el][org-marginalia]] I need to think it through. @@ -191,11 +191,11 @@ At the moment, ~om/list-highlights-positions~ has been changed to return beginni :marginalia-source-end: 6640 :END: [[file:~/local-repos/org-marginalia/org-marginalia.el][org-marginalia]] -** interactive +** :PROPERTIES: :marginalia-id: 9f60c405 -:marginalia-source-beg: 15926 -:marginalia-source-end: 15937 +:marginalia-source-beg: 21414 +:marginalia-source-end: 21414 :END: [[file:~/local-repos/org-marginalia/org-marginalia.el][org-marginalia]] ** defun om/mark diff --git a/org-marginalia.el b/org-marginalia.el index 18ba9155e0..7c871da207 100644 --- a/org-marginalia.el +++ b/org-marginalia.el @@ -504,7 +504,8 @@ If none, return nil." (defun om/sort-highlights-list () "Utility function to sort `om/sort-highlights'." (when om/highlights - (setq om/highlights (seq-sort-by (lambda (s) (car (cdr s))) #'< om/highlights)))) + (setq om/highlights (seq-sort-by (lambda (s) (car (cdr s))) #'< om/highlights)) + t)) (defun om/find-next-highlight () "Return the beg point of the next highlight.