sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

inte_emacs.sh (2525B)


      1 #!/usr/bin/env bash
      2 
      3 YELLOW='\033[1;33m'
      4 GREEN='\033[0;32m'
      5 NC='\033[0m'
      6 filename="./build/mapping.txt"
      7 count=0
      8 
      9 name=""
     10 
     11 echo "(require 'font-lock+)
     12 
     13 (defconst icons-in-terminal-alist
     14   '("
     15 
     16 while read -r line
     17 do
     18     if [ "${line:0:1}" = "#" ]
     19     then
     20 	name_num=(${line//:/ })
     21 	name=${name_num[0]:1}
     22     else
     23 	str=""
     24 	IFS=';' read -ra array_glyph <<< "$line"
     25 	for glyph in "${array_glyph[@]}"; do
     26 	    info=(${glyph//:/ })
     27 	    echo "    ( ${info[0]} . \"\x${info[1]}\" )"
     28 	done
     29     fi
     30 
     31 done < "$filename"
     32 
     33 echo "    ))
     34 
     35 
     36 (defun icons-in-terminal (name &rest attributes)
     37   \"Return icon from NAME with optional ATTRIBUTES.
     38 Attributes are face attributes or the display specification raise with :raise
     39 the keyword :face can be use as an alias for :inherit
     40 
     41 Examples of use: (insert (icons-in-terminal 'oct_flame))
     42                  (insert (icons-in-terminal 'oct_flame :foreground \\\"red\\\" :height 1.4))
     43                  (insert (icons-in-terminal 'oct_flame :face any-face :underline t))
     44                  (insert (icons-in-terminal 'oct_flame :inherit any-face :underline t)) ;; Similar to the line above
     45                  (insert (icons-in-terminal 'oct_flame :raise 0.2)).\"
     46   (let* ((list-attributes (list :family \"icons-in-terminal\"))
     47 	 (face (or (plist-get attributes :inherit) (plist-get attributes :face)))
     48 	 (foreground (plist-get attributes :foreground))
     49 	 (distant-foreground (plist-get attributes :distant-foreground))
     50 	 (background (plist-get attributes :background))
     51 	 (width (plist-get attributes :width))
     52 	 (height (plist-get attributes :height))
     53 	 (underline (plist-get attributes :underline))
     54 	 (overline (plist-get attributes :overline))
     55 	 (box (plist-get attributes :box))
     56 	 (raise (or (plist-get attributes :raise) -0.05)))
     57     (when face (push \`(:inherit ,face) list-attributes))
     58     (when foreground (push \`(:foreground ,foreground) list-attributes))
     59     (when distant-foreground (push \`(:distant-foreground ,distant-foreground) list-attributes))
     60     (when background (push \`(:background ,background) list-attributes))
     61     (when width (push \`(:width ,width) list-attributes))
     62     (when height (push \`(:height ,height) list-attributes))
     63     (when underline (push \`(:underline ,underline) list-attributes))
     64     (when overline (push \`(:overline ,overline) list-attributes))
     65     (when box (push \`(:box ,box) list-attributes))
     66     (propertize (alist-get name icons-in-terminal-alist)
     67 		'face list-attributes
     68 		'display \`(raise ,raise)
     69 		'font-lock-ignore t)))
     70 
     71 
     72 (provide 'icons-in-terminal)"