User:Riviera/PMoMM/6-2

From XPUB & Lens-Based wiki

what is it

pmode: Emacs lisp code

why make it

to facilitate with writing proposals

workflow

  • generate a pmomm for pmode
  • use Emacs’ Scratch buffer to write and evaluate code
  • browse source code for example ways to achieve what you want to
  • save it to a file and load it when needed

timetable

https://project.rivierataylor.info

previous practice

rapid prototypes

  • make pmode open for .pmomm files
  • Have pmode insert a markdown metadata block into new files, like a template.
  • create a function which iterates over a list of pmomm headings and inserts them into the buffer
  • Bring it all together to streamline the process of writing a PMoMM in Emacs

relation to wider context

choices made

;; https://emacs.stackexchange.com/questions/16792/easiest-way-to-check-if-current-line-is-empty-ignoring-whitespace
(defun current-line-empty-p ()
  (save-excursion
    (beginning-of-line)
    (looking-at-p "[[:blank:]]*$")))

(setq pmomm-headings '("What is it?" "Why make it?" "Workflow" "Timetable"
               "Previous practice"  "Rapid prototypes"
               "Relation to wider context" "Choices made"))

(defun insert-pmomm-headings ()
  "Insert PMOMM headers into new files"
  (let (value)
    (dolist (elt pmomm-headings value)
        (setq value (insert "# " elt))
        (newline 2))))
    
;;;###autoload
(define-derived-mode
  pmode
  markdown-mode
  "PMOMM"
  "Major mode for a project that may or may not be made."
  (turn-on-font-lock)
  (when (current-line-empty-p)
    (markdown-insert-metadata-block)
    (newline 2)
    (insert-pmomm-headings)))

;;;###autoload
(add-to-list 'auto-mode-alist '("\\.pmomm\\'" . pmode))