[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/lentic 2e290c74e3 207/333: Multiple oset added, and fac
From: |
ELPA Syncer |
Subject: |
[elpa] externals/lentic 2e290c74e3 207/333: Multiple oset added, and factor constructors. |
Date: |
Tue, 27 Feb 2024 13:00:35 -0500 (EST) |
branch: externals/lentic
commit 2e290c74e34b6ef185a2f36eb398be165825bb3e
Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
Commit: Phillip Lord <phillip.lord@newcastle.ac.uk>
Multiple oset added, and factor constructors.
Add a new command for adding multiple properties at once. This allows me
to factor our the multiple uses of the same settings in constructors. As
the oset command also returns the object, I have also factored out many
let bindings.
---
lentic-asciidoc.el | 48 ++++++++--------
lentic-doc.el | 1 -
lentic-latex-code.el | 36 ++++++------
lentic-org.el | 158 ++++++++++++++++++++++-----------------------------
lentic.el | 18 ++++++
5 files changed, 129 insertions(+), 132 deletions(-)
diff --git a/lentic-asciidoc.el b/lentic-asciidoc.el
index eac256a80c..6d2997f6ff 100644
--- a/lentic-asciidoc.el
+++ b/lentic-asciidoc.el
@@ -31,19 +31,26 @@
;;; Code:
;; #+begin_src emacs-lisp
+(require 'lentic)
(require 'lentic-block)
(require 'm-buffer)
+(require 'f)
-(defun lentic-asciidoc-commented-new ()
- (lentic-commented-asciidoc-configuration
- "lb-commented-clojure asciidoc"
+(defun lentic-asciidoc-oset (conf)
+ (lentic-m-oset
+ conf
:this-buffer (current-buffer)
- :lentic-file
- (concat
- (file-name-sans-extension
- (buffer-file-name)) ".adoc")
:comment ";; "))
+(defun lentic-asciidoc-commented-new ()
+ (lentic-asciidoc-oset
+ (lentic-commented-asciidoc-configuration
+ "lb-commented-clojure asciidoc"
+ :lentic-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name)) ".adoc"))))
+
(defun lentic-clojure-asciidoc-init ()
(lentic-asciidoc-commented-new))
@@ -51,14 +58,13 @@
'lentic-clojure-asciidoc-init)
(defun lentic-asciidoc-uncommented-new ()
- (lentic-uncommented-asciidoc-configuration
- "lb-uncommented-clojure-asciidoc"
- :this-buffer (current-buffer)
- :lentic-file
- (concat
- (file-name-sans-extension
- (buffer-file-name)) ".clj")
- :comment ";; "))
+ (lentic-asciidoc-oset
+ (lentic-uncommented-asciidoc-configuration
+ "lb-uncommented-clojure-asciidoc"
+ :lentic-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name)) ".clj"))))
;;;###autoload
(defun lentic-asciidoc-clojure-init ()
@@ -145,17 +151,13 @@ This should remove other \"....\" matches.
(defmethod lentic-invert
((conf lentic-commented-asciidoc-configuration))
- (let ((rtn
- (lentic-asciidoc-uncommented-new)))
- (oset rtn :that-buffer (lentic-this conf))
- rtn))
+ (lentic-m-oset (lentic-asciidoc-uncommented-new)
+ :that-buffer (lentic-this conf)))
(defmethod lentic-invert
((conf lentic-uncommented-asciidoc-configuration))
- (let ((rtn
- (lentic-asciidoc-commented-new)))
- (oset rtn :that-buffer (lentic-this conf))
- rtn))
+ (lentic-m-oset (lentic-asciidoc-commented-new)
+ :that-buffer (lentic-this conf)))
(provide 'lentic-asciidoc)
;;; lentic-asciidoc.el ends here
diff --git a/lentic-doc.el b/lentic-doc.el
index 58a115b4cd..6027dce53b 100644
--- a/lentic-doc.el
+++ b/lentic-doc.el
@@ -32,7 +32,6 @@
(require 'ox-html)
(require 'browse-url)
(require 'lentic)
-(require 'f)
;; #+end_src
;; ** Orgify Package
diff --git a/lentic-latex-code.el b/lentic-latex-code.el
index 8d6d84fd0e..037c585af0 100644
--- a/lentic-latex-code.el
+++ b/lentic-latex-code.el
@@ -41,18 +41,23 @@
;; #+begin_src emacs-lisp
(require 'lentic-block)
-(defun lentic-clojure-to-latex-new ()
- (lentic-commented-block-configuration
- "lb-commented clojure latex"
+(defun lentic-latex-clojure-oset (conf)
+ (lentic-m-oset
+ conf
:this-buffer (current-buffer)
- :lentic-file
- (concat
- (file-name-sans-extension
- (buffer-file-name)) ".tex")
:comment ";; "
:comment-start "\\\\end{code}"
:comment-stop "\\\\begin{code}"))
+(defun lentic-clojure-to-latex-new ()
+ (lentic-latex-clojure-oset
+ (lentic-commented-block-configuration
+ "lb-commented clojure latex"
+ :lentic-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name)) ".tex"))))
+
;;;###autoload
(defun lentic-clojure-latex-init ()
(lentic-clojure-to-latex-new))
@@ -62,16 +67,13 @@
(defun lentic-latex-to-clojure-new ()
- (lentic-uncommented-block-configuration
- "lb-commented latex clojure"
- :this-buffer (current-buffer)
- :lentic-file
- (concat
- (file-name-sans-extension
- (buffer-file-name)) ".clj")
- :comment ";; "
- :comment-start "\\\\end{code}"
- :comment-stop "\\\\begin{code}"))
+ (lentic-latex-clojure-oset
+ (lentic-uncommented-block-configuration
+ "lb-commented latex clojure"
+ :lentic-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name)) ".clj"))))
;;;###autoload
(defun lentic-latex-clojure-init ()
diff --git a/lentic-org.el b/lentic-org.el
index bb82d9ef45..e666e1e269 100644
--- a/lentic-org.el
+++ b/lentic-org.el
@@ -71,42 +71,38 @@
;; the emacs-lisp mode lentic.
;; #+BEGIN_SRC emacs-lisp
-(defun lentic-org-to-el-new ()
- (lentic-uncommented-block-configuration
- "lb-org-to-el"
+(defun lentic-org-oset (conf)
+ (lentic-m-oset
+ conf
:this-buffer (current-buffer)
- :lentic-file
- (concat
- (file-name-sans-extension
- (buffer-file-name))
- ".el")
:comment ";; "
:comment-stop "#\\\+BEGIN_SRC emacs-lisp"
:comment-start "#\\\+END_SRC"))
;;;###autoload
(defun lentic-org-el-init ()
- (lentic-org-to-el-new))
+ (lentic-org-oset
+ (lentic-uncommented-block-configuration
+ "lb-org-to-el"
+ :lentic-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name))
+ ".el"))))
(add-to-list 'lentic-init-functions
'lentic-org-el-init)
-(defun lentic-el-to-org-new ()
- (lentic-commented-block-configuration
- "lb-el-to-org"
- :this-buffer (current-buffer)
- :lentic-file
- (concat
- (file-name-sans-extension
- (buffer-file-name))
- ".org")
- :comment ";; "
- :comment-stop "#\\\+BEGIN_SRC emacs-lisp"
- :comment-start "#\\\+END_SRC"))
-
;;;###autoload
(defun lentic-el-org-init ()
- (lentic-el-to-org-new))
+ (lentic-org-oset
+ (lentic-commented-block-configuration
+ "lb-el-to-org"
+ :lentic-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name))
+ ".org"))))
(add-to-list 'lentic-init-functions
'lentic-el-org-init)
@@ -303,28 +299,21 @@
(defmethod lentic-invert
((conf lentic-org-to-orgel-configuration))
- (let ((rtn
- (lentic-orgel-to-org-new)))
- (oset rtn :that-buffer
- (lentic-this conf))
- rtn))
-
-(defun lentic-org-to-orgel-new ()
- (lentic-org-to-orgel-configuration
- "lb-orgel-to-el"
- :this-buffer (current-buffer)
- :lentic-file
- (concat
- (file-name-sans-extension
- (buffer-file-name))
- ".el")
- :comment ";; "
- :comment-stop "#\\\+BEGIN_SRC emacs-lisp"
- :comment-start "#\\\+END_SRC"))
+ (lentic-m-oset
+ (lentic-orgel-org-init)
+ :that-buffer
+ (lentic-this conf)))
;;;###autoload
(defun lentic-org-orgel-init ()
- (lentic-org-to-orgel-new))
+ (lentic-org-oset
+ (lentic-org-to-orgel-configuration
+ "lb-orgel-to-el"
+ :lentic-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name))
+ ".el"))))
(add-to-list 'lentic-init-functions
'lentic-org-orgel-init)
@@ -364,52 +353,37 @@
(defmethod lentic-invert
((conf lentic-orgel-to-org-configuration))
- (let ((rtn
- (lentic-org-to-orgel-new)))
- (oset rtn :delete-on-exit t)
- (oset rtn :that-buffer (lentic-this conf))
- rtn))
-
-(defun lentic-orgel-to-org-new ()
- (lentic-orgel-to-org-configuration
- "lb-orgel-to-org"
- :this-buffer (current-buffer)
- ;; we don't really need a file and could cope without, but org mode assumes
- ;; that the buffer is file name bound when it exports. As it happens, this
- ;; also means that file saving is possible which in turn saves the el file
- :lentic-file
- (concat
- (file-name-sans-extension
- (buffer-file-name))
- ".org")
- :comment ";; "
- :comment-stop "#\\\+BEGIN_SRC emacs-lisp"
- :comment-start "#\\\+END_SRC"))
+ (lentic-m-oset
+ (lentic-org-orgel-init)
+ :delete-on-exit t
+ :that-buffer (lentic-this conf)))
;;;###autoload
(defun lentic-orgel-org-init ()
- (lentic-orgel-to-org-new))
+ (lentic-org-oset
+ (lentic-orgel-to-org-configuration
+ "lb-orgel-to-org"
+ ;; we don't really need a file and could cope without, but org mode assumes
+ ;; that the buffer is file name bound when it exports. As it happens, this
+ ;; also means that file saving is possible which in turn saves the el file
+ :lentic-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name))
+ ".org"))))
(add-to-list 'lentic-init-functions
'lentic-orgel-org-init)
;; #+END_SRC
-
-
-
;; *** org->clojure
;; #+BEGIN_SRC emacs-lisp
-(defun lentic-org-to-clojure-new ()
- (lentic-uncommented-block-configuration
- "lb-org-to-clojure"
+(defun lentic-org-clojure-oset (conf)
+ (lentic-m-oset
+ conf
:this-buffer (current-buffer)
- :lentic-file
- (concat
- (file-name-sans-extension
- (buffer-file-name))
- ".clj")
:comment ";; "
:comment-stop "#\\\+BEGIN_SRC clojure"
:comment-start "#\\\+END_SRC"
@@ -417,27 +391,30 @@
;; will be ignored. Probably we should count instead!
:case-fold-search nil))
+;;;###autoload
(defun lentic-org-clojure-init ()
- (lentic-org-to-clojure-new))
+ (lentic-org-clojure-oset
+ (lentic-uncommented-block-configuration
+ "lb-org-to-clojure"
+ :lentic-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name))
+ ".clj"))))
(add-to-list 'lentic-init-functions
'lentic-org-clojure-init)
-(defun lentic-clojure-to-org-new ()
- (lentic-commented-block-configuration
- "lb-clojure-to-org"
- :this-buffer (current-buffer)
- :lentic-file
- (concat
- (file-name-sans-extension
- (buffer-file-name))
- ".org")
- :comment ";; "
- :comment-stop "#\\\+BEGIN_SRC clojure"
- :comment-start "#\\\+END_SRC"))
-
+;;;###autoload
(defun lentic-clojure-org-init ()
- (lentic-clojure-to-org-new))
+ (lentic-org-clojure-oset
+ (lentic-commented-block-configuration
+ "lb-clojure-to-org"
+ :lentic-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name))
+ ".org"))))
(add-to-list 'lentic-init-functions
'lentic-clojure-org-init)
@@ -454,4 +431,3 @@
(provide 'lentic-org)
;;; lentic-org.el ends here
;; #+END_SRC
-
diff --git a/lentic.el b/lentic.el
index 50091dcdfc..cf1d49315d 100644
--- a/lentic.el
+++ b/lentic.el
@@ -273,6 +273,24 @@ or create it if it does not exist."
"on"
""))))
+(defun lentic-m-oset (obj &rest plist)
+ "On OBJ set all properties in PLIST.
+Returns OBJ. See also `lentic-a-oset'"
+ (lentic-a-oset obj plist))
+
+(defun lentic-a-oset (obj plist)
+ "On OBJ, set all properties in PLIST.
+This is a utility function which just does the same as oset, but
+for lots of things at once. Returns OBJ."
+ (-map
+ (lambda (n)
+ (eieio-oset
+ obj
+ (car n)
+ (cadr n)))
+ (-partition 2 plist))
+ obj)
+
;; #+end_src
;; ** Default Configuration
- [elpa] externals/lentic ec9bcd0d64 180/333: Update for 0.6.1 release., (continued)
- [elpa] externals/lentic ec9bcd0d64 180/333: Update for 0.6.1 release., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 11a35ea3ac 181/333: Prepare for next iteration., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 4003ae1a41 194/333: Travis badge., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic d6ac74dc73 191/333: No error if m-buffer is not present., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 6587a9a0f7 198/333: Missing dev-resource added., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic a5a001f999 183/333: Lentic-mode menu corrected and extended., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 3431295354 195/333: License updates in some files., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 450de96809 187/333: Remove file on exit., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 9c60f116a8 200/333: Lentic top level documentation added., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 66a056211c 202/333: Copyright and Documentation updates., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 2e290c74e3 207/333: Multiple oset added, and factor constructors.,
ELPA Syncer <=
- [elpa] externals/lentic 71017538d7 211/333: Multiple lentic-buffers are now possible., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 0b8b94003d 214/333: Multiple buffer support for org/orgel., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 849dc0dc24 209/333: Default mode is now the same as main buffer., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 61d6ea4ac5 222/333: Save lentic buffers only when file-associated., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 28a1951c14 216/333: Use default-browser for external view., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 8a007a60c5 218/333: Default for init is now a list., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 35db8a038a 219/333: Major-mode functions reworked totally., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 243d2710d1 224/333: Advance m-buffer version to fix point bug., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic bc6e3db510 237/333: Merge branch 'Prathyvsh-patch-1', ELPA Syncer, 2024/02/27
- [elpa] externals/lentic d4d494bb20 232/333: Full documentation for lentic.el., ELPA Syncer, 2024/02/27