Skip to content

Commit

Permalink
liny: new role -- relay
Browse files Browse the repository at this point in the history
  • Loading branch information
ran9er committed Mar 10, 2013
1 parent a562d98 commit b102bdf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions liny/extensions/expand-template.el
Expand Up @@ -3,6 +3,12 @@
'("\\(%\\){" . liny-expand-templ)
liny-syntax-delimiter))

(plist-put liny-roles
'relay
(cons
'(role . relay)
(cdr (plist-get liny-roles 'primary))))

(defun liny-expand-templ-ovl (str pos ovl)
"liny-expand-templ-ovl is writen by ran9er"
)
Expand Down
15 changes: 8 additions & 7 deletions liny/liny.el
Expand Up @@ -278,7 +278,7 @@
(or (plist-get properties (car x))
(cdr x))))
rl)
(if (eq role 'primary)
(if (memq role '(primary relay))
(overlay-put
ov
'tail
Expand Down Expand Up @@ -321,7 +321,7 @@
(liny-get-prev (overlay-get ov 'previous) id))))

(defun liny-get-primary(ov)
(if (eq 'primary (overlay-get ov 'role))
(if (memq (overlay-get ov 'role) '(primary relay))
ov
(overlay-get ov 'primary)))

Expand Down Expand Up @@ -493,7 +493,8 @@
(overlay-put o 'offset (- (overlay-end o)(point)))
(overlay-put o 'face 'liny-editable-face)
(goto-char (- (overlay-end oo)(overlay-get oo 'offset)))
(overlay-put oo 'face 'liny-active-face)))))
(overlay-put oo 'face 'liny-active-face))
(message "End of world."))))

(defun liny-previous-field ()
(interactive)
Expand Down Expand Up @@ -672,7 +673,7 @@
(and
(prog1
(re-search-forward delimiter nil t)
(while (or (and (<= i elt)(null (match-end i)))
(while (or (and (null (match-end i))(<= i elt))
(progn (if (match-end i)
(setq
key (cdr (nth (1- i) (liny-token-delimiter)))
Expand Down Expand Up @@ -811,7 +812,7 @@
;; (if prev (overlay-put prev 'next o))
(overlay-put o 'first first)
(setq end o))
((eq role 'primary)
((memq role '(primary relay))
(overlay-put o 'id ids)
(overlay-put o 'previous prev)
(if prev (overlay-put prev 'next o))
Expand All @@ -823,7 +824,7 @@
args)
(list o prev first last end)))

(defun liny-insert (snippet-name &optional snippet-p)
(defun liny-insert (snippet-name &optional snippet-p relay)
(let* ((snippet (if snippet-p snippet-name
(liny-get-snippet snippet-name)))
(top (eq (current-indentation) 0))
Expand All @@ -840,7 +841,7 @@
(ids (list snippet-name id))
role o)
(cond
((eq id 0)(setq role 'end))
((eq id 0)(setq role (if relay 'relay 'end)))
((liny-get-prev prev id)
(setq role 'mirror))
(id (setq role 'primary))
Expand Down

0 comments on commit b102bdf

Please sign in to comment.