forked from polymode/polymode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix span dispatch inconsistencies and obsolete pm-polymode-multi-auto
- Loading branch information
Showing
6 changed files
with
119 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
(defclass pm-polymode-multi-auto (pm-polymode-multi) | ||
((auto-innermode | ||
:initarg :auto-innermode | ||
:type symbol | ||
:custom symbol | ||
:documentation | ||
"Name of pm-hbtchunkmode-auto object (a symbol). At run time | ||
this object is cloned and placed in -innermodes of the | ||
pm-config object.")) | ||
|
||
"Configuration for a polymode that allows multiple innermodes | ||
that are not known in advance. Examples are org-mode and markdown.") | ||
|
||
|
||
(defmethod pm-get-span ((config pm-polymode-multi-auto) &optional pos) | ||
(message "`pm-polymode-multi-auto' object is obsolete. Please use `pm-polymode' directly." ) | ||
(let ((span-other (call-next-method)) | ||
(proto (symbol-value (oref config :auto-innermode)))) | ||
(if (oref proto :head-reg) | ||
(let ((span (pm--span-at-point (oref proto :head-reg) | ||
(oref proto :tail-reg) | ||
pos))) | ||
(if (and span-other | ||
(or (> (nth 1 span-other) (nth 1 span)) | ||
(< (nth 2 span-other) (nth 2 span)))) | ||
;; treat intersections with the host mode | ||
(if (car span-other) | ||
span-other ;not host | ||
;; here, car span should better be nil; no explicit check | ||
(setcar (cdr span-other) (max (nth 1 span-other) (nth 1 span))) | ||
(setcar (cddr span-other) (min (nth 2 span-other) (nth 2 span))) | ||
span-other) | ||
(append span (list (pm--get-multi-chunk config span))))) | ||
span-other))) | ||
|
||
|
||
(provide 'polymode-obsolete) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters