branch: externals/org-remark commit 18f39bf119f7e00f2d645727d1125e903438d5e4 Merge: c506e61017 6bdd326e46 Author: Noboru Ota <m...@nobiot.com> Commit: Noboru Ota <m...@nobiot.com>
Merge branch 'main' into dev/1.3.0 --- NEWS | 3 ++ README-elpa | 7 ++- README.org | 2 +- .../2023-08-20T183400_how-to-buffer-window.org | 2 + ...0T184309_C_how-to-set-icons-to-be-svg-images.md | 57 +++++++++++++++++++++ org-remark-info.el | 4 +- org-remark.el | 2 +- resources/images/v1.2.0/2023-08-20-SVG-icon.png | Bin 0 -> 147118 bytes 8 files changed, 73 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 1dd79b04fd..2eaacbd217 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +Version 1.2.1 - 2023-08-20 + - fix: org-remark-icon-mode is a void symbol + Version 1.2.0 - 2023-08-20 - feat(info): Org-remark supports Info diff --git a/README-elpa b/README-elpa index 0e1b7099a2..eca34e0481 100644 --- a/README-elpa +++ b/README-elpa @@ -35,7 +35,9 @@ _________________ [online] or or Info node `(org-remark) Getting Started'. For customization, refer to the customization group `org-remark' or - user manual: [online] or Info node `(org-remark) Customizing'. + user manual: [online] or Info node `(org-remark) Customizing'. A + [separate online article] has been written to guide you on how to + customize an icon (to be incorporated into the user manual later). An [introductory video] (8 minutes) and [V1.1.0 release introduction] (12 minutes) are available on YouTube. @@ -51,6 +53,9 @@ _________________ [online] <https://nobiot.github.io/org-remark/#Customizing> +[separate online article] +<https://github.com/nobiot/org-remark/tree/main/docs/articles/2023-08-20T184309_C_how-to-set-icons-to-be-svg-images.md> + [introductory video] <https://youtu.be/c8DHrAsFiLc> [V1.1.0 release introduction] <https://youtu.be/BTFuS21N00k> diff --git a/README.org b/README.org index 79ac957668..f007d8cb39 100644 --- a/README.org +++ b/README.org @@ -18,7 +18,7 @@ For installation and minimum configuration, refer to [[#installation][Installati Getting Started in the user manual will get you started in 5 minutes: [[https://nobiot.github.io/org-remark/#Getting-Started][online]] or or Info node `(org-remark) Getting Started'. -For customization, refer to the customization group `org-remark' or user manual: [[https://nobiot.github.io/org-remark/#Customizing][online]] or Info node `(org-remark) Customizing'. +For customization, refer to the customization group `org-remark' or user manual: [[https://nobiot.github.io/org-remark/#Customizing][online]] or Info node `(org-remark) Customizing'. A [[https://github.com/nobiot/org-remark/tree/main/docs/articles/2023-08-20T184309_C_how-to-set-icons-to-be-svg-images.md][separate online article]] has been written to guide you on how to customize an icon (to be incorporated into the user manual later). An [[https://youtu.be/c8DHrAsFiLc][introductory video]] (8 minutes) and [[https://youtu.be/BTFuS21N00k][V1.1.0 release introduction]] (12 minutes) are available on YouTube. diff --git a/docs/articles/2023-08-20T183400_how-to-buffer-window.org b/docs/articles/2023-08-20T183400_how-to-buffer-window.org new file mode 100644 index 0000000000..d8f79658b9 --- /dev/null +++ b/docs/articles/2023-08-20T183400_how-to-buffer-window.org @@ -0,0 +1,2 @@ +Buffer window customization #43 +https://github.com/nobiot/org-remark/discussions/43 diff --git a/docs/articles/2023-08-20T184309_C_how-to-set-icons-to-be-svg-images.md b/docs/articles/2023-08-20T184309_C_how-to-set-icons-to-be-svg-images.md new file mode 100644 index 0000000000..508cd5e888 --- /dev/null +++ b/docs/articles/2023-08-20T184309_C_how-to-set-icons-to-be-svg-images.md @@ -0,0 +1,57 @@ +--- +title: How to Set Icons to be SVG Images +created: 2023-08-20 +modified: 20 August 2023 +category: #creation +id: 2023-08-20T184309 +--- + +# How to Set Org-remark to Use SVG Icons + + + +I have released version 1.2.0 of Org-remark. In this version, highlights can display an icon to visually indicate that annotations exist for them. This was implemented in response to a feature request I received via YouTube comments and recorded in [issue #64](https://github.com/nobiot/org-remark/issues/64). + +The icon by default is a string of ASCII characters "`(*)`" so that it can be used for terminals. You can easily customize Org-remark to use an SVG image as shown in the image above. + +There are mainly two ways: + +1. Use the new built-in `icons` library available as of Emacs version 29.1 + +2. Create a custom function and use a third-party library such as [`svg-lib`](https://github.com/rougier/svg-lib) by Nicolas Rougier + +I will quickly show you the first option to use the new built-in library, which I believe is the easier. + +## Define an icon + +1. Get or create an SVG icon + + In my example, I downloaded a "pen" icon as an `.svg` file from [Boxicons](https://boxicons.com/?query=pen) ([licensed under The MIT License](https://boxicons.com/usage#license)). + +2. Put the downloaded SVG file somewhere in your local + + I put it at `~/.config/emacs/.cache/svg/bx-pen.svg`. + +3. Use `define-icon` macro to create an icon with the SVG file + + For example, I used the code below. Make sure to change my example to your own file name. You can also play with the `:height` property as you see fit. You can refer to the relevant Info nodes for more configuration detail by evaluating `(info "(elisp)icons)` and `(info "(emacs)icons")` in Emacs (version 29.1 onward). + +``` emacs-lisp +(define-icon annotation nil + '((image "/home/nobiot/.config/emacs/.cache/svg/bx-pen.svg" + :height (0.8 . em))) + "Notes svg icon for Org-remark" + :version 29.1) +``` + +## Customize Org-remark to use the icon + +Now the icon has been defined, you can set it to customizing variable `org-remark-icon-notes`, like so: + +``` emacs-lisp +;; I use `setopt` that is made available as of 29.1. `setq` works too. +;; Use whichever you prefer. +(setopt org-remark-icon-notes (icon-string 'annotation)) +``` + +If you have a buffer with highlights already open, you would need to `revert-buffer` to reload the highlights. You should see the icon you have defined instead of the default "`(*)`" string, like you see in the screen capture at the top of this article. diff --git a/org-remark-info.el b/org-remark-info.el index fc07589aaa..c97fc6b280 100644 --- a/org-remark-info.el +++ b/org-remark-info.el @@ -5,7 +5,7 @@ ;; Author: Noboru Ota <m...@nobiot.com> ;; URL: https://github.com/nobiot/org-remark ;; Created: 16 July 2023 -;; Last modified: 19 August 2023 +;; Last modified: 20 August 2023 ;; Package-Requires: ((emacs "27.1") (org "9.4")) ;; Keywords: org-mode, annotation, note-taking, marginal-notes, wp @@ -58,7 +58,9 @@ (require 'info) (require 'org-remark-global-tracking) (defvar org-remark-prop-source-file) +(defvar org-remark-mode) (declare-function org-remark-highlights-load "org-remark") +(declare-function org-remark-mode "orgremark") ;;;###autoload (define-minor-mode org-remark-info-mode diff --git a/org-remark.el b/org-remark.el index 8fce03f790..6a1233addc 100644 --- a/org-remark.el +++ b/org-remark.el @@ -4,7 +4,7 @@ ;; Author: Noboru Ota <m...@nobiot.com> ;; URL: https://github.com/nobiot/org-remark -;; Version: 1.2.0 +;; Version: 1.2.1 ;; Created: 22 December 2020 ;; Last modified: 20 August 2023 ;; Package-Requires: ((emacs "27.1") (org "9.4")) diff --git a/resources/images/v1.2.0/2023-08-20-SVG-icon.png b/resources/images/v1.2.0/2023-08-20-SVG-icon.png new file mode 100644 index 0000000000..1e8cdb5856 Binary files /dev/null and b/resources/images/v1.2.0/2023-08-20-SVG-icon.png differ