[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/lentic 31187db217 199/333: lentic-mode now works, and h
From: |
ELPA Syncer |
Subject: |
[elpa] externals/lentic 31187db217 199/333: lentic-mode now works, and has a lighter. |
Date: |
Tue, 27 Feb 2024 13:00:34 -0500 (EST) |
branch: externals/lentic
commit 31187db217fde70aeca65f41659d503e5068d0fa
Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
Commit: Phillip Lord <phillip.lord@newcastle.ac.uk>
lentic-mode now works, and has a lighter.
Lentic-mode actually did nothing and was never switched on. It has been
combined with lentic-start-mode which did not really have a purpose. It
now also has a lighter which works and which can be configured on using
the lentic-configuration object. By default, it just shows whether a
lentic buffer exists. lentic-block-configuration also uses this to
display whether the current-buffer is invalid wrt to its markers.
---
README.md | 7 ++++++
lentic-block.el | 27 ++++++++++++++++-----
lentic-mode.el | 74 ++++++++++++++++++++++++++++++++++++++-------------------
lentic.el | 25 +++++++++++++++----
4 files changed, 97 insertions(+), 36 deletions(-)
diff --git a/README.md b/README.md
index e593d8139b..1b6053d8a0 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,13 @@ completed the relevant paper with the FSF.
- Full Documentation System added
- Lentic buffers can be auto-killed now
- Rot13 added after many requests
+- Mode lighter now shows when a lentic buffer exists.
+- lentic-block shows invalid states in the mode-line
+
+#### Breaking Changes
+
+lentic-start-mode has now gone, and been combined with lentic-mode. A new
+global-lentic-mode has been introduced which you should use instead.
#### Bug Fix
diff --git a/lentic-block.el b/lentic-block.el
index 6a23e4e334..470f6a1165 100644
--- a/lentic-block.el
+++ b/lentic-block.el
@@ -69,17 +69,26 @@
:documentation
"Demarcation for the start of the commenting region")
(comment-stop :initarg :comment-stop
- :documentation
+ :documentation
"Demarcaction for the end of the commenting region.")
(case-fold-search :initarg :case-fold-search
- :documentation
- "Should match be case sensitive"
- :initform :default))
+ :documentation
+ "Should match be case sensitive"
+ :initform :default)
+ (valid :initarg :valid
+ :documentation "True if markers in the buffer are valid"
+ :initform t))
:documentation "Base configuration for blocked lentics.
A blocked lentic is one where blocks of the buffer have a
start of line block comment in one buffer but not the other."
:abstract t)
+(defmethod lentic-mode-line-string ((conf lentic-block-configuration))
+ (if (not
+ (oref conf :valid))
+ "invalid"
+ (call-next-method conf)))
+
(defmethod lentic-blk-comment-start-regexp
((conf lentic-block-configuration))
;; todo -- what does this regexp do?
@@ -195,10 +204,17 @@ an implicit stop."
(car match-block))
(match-end
(cadr match-block)))
- (unless
+ (if
(= (length match-start)
(length match-end))
+ (unless
+ (oref conf :valid)
+ (oset conf :valid t)
+ (lentic-update-display))
(lentic-log "delimiters do not match")
+ (when (oref conf :valid)
+ (oset conf :valid nil)
+ (lentic-update-display))
(signal 'unmatched-delimiter-error
(list buffer)))
(with-current-buffer buffer
@@ -442,5 +458,4 @@ between the two buffers; we don't care which one has
comments."
(provide 'lentic-block)
;;; lentic-block.el ends here
-
;; #+end_src
diff --git a/lentic-mode.el b/lentic-mode.el
index 0ee432511c..3d8f93dbc5 100644
--- a/lentic-mode.el
+++ b/lentic-mode.el
@@ -31,8 +31,10 @@
;; ** Preliminaries
+;; #+begin_src emacs-lisp
(require 'lentic)
(require 'lentic-doc)
+;; #+end_src
;; ** Window and Buffer Functions
@@ -114,10 +116,10 @@ A and B are the buffers."
(set-window-buffer
(split-window-right)
(lentic-create lentic-config)))
+;; #+end_src
;; ** Minor Mode
-
;; #+begin_src emacs-lisp
;;;###autoload
(defun lentic-mode-toggle-auto-sync-point ()
@@ -135,9 +137,49 @@ A and B are the buffers."
(define-key lentic-mode-map
(kbd "C-c ,h") 'lentic-mode-move-lentic-window)
+(define-key lentic-mode-map
+ (kbd "C-c ,b") 'lentic-mode-split-window-below)
+
+(define-key lentic-mode-map
+ (kbd "C-c ,t") 'lentic-mode-split-window-right)
+
+(define-key lentic-mode-map
+ (kbd "C-c ,f") 'lentic-mode-insert-file-local)
+
+(define-key lentic-mode-map
+ (kbd "C-c ,c") 'lentic-mode-create-in-selected-window)
+
+(defcustom lentic-mode-line-lighter "Lentic"
+ "Default mode lighter for lentic"
+ :group 'lentic
+ :type 'string)
+
+(defvar-local lentic-mode-line (format " %s[]" lentic-mode-line-lighter))
+
+(defun lentic-mode-update-mode-line ()
+ (setq lentic-mode-line
+ (format " %s[%s]"
+ lentic-mode-line-lighter
+ (if lentic-config
+ (lentic-mode-line-string lentic-config)
+ "")))
+ (force-mode-line-update))
+
+(defun lentic-mode-buffer-list-update-hook ()
+ (-map
+ (lambda (b)
+ (with-current-buffer
+ b
+ (lentic-mode-update-mode-line)))
+ (buffer-list)))
+
+(add-hook 'buffer-list-update-hook
+ 'lentic-mode-buffer-list-update-hook)
+
;;;###autoload
(define-minor-mode lentic-mode
- :lighter "lb"
+ "Documentation"
+ :lighter lentic-mode-line
:keymap lentic-mode-map)
;;;###autoload
@@ -178,32 +220,14 @@ A and B are the buffers."
" Variables:\nlentic-init: %s\nEnd:\n") init-function))
(comment-region start (point)))))
-(defvar lentic-start-mode-map (make-sparse-keymap))
-
-(define-key lentic-start-mode-map
- (kbd "C-c ,b") 'lentic-mode-split-window-below)
-
-(define-key lentic-start-mode-map
- (kbd "C-c ,t") 'lentic-mode-split-window-right)
-
-(define-key lentic-start-mode-map
- (kbd "C-c ,f") 'lentic-mode-insert-file-local)
-
-(define-key lentic-start-mode-map
- (kbd "C-c ,c") 'lentic-mode-create-in-selected-window)
-
;;;###autoload
-(define-minor-mode lentic-start-mode
- :lighter ""
- :keymap lentic-start-mode-map)
+(define-globalized-minor-mode global-lentic-mode
+ lentic-mode
+ lentic-mode-on)
-;;;###autoload
-(define-globalized-minor-mode global-lentic-start-mode
- lentic-start-mode
- lentic-start-on)
+(defun lentic-mode-on ()
+ (lentic-mode 1))
-(defun lentic-start-on ()
- (lentic-start-mode 1))
;; #+end_src
(provide 'lentic-mode)
diff --git a/lentic.el b/lentic.el
index 3ff4550f5a..9626430a44 100644
--- a/lentic.el
+++ b/lentic.el
@@ -82,13 +82,13 @@
;; lentic can be installed through MELPA/Marmalade then add
-;; (global-lentic-start-mode)
+;; (global-lentic-mode)
;; to your .emacs.
;; The main user entry points are accessible through the lentic edit menu, or
-;; through `global-lentic-start-mode' which adds keybindings to tools to
create a
-;; new lentic buffer. `lentic-mode-create-in-selected-window' will create a
+;; through `global-lentic-mode' which adds keybindings to create and manipulate
+;; new lentic buffers. `lentic-mode-create-in-selected-window' will create a
;; lentic-buffer swap it to the current window, while
;; `lentic-mode-split-window-below' will split the current window and create a
;; lentic buffer.
@@ -264,6 +264,15 @@ or create it if it does not exist."
(or (lentic-that conf)
(lentic-create conf)))
+(defmethod lentic-mode-line-string ((conf lentic-configuration))
+ (when (slot-boundp conf :that-buffer)
+ (let ((that (oref conf :that-buffer)))
+ (if
+ (and that
+ (buffer-live-p that))
+ "on"
+ ""))))
+
;; #+end_src
;; ** Default Configuration
@@ -509,8 +518,8 @@ repeated errors.")
(delete-file (buffer-file-name)))
;; kill lentic-buffers
(when (oref lentic-config :creator)
- (kill-buffer
- (lentic-that lentic-config))))))
+ (kill-buffer
+ (lentic-that lentic-config))))))
(defun lentic-kill-emacs-hook ()
(-map
@@ -719,6 +728,12 @@ same top-left location. Update details depend on CONF."
(goto-char from-point)
(set-window-start window from-window-start))))
(get-buffer-window-list (lentic-that conf))))))
+
+;; put this here so we don't have to require lentic-mode to ensure that the
+;; mode line is updated.
+(defun lentic-update-display ()
+ (when (fboundp 'lentic-mode-update-mode-line)
+ (lentic-mode-update-mode-line)))
;; #+end_src
- [elpa] externals/lentic d022ddc9a5 174/333: kill line, erase buffer test., (continued)
- [elpa] externals/lentic d022ddc9a5 174/333: kill line, erase buffer test., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 3611abe92d 182/333: Haskell Support Added., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic b870123e0e 186/333: Additional tools to generate info files., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 710626852d 189/333: Documentation formats ignored., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 9039dd3bdd 193/333: Contributions copyright fix., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic ae9e4d7e63 184/333: Fix window breakage and wrong var name., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 50ad3e35bf 192/333: Documentation system added., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic e567b169c9 185/333: Kill lentic buffer when creator buffer is killed., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic f90c5d07a8 179/333: lentic-mode now requires lentic., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 23a39ef037 190/333: Debug statements removed from hooks., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 31187db217 199/333: lentic-mode now works, and has a lighter.,
ELPA Syncer <=
- [elpa] externals/lentic 9de0fae6f8 178/333: Autoloads automatically required by package., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 819ac479c4 188/333: Removed erroneous () in header., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic b4c95e69df 196/333: Cosmetic Change., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic a1799b72f7 197/333: Rot-13 added., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic f90bda3f74 204/333: Prepare for next iteration., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 5f8b9dbe0a 205/333: literate-haskell example., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic cafbf52329 206/333: Auto save files excluded!, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 593cd7a7b5 203/333: v0.7 release., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 4e42c930d7 210/333: Default mode is now the same as the main buffer., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 94d7489962 208/333: lentic-doc now requires f.el, ELPA Syncer, 2024/02/27