[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dslide 8a893d858b 215/230: Proper generic methods for eldo
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dslide 8a893d858b 215/230: Proper generic methods for eldoc completions |
Date: |
Sun, 7 Jul 2024 19:00:42 -0400 (EDT) |
branch: elpa/dslide
commit 8a893d858bbf9f41e99ce6e26297d11f42cb6dba
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>
Proper generic methods for eldoc completions
When using the automatic generics, Eldoc just reports (&args args), which
is not
particularly helpful. This greatly aids those extending slide actions.
---
dslide.el | 66 ++++++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 44 insertions(+), 22 deletions(-)
diff --git a/dslide.el b/dslide.el
index b699a65ae5..8a9276b419 100644
--- a/dslide.el
+++ b/dslide.el
@@ -1084,9 +1084,11 @@ to some technique that works with contents above and
below."))
heading
(error "Begin marker no longer points at a heading"))))
+(cl-defgeneric dslide-marker (obj pom)
+ "Get or set OBJ's progress marker to optional POM.
+Errors when asked for a marker before one has been set.")
+
(cl-defmethod dslide-marker ((obj dslide-action) &optional pom)
- "Set OBJ's marker slot to POM or return marker position.
-Errors when asked for a marker before one has been set."
(let ((marker (or (oref obj marker)
(pcase (type-of pom)
('marker pom)
@@ -1098,9 +1100,10 @@ Errors when asked for a marker before one has been set."
(marker-position (oset obj marker marker))
(error "No marker was initialized"))))
-(cl-defmethod dslide-section-next ((obj dslide-action) type &optional
- pred reverse-in-place info no-recursion)
- "Return next element of TYPE.
+(cl-defgeneric dslide-section-next (obj type
+ &optional pred reverse-in-place
+ info no-recursion)
+ "Return OBJ's next element of TYPE.
Only matches elements beginning after the marker stored in the
action OBJ. Moves the marker forward to the beginning of the
matched element or to the end of heading.
@@ -1117,7 +1120,11 @@ matching element is found. This allows a subsequent
backwards
step to process the last element.
Optional PRED INFO and NO-RECURSION are the same as for
-`dslide-contents-map'."
+`dslide-contents-map'.")
+
+(cl-defmethod dslide-section-next ((obj dslide-action) type
+ &optional pred reverse-in-place
+ info no-recursion)
(if-let ((next (dslide--section-next
(dslide-heading obj) type (dslide-marker obj)
pred reverse-in-place info no-recursion)))
@@ -1127,8 +1134,9 @@ Optional PRED INFO and NO-RECURSION are the same as for
(dslide-marker obj (org-element-property :end (dslide-heading obj)))
nil))
-(cl-defmethod dslide-section-previous ((obj dslide-action) type &optional
- pred reverse-in-place info no-recursion)
+(cl-defgeneric dslide-section-previous (obj type
+ &optional pred reverse-in-place
+ info no-recursion)
"Return previous element of TYPE.
Only matches elements beginning before the marker stored in the
action, OBJ. Moves the marker backward to the beginning of the
@@ -1144,7 +1152,11 @@ element is found. This allows actions to differentiate
the begin
state from being at the first matching element.
Optional PRED INFO and NO-RECURSION are the same as for
-`dslide-contents-map'."
+`dslide-contents-map'.")
+
+(cl-defmethod dslide-section-previous ((obj dslide-action) type
+ &optional pred reverse-in-place
+ info no-recursion)
(if-let ((previous (dslide--section-previous
(dslide-heading obj) type (dslide-marker obj)
pred reverse-in-place info no-recursion)))
@@ -1153,16 +1165,20 @@ Optional PRED INFO and NO-RECURSION are the same as for
(dslide-marker obj (org-element-property :begin (dslide-heading obj)))
nil))
+(cl-defgeneric dslide-section-map (obj type fun
+ &optional info first-match no-recursion)
+ "Map FUN over TYPE elements in OBJ's heading's section.
+Optional PRED INFO FIRST-MATCH and NO-RECURSION are the same as
+for `dslide-contents-map'.")
+
(cl-defmethod dslide-section-map ((obj dslide-action) type fun
&optional info first-match no-recursion)
- "Map FUN over TYPE elements in OBJ's heading's section.
-Optional PRED INFO FIRST-MATCH and NO-RECURSION are the same as
-for `dslide-contents-map'."
(dslide--section-map
(dslide-heading obj)
type fun info first-match no-recursion))
-;; begin and end are using the defaults. override these if inappropriate.
+;; begin and end are using the defaults from `dslide-stateful-sequence'.
+;; override when extending new actions if inappropriate.
(cl-defmethod dslide-final ((obj dslide-action))
(when-let ((marker (oref obj marker)))
@@ -1543,8 +1559,7 @@ stateful-sequence class methods. METHOD-NAME is a
string."
"Base class for slide actions."
:abstract t)
-(cl-defmethod dslide-narrow ((obj dslide-slide-action)
- &optional with-children)
+(cl-defgeneric dslide-narrow (obj &optional with-children)
"Narrow to OBJ's heading
Optional WITH-CHILDREN will include the child headings in the
restriction.
@@ -1553,7 +1568,10 @@ Inline children have their `inline' slot set to non-nil
and will
not attempt to narrow at all.
This function must return nil when it performs no update to the
-restriction, meaning no progress was made."
+restriction, meaning no progress was made.")
+
+(cl-defmethod dslide-narrow ((obj dslide-slide-action)
+ &optional with-children)
(unless (oref obj inline)
(let* ((heading (dslide-heading obj))
(begin (oref obj begin))
@@ -1573,8 +1591,7 @@ restriction, meaning no progress was made."
;; Return progress
begin))))
-(cl-defmethod dslide-child-next ((obj dslide-slide-action)
- &optional reverse-in-place)
+(cl-defgeneric dslide-child-next (obj &optional reverse-in-place)
"Return the next direct child heading element.
Only matches headings beginning after the marker stored in the
action OBJ. Moves the marker forward to the beginning of the
@@ -1589,7 +1606,10 @@ heading.
The action's marker is moved to the end of the heading if no
matching heading is found. This allows a subsequent backwards
-step to process the last heading."
+step to process the last heading.")
+
+(cl-defmethod dslide-child-next ((obj dslide-slide-action)
+ &optional reverse-in-place)
(if-let* ((marker (dslide-marker obj))
(heading (dslide-heading obj))
(target-level (1+ (org-element-property :level heading)))
@@ -1607,8 +1627,7 @@ step to process the last heading."
(dslide-marker obj (org-element-property :end (dslide-heading obj)))
nil))
-(cl-defmethod dslide-child-previous ((obj dslide-slide-action)
- &optional reverse-in-place)
+(cl-defgeneric dslide-child-previous (obj &optional reverse-in-place)
"Return the previous direct child heading element.
Only matches child headings beginning before the marker stored in
the action, OBJ. Moves the marker backward to the beginning of
@@ -1621,7 +1640,10 @@ matches can include headings starting at the action's
marker.
Marker is moved to the beginning of the heading if no matching
heading is found. This allows actions to differentiate the begin
-state from being at the first child heading."
+state from being at the first child heading.")
+
+(cl-defmethod dslide-child-previous ((obj dslide-slide-action)
+ &optional reverse-in-place)
(if-let* ((marker (dslide-marker obj))
(heading (dslide-heading obj))
(target-level (1+ (org-element-property :level heading)))
- [nongnu] elpa/dslide cd785d24b3 160/230: Override default dbase-end implementation for image action, (continued)
- [nongnu] elpa/dslide cd785d24b3 160/230: Override default dbase-end implementation for image action, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 24253f64c0 157/230: introducing reverse-in-place, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide dbcf00d38d 161/230: allow inclusive matching in section mapping, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide df1fca1b87 167/230: animations are set up without restriction, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 659a5d1429 169/230: inline child action overhaul. much better, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 90f9ff272d 175/230: correcting some mininformation, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 0f123e3638 177/230: Rename DSLIDE_SECTION_ACTIONS -> DSLIDE_ACTIONS, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide fd7acfa477 186/230: fix item reveal progress indication (broken a bit in recent rewrite), ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide afff88a6ca 202/230: Update following buffers even in different frames, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 57eca5d498 203/230: dslide-develop initialization was not quite complete, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 8a893d858b 215/230: Proper generic methods for eldoc completions,
ELPA Syncer <=
- [nongnu] elpa/dslide 8f2a651695 212/230: cleanups-for-elpa, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 299a4de7da 220/230: replace video link with github asset, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 164392855b 227/230: Small fixups for the readme rendering, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 6de2d70e6a 086/230: Clean up any pushed callbacks, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide fb9c054977 069/230: Switch back to a non-development Org mode lol, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 1e94907060 126/230: custom action in demo, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide d365e64660 098/230: suppress animations in end method of inline child action, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 645e94a4fe 085/230: line noise, removing awkward newlines, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 2a5d14dec9 091/230: run narrow hook in other paths that will narrow, ELPA Syncer, 2024/07/07
- [nongnu] elpa/dslide 7f47a64acf 109/230: package-name macro-slide -> dslide, ELPA Syncer, 2024/07/07