Changes between Version 1 and Version 2 of EmacsWikiEditScript


Ignore:
Timestamp:
Feb 27, 2009, 7:46:56 AM (6 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • EmacsWikiEditScript

    v1 v2  
    2020 * Completion for macro name and wiki page name in buffer.
    2121
     22
     23= Patch to add save-buffers-kill-emacs support to trac-wiki =
     24
     25The following patch prevents you from losing work when hitting C-x C-c,
     26by telling trac-wiki mode to prompt you when emacs is killed. Just paste it
     27into your trac-wiki.el at the end, right before the line with {{{ (provide 'trac-wiki) }}}.
     28
     29{{{
     30(defun trac-wiki-modified-buffers ()
     31  "Return a list of all modified trac-wiki buffers."
     32  (let (trac-wiki-modified-buffer-list)
     33    (dolist (buf (buffer-list) trac-wiki-modified-buffer-list)
     34      (if (and (buffer-modified-p buf)
     35               (equal "TracWiki" (cdr (assq 'mode-name (buffer-local-variables buf)))))
     36          (setq trac-wiki-modified-buffer-list
     37                (cons
     38                 buf
     39                 trac-wiki-modified-buffer-list))))))
     40
     41(defun trac-wiki-commit-all-modified-buffers ()
     42  "Iterate over modified trac-wiki buffers and prompt to commit each one"
     43  (interactive)
     44  (dolist (buf (trac-wiki-modified-buffers))
     45    (switch-to-buffer buf)
     46    (if (yes-or-no-p (format "Commit changes to buffer %s ? " (buffer-name buf)))
     47        (call-interactively 'trac-wiki-commit))
     48    ))
     49
     50
     51;;Make save-buffers-kill-emacs run this function
     52(add-hook 'kill-emacs-query-functions (lambda () (trac-wiki-commit-all-modified-buffers) t))
     53}}}