From 97fe1bf8480c8d5f2f84bbe7b6bdc0911ebad3bb Mon Sep 17 00:00:00 2001 From: Bram Schoenmakers Date: Sun, 26 May 2024 21:04:01 +0200 Subject: [PATCH] Update article --- gists.org | 12 ++++++------ gists/rx-in-lisp-data.org | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gists.org b/gists.org index 6daf0ce..cec8914 100644 --- a/gists.org +++ b/gists.org @@ -1152,15 +1152,15 @@ Which covers my (potential) GPG/SSH usage within Emacs. Now, anytime a I perform ,#+RESULTS: : \`\(?:bar\|foo\)\' - It's not only more readable (in my opinion), but it's also easier to construct with all the Lisp writing tools that can be used within Emacs (e.g. paredit or puni). + It's not only more readable (in my opinion), but it's also easier to edit with all the Lisp writing tools that can be used within Emacs (e.g. [[https://paredit.org/][paredit]] or [[https://github.com/AmaiKinono/puni][puni]]). - However, using =rx= is not always possible. Lisp data files may contain regular expressions but they are treated as data and not as executable code. + However, using the =rx= macro is not always possible. Lisp data files may contain regular expressions, but they are treated as data and not as executable code. - One prime example is elfeed-score: an Emacs package that allows you to write scoring rules for elfeed entries. Scoring rules are defined with an Lisp data file, and a rule may allow regular expressions but they have to be written out verbatim. + One prime example is [[https://www.unwoundstack.com/doc/elfeed-score/][elfeed-score]]: an Emacs package that allows you to write scoring rules for elfeed entries. Scoring rules are defined with an Lisp data file, and a rule may allow regular expressions but they have to be written out verbatim. Luckily there's a work-around with Org Mode: - - Write the scoring rules in an =lisp-data= source block. + - Write the scoring rules in an =lisp-data= source block (see below). - Tangle the file to a location that is read by the elfeed-score package (see variable ~elfeed-score-score-file~). - For the regular expression we use a small =elisp= block as follows: @@ -1173,11 +1173,11 @@ Which covers my (potential) GPG/SSH usage within Emacs. Now, anytime a I perform It accepts an /expression/ that is a Lisp form that =rx= accepts. It is converted to a string, surrounded by quotes and since we use it in a Lisp string, backslashes should be doubled. - - By naming the source block =rx= we can call it from other source blocks: + - By naming the source block =rx= we can call it from other source blocks using noweb expansion: ,#+begin_src org ,,#+begin_src lisp-data :tangle elfeed-scores.eld :noweb yes - (("title" (:text <> :value 1 :type r))) + (("title" (:text <> :value 1 :type r))) ,,#+end_src ,#+end_src diff --git a/gists/rx-in-lisp-data.org b/gists/rx-in-lisp-data.org index 797cbb9..105d013 100644 --- a/gists/rx-in-lisp-data.org +++ b/gists/rx-in-lisp-data.org @@ -7,15 +7,15 @@ Plain regular expressions are difficult to write and sometimes difficult to read #+RESULTS: : \`\(?:bar\|foo\)\' -It's not only more readable (in my opinion), but it's also easier to construct with all the Lisp writing tools that can be used within Emacs (e.g. paredit or puni). +It's not only more readable (in my opinion), but it's also easier to edit with all the Lisp writing tools that can be used within Emacs (e.g. [[https://paredit.org/][paredit]] or [[https://github.com/AmaiKinono/puni][puni]]). -However, using =rx= is not always possible. Lisp data files may contain regular expressions but they are treated as data and not as executable code. +However, using the =rx= macro is not always possible. Lisp data files may contain regular expressions, but they are treated as data and not as executable code. -One prime example is elfeed-score: an Emacs package that allows you to write scoring rules for elfeed entries. Scoring rules are defined with an Lisp data file, and a rule may allow regular expressions but they have to be written out verbatim. +One prime example is [[https://www.unwoundstack.com/doc/elfeed-score/][elfeed-score]]: an Emacs package that allows you to write scoring rules for elfeed entries. Scoring rules are defined with an Lisp data file, and a rule may allow regular expressions but they have to be written out verbatim. Luckily there's a work-around with Org Mode: -- Write the scoring rules in an =lisp-data= source block. +- Write the scoring rules in an =lisp-data= source block (see below). - Tangle the file to a location that is read by the elfeed-score package (see variable ~elfeed-score-score-file~). - For the regular expression we use a small =elisp= block as follows: @@ -28,11 +28,11 @@ Luckily there's a work-around with Org Mode: It accepts an /expression/ that is a Lisp form that =rx= accepts. It is converted to a string, surrounded by quotes and since we use it in a Lisp string, backslashes should be doubled. -- By naming the source block =rx= we can call it from other source blocks: +- By naming the source block =rx= we can call it from other source blocks using noweb expansion: #+begin_src org ,#+begin_src lisp-data :tangle elfeed-scores.eld :noweb yes - (("title" (:text <> :value 1 :type r))) + (("title" (:text <> :value 1 :type r))) ,#+end_src #+end_src