Commit e7a7bc49 authored by David Murray's avatar David Murray

Fixed some (of my) logic errors for mode-lines. Non-existent

mode lines now handled less gracelessly.
parent fab40715
......@@ -502,8 +502,9 @@ spaces only."))
(nreverse pairs)))
(defun split-attribute-line (line)
(mapcar (lambda (pair) (split-attribute pair #\:))
(split-attribute line #\;)))
(when line
(mapcar (lambda (pair) (split-attribute pair #\:))
(split-attribute line #\;))))
(defun find-attribute-line-position (buffer)
(let ((scan (beginning-of-buffer (clone-mark (point buffer)))))
......@@ -540,21 +541,24 @@ spaces only."))
end-scan)))))))))
(defun get-attribute-line (buffer)
(multiple-value-bind (start-mark end-mark) (find-attribute-line-position buffer)
(let ((line (buffer-substring buffer
(offset start-mark)
(offset end-mark))))
(when (>= (length line) 6)
(let ((end (search "-*-" line :from-end t :start2 3)))
(when end
(string-trim '(#\Space #\Tab) (subseq line 3 end))))))))
(multiple-value-bind (start-mark end-mark)
(find-attribute-line-position buffer)
(when (and start-mark end-mark)
(let ((line (buffer-substring buffer
(offset start-mark)
(offset end-mark))))
(when (>= (length line) 6)
(let ((end (search "-*-" line :from-end t :start2 3)))
(when end
(string-trim '(#\Space #\Tab) (subseq line 3 end)))))))))
(defun replace-attribute-line (buffer new-attribute-line)
(let ((full-attribute-line (concatenate 'string
"-*- "
new-attribute-line
"-*-")))
(multiple-value-bind (start-mark end-mark) (find-attribute-line-position buffer)
(multiple-value-bind (start-mark end-mark)
(find-attribute-line-position buffer)
(cond ((not (null end-mark))
;; We have an existing attribute line.
(delete-region start-mark end-mark)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment