From 95b3d261f4e18b28439dce5c7aaf20e8ae804652 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 25 Jun 2014 10:32:21 +0200 Subject: [PATCH] added melpa package mwe-log-commands. Signed-off-by: Andreas Gerler --- .../mwe-log-commands-autoloads.el | 36 ++++ .../mwe-log-commands-pkg.el | 1 + .../mwe-log-commands-pkg.elc | Bin 0 -> 725 bytes .../mwe-log-commands.el | 163 ++++++++++++++++++ .../mwe-log-commands.elc | Bin 0 -> 5335 bytes 5 files changed, 200 insertions(+) create mode 100644 elpa/mwe-log-commands-20100703.541/mwe-log-commands-autoloads.el create mode 100644 elpa/mwe-log-commands-20100703.541/mwe-log-commands-pkg.el create mode 100644 elpa/mwe-log-commands-20100703.541/mwe-log-commands-pkg.elc create mode 100644 elpa/mwe-log-commands-20100703.541/mwe-log-commands.el create mode 100644 elpa/mwe-log-commands-20100703.541/mwe-log-commands.elc diff --git a/elpa/mwe-log-commands-20100703.541/mwe-log-commands-autoloads.el b/elpa/mwe-log-commands-20100703.541/mwe-log-commands-autoloads.el new file mode 100644 index 00000000..b7e939bc --- /dev/null +++ b/elpa/mwe-log-commands-20100703.541/mwe-log-commands-autoloads.el @@ -0,0 +1,36 @@ +;;; mwe-log-commands-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (mwe:open-command-log-buffer mwe:log-keyboard-commands) +;;;;;; "mwe-log-commands" "mwe-log-commands.el" (21418 34615)) +;;; Generated autoloads from mwe-log-commands.el + +(autoload 'mwe:log-keyboard-commands "mwe-log-commands" "\ +Enables keyboard command logging for the current buffer. +If optional ARG is nil, logging is turned off. + +\(fn &optional ARG)" t nil) + +(autoload 'mwe:open-command-log-buffer "mwe-log-commands" "\ +Opens (and creates, if non-existant) a buffer used for logging keyboard commands. +If ARG is Non-nil, the existing command log buffer is cleared. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("mwe-log-commands-pkg.el") (21418 34615 +;;;;;; 821258)) + +;;;*** + +(provide 'mwe-log-commands-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; mwe-log-commands-autoloads.el ends here diff --git a/elpa/mwe-log-commands-20100703.541/mwe-log-commands-pkg.el b/elpa/mwe-log-commands-20100703.541/mwe-log-commands-pkg.el new file mode 100644 index 00000000..55af8424 --- /dev/null +++ b/elpa/mwe-log-commands-20100703.541/mwe-log-commands-pkg.el @@ -0,0 +1 @@ +(define-package "mwe-log-commands" "20100703.541" "log keyboard commands to buffer" (quote nil)) diff --git a/elpa/mwe-log-commands-20100703.541/mwe-log-commands-pkg.elc b/elpa/mwe-log-commands-20100703.541/mwe-log-commands-pkg.elc new file mode 100644 index 0000000000000000000000000000000000000000..e03dbdbc4101fb53b28c81d5d16d98a1cb100a84 GIT binary patch literal 725 zcmbtSO^?$s5bc%x0j^KEY$6foqg|nGkpQjsf;b{^#fc}WRmYC(gi?MzQwI>;J>uKw zy?OIy{0>i_A75`ao8)jf;L(kfHl)yAAP4e>{D;9gHOP^|yeRF0=-dcr@s(Mh7K`Q{ zb+vDH`)z}!s&`SR_e|8gY8 +;; Keywords: help +;; Initial-version: <2004-10-07 11:41:28 michaelw> +;; Time-stamp: <2004-11-06 17:08:11 michaelw> + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; This add-on can be used to demo Emacs to an audience. When +;; activated, keystrokes get logged into a designated buffer, along +;; with the command bound to them. + +;; To enable, use e.g.: +;; +;; (add-hook 'LaTeX-mode-hook (function mwe:log-keyboard-commands)) +;; +;; To see the log buffer, call M-x mwe:open-command-log-buffer. + +;;; Code: +(require 'cl) + +(defvar mwe:*log-keyboard-commands* nil + "Non-nil means enabling keyboard command logging. +This variable by default is made buffer-local.") +(make-variable-buffer-local 'mwe:*log-keyboard-commands*) + +(defvar mwe:*log-command-exceptions* + '(nil self-insert-command backward-char forward-char + delete-char delete-backward-char backward-delete-char + backward-delete-char-untabify + universal-argument universal-argument-other-key + universal-argument-minus universal-argument-more + beginning-of-line end-of-line recenter + move-end-of-line move-beginning-of-line + handle-switch-frame + newline previous-line next-line) + "A list commands which should not be logged, despite logging being enabled. +Frequently used non-interesting commands (like cursor movements) should be put here.") + +(defvar mwe:*command-log-buffer* nil + "Reference of the currenly used buffer to display logged commands.") +(defvar mwe:*command-repetitions* 0 + "Count of how often the last keyboard commands has been repeated.") +(defvar mwe:*last-keyboard-command* nil + "Last logged keyboard command.") + + +(defvar mwe:*log-command-indentation* 11 + "*Indentation of commands in command log buffer.") + +;;;###autoload +(defun mwe:log-keyboard-commands (&optional arg) + "Enables keyboard command logging for the current buffer. +If optional ARG is nil, logging is turned off." + (interactive "P") + (setq mwe:*log-keyboard-commands* (or arg t))) + +(defun mwe:buffer-log-command-p (cmd &optional buffer) + "Determines whether keyboard command CMD should be logged. +If non-nil, BUFFER specifies the buffer used to determine whether CMD should be logged. +If BUFFER is nil, the current buffer is assumed." + (let ((val (if buffer + (buffer-local-value mwe:*log-keyboard-commands* buffer) + mwe:*log-keyboard-commands*))) + (and (not (null val)) + (null (member cmd mwe:*log-command-exceptions*))))) + +(defmacro mwe:with-saved-command-environment (&rest body) + (declare (indent 0)) + `(let ((deactivate-mark nil) ; do not deactivate mark in transient + ; mark mode + ;; do not let random commands scribble over + ;; {THIS,LAST}-COMMAND + (this-command this-command) + (last-command last-command)) + ,@body)) + +;;;###autoload +(defun mwe:open-command-log-buffer (&optional arg) + "Opens (and creates, if non-existant) a buffer used for logging keyboard commands. +If ARG is Non-nil, the existing command log buffer is cleared." + (interactive "P") + (prog1 (setq mwe:*command-log-buffer* (get-buffer-create " *command-log*")) + (when arg (with-current-buffer mwe:*command-log-buffer* + (erase-buffer))) + (pop-to-buffer mwe:*command-log-buffer* nil t))) + +(defun mwe:scroll-buffer-window (buffer &optional move-fn) + "Updates `point' of windows containing BUFFER according to MOVE-FN. +If non-nil, MOVE-FN is called on every window which displays BUFFER. +If nil, MOVE-FN defaults to scrolling to the bottom, making the last line visible. + +Scrolling up can be accomplished with: +\(mwe:scroll-buffer-window buf (lambda () (goto-char (point-min)))) +" + (let ((selected (selected-window)) + (point-mover (or move-fn + (function (lambda () (goto-char (point-max))))))) + (walk-windows (function (lambda (window) + (when (eq (window-buffer window) buffer) + (select-window window) + (funcall point-mover) + (select-window selected)))) + nil t))) + +(defmacro mwe:with-command-log-buffer (&rest body) + (declare (indent 0)) + `(when (and (not (null mwe:*command-log-buffer*)) + (buffer-name mwe:*command-log-buffer*)) + (with-current-buffer mwe:*command-log-buffer* + ,@body))) + +(add-hook 'pre-command-hook + (defun mwe:log-command (&optional cmd) + "Hook into `pre-command-hook' to intercept command activation." + (mwe:with-saved-command-environment + (setq cmd (or cmd this-command)) + (when (mwe:buffer-log-command-p cmd) + (mwe:with-command-log-buffer + (let ((current (current-buffer))) + (goto-char (point-max)) + (cond ((eq cmd mwe:*last-keyboard-command*) + (incf mwe:*command-repetitions*) + (save-match-data + (when (and (> mwe:*command-repetitions* 1) + (search-backward "[" (line-beginning-position -1) t)) + (delete-region (point) (line-end-position)))) + (backward-char) ; skip over either ?\newline or ?\space before ?\[ + (insert " [") + (princ (1+ mwe:*command-repetitions*) current) + (insert " times]")) + (t ;; (message "last cmd: %s cur: %s" last-command cmd) + (setq mwe:*command-repetitions* 0) + (insert (key-description (this-command-keys))) + (when (>= (current-column) mwe:*log-command-indentation*) + (newline)) + (move-to-column mwe:*log-command-indentation* t) + (princ cmd current) + (newline) + (setq mwe:*last-keyboard-command* cmd))) + (mwe:scroll-buffer-window current))))))) + +(provide 'mwe-log-commands) +;;; mwe-log-commands.el ends here diff --git a/elpa/mwe-log-commands-20100703.541/mwe-log-commands.elc b/elpa/mwe-log-commands-20100703.541/mwe-log-commands.elc new file mode 100644 index 0000000000000000000000000000000000000000..8048f6a9da3d155de9d8b0dbb8e713ec261b7f94 GIT binary patch literal 5335 zcmcIo`)}LG5%w=d9T^w&THvmiyGti>QB$g^h@>8l(;}~P+AHoZMec3ktVU9x~B+JZ)aiAD<^yUxCsHiQf3RzHam5Lbq=3Cn$mYFwbLl3 zM2fT^nTkb>TcHbiwNN4t*gS>_0W#;<70bW&MD05)U z7xCbC9Si$7P6)thpMlqiZV}igHo!XkJq>6wn!;Tx5f{>Kl-TPM>F5K3*e7S=&@+l7 zK&pW_T`nVkNySoCaX_gmX(6>kGB}3$MHZFynmu1g{$B?|27}H^4w+2L_=*5v{yMdz z6xV{hKC`Bh%v;u5uz3BD?NjaF#Ps*;xYa92=_7+b#gC9(+l)2Abg<5I{t zgvLVVWfL)42>;>|w`2QDL>9ogUIa3hrK~s1^XBPxwSIEfOS?)-v4}!Ao<^JzBDO_- zUa?<0UfHUIb9}qIHj^l=ik%w@a9l`WD@8bM723d`MEryHIhQ_E$~vm{`VNQLzWMPI zfQ_YHfSCNH9p)fWO68>%oaJ&Asj8^er1E{KpLzy=CzB!YcldNNrPmTLmZ>jEg#_RD zZn18FP=k_6ML|?#vA8mbY7w!0&CL~a4%8p71K$~qoLch))c~PqtxI)@U!_d7{#XFh zP4={EXbBQoNSw)KCP5g%ZHjrnj10Jj#$jhX@w8sgp>J3LCpvJxt!G;(8*?L-HyoOr z)PhHksQ+~u;0kqNV87a=0o|Kt)@!KahN|mog+yot^~rIJ6Sgy*y4nk8IHofuG1QuE z7qn}fv&^*D7Ya7ej5X+d9qJOMQW4X$*MDI~Lk1qV-(g)=d5Y+$Ff>+*I70k2DeWXT zI(%dOfeWLSiu~zOcYo#%C%@R6c|&*RI?l&fPP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