Function: strokes-decode-buffer

strokes-decode-buffer is an autoloaded, interactive and byte-compiled function defined in strokes.el.gz.

Signature

(strokes-decode-buffer &optional BUFFER FORCE)

Documentation

Decode stroke strings in BUFFER and display their corresponding glyphs.

Optional BUFFER defaults to the current buffer. Optional FORCE non-nil will ignore the buffer's read-only status.

Probably introduced at or before Emacs version 21.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/strokes.el.gz
;;;###autoload
(defun strokes-decode-buffer (&optional buffer force)
  "Decode stroke strings in BUFFER and display their corresponding glyphs.
Optional BUFFER defaults to the current buffer.
Optional FORCE non-nil will ignore the buffer's read-only status."
  (interactive)
  ;;  (interactive "*bStrokify buffer: ")
  (with-current-buffer (setq buffer (get-buffer (or buffer (current-buffer))))
    (when (or (not buffer-read-only)
	      force
	      inhibit-read-only
	      (y-or-n-p
	       (format "Buffer %s is read-only.  Strokify anyway? " buffer)))
      (let ((inhibit-read-only t))
	(message "Strokifying %s..." buffer)
	(goto-char (point-min))
	(let (string image)
	  ;; The comment below is what I'd have to do if I wanted to
	  ;; deal with random newlines in the midst of the compressed
	  ;; strings.  If I do this, I'll also have to change
          ;; `strokes-xpm-to-compressed-string' to deal with the newline,
	  ;; and possibly other whitespace stuff.  YUCK!
	  ;;      (while (re-search-forward "\\+/\\(\\w\\|\\)+/" nil t nil (get-buffer buffer))
	  (while (with-current-buffer buffer
		   (when (re-search-forward "\\+/\\(\\w+\\)/" nil t nil)
		     (setq string (match-string 1))
		     (goto-char (match-end 0))
		     (replace-match " ")
		     t))
	    (strokes-xpm-for-compressed-string string " *strokes-xpm*")
	    (setq image (create-image (with-current-buffer " *strokes-xpm*"
					(buffer-string))
				      'xpm t))
	    (insert-image image
			  (propertize " "
				      'type 'stroke-glyph
				      'stroke-glyph image
				      'data string))))
	(message "Strokifying %s...done" buffer)))))