core/core-spacemacs-buffer: move up macro definition

This commit is contained in:
timor 2019-03-20 19:18:01 +01:00 committed by duianto
parent 95c2488c66
commit ec5b1f2ad0
2 changed files with 20 additions and 19 deletions

View File

@ -2112,8 +2112,8 @@ Other:
- Lots of improvement with CI and documentation exporting (thanks to Eugene
Yaremenko)
- Various code and style improvements (thanks to bmag, duianto, Eivind Fonn,
Eugene Yaremenko, Fabien Dubosson, Kalle Lindqvist, Boris Buliga, yuhan0,
thanhvg, Sylvain Benner)
Eugene Yaremenko, Fabien Dubosson, Kalle Lindqvist, Boris Buliga, timor,
yuhan0, thanhvg, Sylvain Benner)
- Multiple unit test improvements (thanks to Sylvain Benner, et2010 and Codruț
Constantin Gușoi)
- Various documentation improvements (thanks Aaron Jensen, Aaron Peckham, Aaron

View File

@ -267,6 +267,24 @@ Insert it in the first line of the buffer, right justified."
(length build-rhs)))
(insert "\n"))))))
(defmacro spacemacs-buffer||notes-adapt-caption-to-width (caption
caption-length
width)
"Adapt caption string's length to the note's frame current width.
For internal use in `spacemacs-buffer//notes-render-framed-text'.
CAPTION: string to be encrusted onto the note's frame
CAPTION-LENGTH: length of the caption
WIDTH: current external width of the note's frame."
`(when (> ,caption-length (- ,width 6)) ; minimum frame width is 6
(if (> ,width 8)
(setq ,caption (concat (substring ,caption
0
(min -3 (- (- ,width 6 3)
,caption-length)))
"..."))
(setq ,caption nil
,caption-length 0))))
(defun spacemacs-buffer//notes-render-framed-text
(content &optional topcaption botcaption hpadding max-width min-width)
"Return a formatted string framed with curved lines.
@ -334,23 +352,6 @@ MIN-WIDTH is the minimal width of the frame, frame included. The frame will not
(make-string (max 0 (- width (if botcaption 6 4) botcaption-length)) ?─)
"─╯" (when botcaption "\n")))))
(defmacro spacemacs-buffer||notes-adapt-caption-to-width (caption
caption-length
width)
"Adapt caption string's length to the note's frame current width.
For internal use in `spacemacs-buffer//notes-render-framed-text'.
CAPTION: string to be encrusted onto the note's frame
CAPTION-LENGTH: length of the caption
WIDTH: current external width of the note's frame."
`(when (> ,caption-length (- ,width 6)) ; minimum frame width is 6
(if (> ,width 8)
(setq ,caption (concat (substring ,caption
0
(min -3 (- (- ,width 6 3)
,caption-length)))
"..."))
(setq ,caption nil
,caption-length 0))))
(defun spacemacs-buffer//notes-render-framed-line (line width hpadding)
"Return a formatted LINE with borders of a frame on each side.