fr3q.el
, Joe Corneli, Re: keycounter?, Mon, 17 Feb 2003 | Is anyone aware of a key-stroke counting package for XEmacs? | | In additition to tabulating the use of each key during a given session, I | am also interested in simple statistics like frequency of pairs (e.g. how | frequently do I type H-a followed by ordfeminine?). ` ;;; fr3q.el -- key frequencies for emacs fr34ks ;; Copyright (C) 2005 Joe Corneli [EMAIL PROTECTED] ;; Time-stamp: jac -- Sat May 14 21:51:30 CDT 2005 ;; This file is not part of GNU Emacs, but it is distributed under ;; the same terms as GNU Emacs. ;; GNU Emacs 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. ;; GNU Emacs 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: ;; Initial implementation of a fairly sophisticated keycounter for ;; Emacs. A more advanced version (as I envision it) would count keys ;; in each buffer, and present buffer-specific totals as well as grand ;; totals. A still-more sophisticated version would do timing to ;; figure out how much time was being spent in each buffer, and give ;; character rate as well as frequency. ;;; Code: (require 'cl) (defvar fr3q-level 2 Controls how many levels `fr3q-mode' considers. Should be a value of 1, 2 or 3. If equal to 1, only key frequencies are considered. If equal to 2, digraphs are considered too. If equal to 3, trigraphs are considered too.) (defvar fr3q-total 0) (defvar fr3q-printing 0) (defvar fr3q-1graphs (make-hash-table)) (defvar fr3q-2graphs (make-hash-table :test 'equal)) (defvar fr3q-3graphs (make-hash-table :test 'equal)) (defvar fr3q-prev 'foo) (defvar fr3q-prev2 'bar) (defun fr3q-initialize () (interactive) (setq fr3q-total 0 fr3q-printing 0) (clrhash fr3q-1graphs) (clrhash fr3q-2graphs) (clrhash fr3q-3graphs)) (define-minor-mode fr3q-mode Toggle fr3q mode. With no argument, this command toggles the mode. Non-null prefix argument turns on the mode. Null prefix argument turns off the mode. When fr3q mode is enabled, keypresses and such will be counted. :init-value nil :lighter nil :global t :keymap '() (when fr3q-mode ;; (i.e. we just turned it on) (add-hook 'pre-command-hook (lambda () (setq fr3q-mode-active (symbol-value fr3q-mode (add-hook 'post-command-hook (lambda () (when fr3q-mode-active (fr3q-process-incoming-letter last-input-char))) nil t))) (defvar fr3q-mode-active nil Whether or not `fr3q-mode' is active in the current buffer.) (defun fr3q-process-incoming-letter (input) (puthash input (1+ (gethash input fr3q-1graphs 0)) fr3q-1graphs) (when (= fr3q-level 2) (puthash (cons input fr3q-prev) (1+ (gethash (cons input fr3q-prev) fr3q-2graphs 0)) fr3q-2graphs)) (when (= fr3q-level 3) (puthash (list input fr3q-prev fr3q-prev2) (1+ (gethash (list input fr3q-prev fr3q-prev2) fr3q-3graphs 0)) fr3q-3graphs)) (when (fr3q-printing-p input) (setq fr3q-printing (1+ fr3q-total))) (setq fr3q-total (1+ fr3q-total) fr3q-prev2 fr3q-prev fr3q-prev input)) (defun fr3q-printing-p (ch) (and (integerp ch) ( ch 524287) (or ( ch 128) ( ch 255 (defun fr3q-print () (interactive) (set-buffer (get-buffer-create *Emacs Fr3qs*)) (erase-buffer) (insert Total keystrokes: (format %s fr3q-total) \n\n) (insert Total printing: (format %s fr3q-printing) \n\n) (insert Percent printing: (if (eq fr3q-total 0) 0 (format %s (/ fr3q-printing (float fr3q-total \n\n) (insert Keys:\n) (let (1graphs) (maphash (lambda (key val) (setq 1graphs (cons (cons key val) 1graphs))) fr3q-1graphs) (sort 1graphs (lambda (a b) ( (cdr a) (cdr b (mapcar (lambda (elt) (insert (replace-regexp-in-string - - (replace-regexp-in-string ^?? (format %s %s\n (if (integerp (car
index-cards.el
;;; index-cards.el -- write ersatz index cards with emacs ;; Copyright (C) 2006 Joseph Corneli [EMAIL PROTECTED] ;; Notice: Copyright transfered to public domain wherever applicable. ;; Time-stamp: 2006-11-05 20:28:55 jcorneli ;;; Commentary: ;; (Version 1.) Quick hacks using a minibuffer-only frame which make ;; it look and feel sort of like you're writing large index cards on ;; the computer. Edit and save a new numbered index card each time! ;;; Code: (define-derived-mode index-card-mode text-mode IC Type up an \index card\. (set-fill-column 84) (auto-fill-mode) (auto-save-mode 0) ;; I set things up so that the window did not scroll down to follow ;; point, but merely let the point move across the open space. (set (make-local-variable 'scroll-margin) 0) (message nil)) (defvar index-card-directory ~/pma/ Home for index cards and related info.) ;; You can't switch buffers in the minibuffer frame, so you must chunk in ;; the text from elsewhere. (defun make-card () (interactive) ;; I don't know how to `read' information directly from files (let ((card-name (with-temp-buffer (insert-file-contents (concat index-card-directory card-counter)) (concat card- (int-to-string (read (get-buffer (current-buffer .txt (find-file-noselect (concat index-card-directory card-name)) (cond ((condition-case nil (not (and (set-buffer (get-buffer *Minibuf-0*)) (select-frame-by-name card))) (error nil))) ((make-frame '((name . card) (minibuffer . only) (set-buffer (get-buffer *Minibuf-0*)) (delete-region (point-min) (point-max)) (insert-buffer-substring (get-buffer card-name)) (kill-buffer card-name) (goto-char (point-min)) (index-card-mode))) ;; Right now there no method for temporarily saving the card except to ;; let it sit there: you must finish it directly and then go on to the ;; next one. (Well, as you see in the above function, if you manually ;; reduce the number kept in the card-counter file, you can edit ;; earlier cards. This isn't a feature I use daily.) (defun finish-card () (interactive) (let ((content (buffer-string)) (number (with-temp-buffer (find-file (concat index-card-directory card-counter)) (let ((num (read (get-buffer (current-buffer) (delete-region (point-min) (1- (point-max))) (insert (int-to-string (1+ num))) (save-buffer) (kill-buffer nil) num (with-temp-file (concat index-card-directory card- (int-to-string number) .txt) (insert content)) (save-excursion (set-buffer (get-buffer *Minibuf-0*)) (delete-region (point-min) (point-max))) (message (concat Card (int-to-string number) saved at (current-time-string) .))) (raise-frame (previous-frame))) (define-key index-card-mode-map (kbd C-x z) 'finish-card) ;; It is irritating to have the position of the screen readjust due to ;; navigation and other editing commands. This turns off some of the ;; annoyance. (defun my-beginning-of-buffer () (interactive) (goto-char (point-min))) (defun my-end-of-buffer () (interactive) (goto-char (point-max))) (define-key index-card-mode-map [(meta )] 'my-beginning-of-buffer) (define-key index-card-mode-map [(meta )] 'my-end-of-buffer) ;;; index-cards.el ends here ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources
index-cards.el v3
;;; index-cards.el -- write ersatz index cards with emacs ;; Copyright (C) 2007 Joseph Corneli [EMAIL PROTECTED] ;; Notice: Copyright transfered to public domain wherever applicable. ;; Time-stamp: 2007-03-13 02:09:08 jcorneli ;;; Commentary: ;; (Version 1.) Quick hacks using a minibuffer-only frame which make ;; it look and feel sort of like you're writing large index cards on ;; the computer. Edit and save a new numbered index card each time! ;; (Version 2.) Bugfix. ;; (Version 3.) Bugfix. ;;; Code: (define-derived-mode index-card-mode text-mode IC Type up an \index card\. (set-fill-column 84) (auto-fill-mode) (auto-save-mode 0) ;; I set things up so that the window did not scroll down to follow ;; point, but merely let the point move across the open space. (set (make-local-variable 'scroll-margin) 0) (message nil)) (defvar index-card-directory ~/pma/ Home for index cards and related info.) ;; You can't switch buffers in the minibuffer frame, so you must chunk in ;; the text from elsewhere. (defun make-card () (interactive) ;; I don't know how to `read' information directly from files (let ((card-name (with-temp-buffer (insert-file-contents (concat index-card-directory card-counter)) (concat card- (int-to-string (read (get-buffer (current-buffer .txt (find-file-noselect (concat index-card-directory card-name)) (cond ((condition-case nil (not (and (select-frame-by-name card) (set-buffer (get-buffer *Minibuf-0* (error nil))) ((make-frame '((name . card) (minibuffer . only) (delete-region (point-min) (point-max)) (insert-buffer-substring (get-buffer card-name)) (kill-buffer card-name) (goto-char (point-min)) (index-card-mode))) ;; Right now there no method for temporarily saving the card except to ;; let it sit there: you must finish it directly and then go on to the ;; next one. (Well, as you see in the above function, if you manually ;; reduce the number kept in the card-counter file, you can edit ;; earlier cards. This isn't a feature I use daily.) (defun finish-card () (interactive) (let ((content (buffer-string)) (number (progn (select-frame (previous-frame)) (current-buffer) (let ((retval (with-temp-buffer (find-file (concat index-card-directory card-counter)) (let ((num (read (get-buffer (current-buffer) (delete-region (point-min) (1- (point-max))) (insert (int-to-string (1+ num))) (save-buffer) (kill-buffer nil) num (select-frame-by-name card) retval (with-temp-file (concat index-card-directory card- (int-to-string number) .txt) (insert content)) (delete-region (point-min) (point-max)) (message (concat Card (int-to-string number) saved at (current-time-string) .))) (raise-frame (previous-frame))) (define-key index-card-mode-map (kbd C-x z) 'finish-card) ;; It is irritating to have the position of the screen readjust due to ;; navigation and other editing commands. This turns off some of the ;; annoyance. (defun my-beginning-of-buffer () (interactive) (goto-char (point-min))) (defun my-end-of-buffer () (interactive) (goto-char (point-max))) (define-key index-card-mode-map [(meta )] 'my-beginning-of-buffer) (define-key index-card-mode-map [(meta )] 'my-end-of-buffer) ;;; index-cards.el ends here ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources
Re: tarot.el update
Some time ago I posted a version of tarot.el that didn't do tarot spreads. This version does one type of (very simple) tarot spread. Attached, and appended for convenience. ;;; tarot.el -- draw a random tarot card ;; Copyright (C) 2007, 2011 Joseph Corneli holtzerman...@gmail.com ;; Notice: Copyright transfered to public domain wherever applicable. ;; Time-stamp: 2011-02-07 01:03:35 joe ;;; Commentary: ;; Latest version now includes a simple four-card spread ;; and alt-text from Alliete and Crowley (where ;; applicable). ;;; Code: (defvar tarot-deck [[Fool La Follie ou l'Alchemiste] [Magician Le Magicien ou le Bateleur] [High Priestess Repos] [EmpressLes Astres] [EmperorLes Ouiseaux et les Poissons] [Hierophant Le Grand pretre] [Lovers Le Chaos] [ChariotLe Despote africain] [Strength La Force] [Hermit Le Capucin] [Wheel of Fortune La Roue de Fortune] [JusticeLa Justice] [Hanged Man La Prudence] [Death La Mort] [Temperance La Temperance] [Devil Le Diable] [Tower Le Temple Foudroye] [Star La Ciel] [Moon Les Plantes] [SunLa Lumiere] [Judgement Le Jugement Dernier] [World L'homme et les Quadrupedes] [Ace of Wands The Root of the Powers of Fire] [2 of Wands Dominion] [3 of Wands Virtue] [4 of Wands Completion] [5 of Wands Strife] [6 of Wands Victory] [7 of Wands Valour] [8 of Wands Swiftness] [9 of Wands Strength] [10 of WandsOppression] [Page of Wands] [Knight of Wands] [Queen of Wands] [King of Wands] [Ace of CupsThe Root of the Powers of Water] [2 of Cups Love] [3 of Cups Abundance] [4 of Cups Luxury] [5 of Cups Disappointment] [6 of Cups Pleasure] [7 of Cups Debauch] [8 of Cups Indolence] [9 of Cups Happiness] [10 of Cups Satiety] [Page of Cups] [Knight of Cups] [Queen of Cups] [King of Cups] [Ace of Swords The Root of the Powers of Air] [2 of SwordsPeace] [3 of SwordsSorrow] [4 of SwordsTruce] [5 of SwordsDefeat] [6 of SwordsScience] [7 of SwordsFutility] [8 of SwordsInterference] [9 of SwordsCruelty] [10 of Swords Ruin] [Page of Swords] [Knight of Swords] [Queen of Swords] [King of Swords] [Ace of Pentacles The Root of the Powers of Earth] [2 of PentaclesChange] [3 of PentaclesWork] [4 of PentaclesPower] [5 of PentaclesWorry] [6 of PentaclesSuccess] [7 of PentaclesFailure] [8 of PentaclesPrudence] [9 of PentaclesGain] [10 of Pentacles Wealth] [Page of Pentacles] [Knight of Pentacles] [Queen of Pentacles] [King of Pentacles]]) (defun random-aref (array) (let ((index (random (length array (values (aref array index) index))) (defun read-tarot-card (card) (let ((len (length card))) (if (= len 2) (concat (aref card 0) ( (aref card 1) )) (aref card 0 (defun tarot-card () (multiple-value-bind (card index) (random-aref tarot-deck) (read-tarot-card card))) (defun tarot-draw-card () (interactive) (message %s (tarot-card))) (defun tarot-cards (n) (let ((pack tarot-deck) stack) (dotimes (i n)
regressive image dictionary fontification in emacs
I have ported some support for highlighting words found in the Regressive Imagery Dictionary (http://www.kovcomp.co.uk/wordstat/RID.html) into Emacs, code is available here for use or improvement: https://github.com/holtzermann17/rid-mode.el There is no license because the original dictionary doesn't come with one; hack it at your own risk, I guess. This software only supplies font-lock support -- it doesn't do analytics; for the moment, if you want those, you might use https://github.com/jefftriplett/rid.py -- or try the software-as-service site at 750words.com, which uses RID and some other similar light-weight text analytic tools. ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org https://lists.gnu.org/mailman/listinfo/gnu-emacs-sources
Re: regressive image dictionary fontification in emacs
On Wed, Sep 21, 2011 at 11:46 AM, Richard Stallman r...@gnu.org wrote: https://github.com/holtzermann17/rid-mode.el There is no license because the original dictionary doesn't come with one; hack it at your own risk, I guess. If that code does not carry a free license, it is nonfree software. I realise that: for the moment I consider this to be pirate software because it contains a potentially non-free core. I know you don't generally like pirate software. But I don't feel entirely confident that I can put a license on it since it re-uses wordlists that were generated by someone else. If word lists can be considered to be public domain, then I would be happy to license the creative work I did. The original author of the lists is deceased so it would be hard to ask for permission. I could also write a script that would download the (potentially) non-free source of the dictionary, then transform it into the source code, and release my work as free software. I think people have done this sort of thing before. It is unfortunate that the dictionary does not have a free license. (What is this dictionary? I never heard of it before.) The dictionary is actually just several lists of words, which are meant to fall into certain psychological categories, e.g. there is a list of emotion words, there is a list of symbols reminiscent of the Icarus myth, etc. or try the software-as-service site at Please don't promote SaaS sites in this list. See http://www.gnu.org/philosophy/who-does-that-server-really-serve.html. I didn't mean to promote it, rather I think it would be nice if we had an Emacs-based clone. ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org https://lists.gnu.org/mailman/listinfo/gnu-emacs-sources
Re: regressive image dictionary fontification in emacs
Surely you can make such lists yourself that would serve your purpose. You can get a public domain old version of Roget's Thesaurus from Project Gutenberg, select what you want, then add such words as might occur to you. It won't be exactly the same, but it could do just as well. Good idea. Maybe we could call it the progressive imagery dictionary. ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org https://lists.gnu.org/mailman/listinfo/gnu-emacs-sources
mal-mode.el (Re: regressive image dictionary fontification in emacs)
I made a variant of my earlier Regressive Image Dictionary mode using word lists I made myself, so I can release this file under the GPL. https://raw.github.com/holtzermann17/rid-mode.el/master/mal-mode.el This package fontifies words drawn from the Young Schema Questionnaire and associated writings of Jeffrey Young, who explains that the 18 Early Maladaptive Schemas are self-defeating, core themes or patterns that we keep repeating throughout our lives. Accordingly, this file can give visual feedback on how often the keywords associated with maladaptive patterns appear in a given text. Furthermore, the file itself provides a template that can be modified to do fontification using your own lists of words. (I don't claim the lists here are perfect!) On Thu, Sep 22, 2011 at 10:44 PM, Richard Stallman r...@gnu.org wrote: I realise that: for the moment I consider this to be pirate software because it contains a potentially non-free core. I know you don't generally like pirate software. I disapprove generally of attacking ships on the high seas, but it has nothing to do with software as far as I know. If you're talking about an unauthorized copy of a proprietary program, please don't call that with a slur such as pirate. The bad thing about that is that it's proprietary. (An authorized copy would be worse.) I could also write a script that would download the (potentially) non-free source of the dictionary, then transform it into the source code, and release my work as free software. It is doable, but if in practice the USE of this free program would depend on a specific nonfree wordlist, then it would be trapped (the way many Java programs formerly used to be trapped before we had a free Java platform). Please don't announce trapped programs here. The dictionary is actually just several lists of words, which are meant to fall into certain psychological categories, e.g. there is a list of emotion words, there is a list of symbols reminiscent of the Icarus myth, etc. Surely you can make such lists yourself that would serve your purpose. You can get a public domain old version of Roget's Thesaurus from Project Gutenberg, select what you want, then add such words as might occur to you. It won't be exactly the same, but it could do just as well. -- Dr Richard Stallman President, Free Software Foundation 51 Franklin St Boston MA 02110 USA www.fsf.org www.gnu.org Skype: No way! That's nonfree (freedom-denying) software. Use free telephony http://directory.fsf.org/category/tel/ ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org https://lists.gnu.org/mailman/listinfo/gnu-emacs-sources
`diary-make-entry': insert new entries in order rather than at end
(defun diary-date-to-time (string) (apply #'encode-time (map 'list (lambda (x) (if (null x) 0 x)) (parse-time-string string (defun diary-make-entry (string optional nonmarking file) Insert a diary entry STRING which may be NONMARKING in FILE. If omitted, NONMARKING defaults to nil and FILE defaults to `diary-file'. (let ((pop-up-frames (or pop-up-frames (window-dedicated-p (selected-window) (find-file-other-window (or file diary-file))) (when (eq major-mode (default-value 'major-mode)) (diary-mode)) (widen) (diary-unhide-everything) (let ((new-date (diary-date-to-time string)) time insert-at-end) (goto-char (point-min)) ;; Need some special care if we're inserting into the last line; ;; the first relevant issue is to find out when that is the case. (while (and (if (re-search-forward ^[^# ].* nil t) t (setq insert-at-end t) nil) (time-less-p (diary-date-to-time (match-string 0)) new-date))) (unless insert-at-end (goto-char (line-beginning-position)) (backward-char 1))) (insert (if (bolp) \n) (if nonmarking diary-nonmarking-symbol ) string )) ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org https://lists.gnu.org/mailman/listinfo/gnu-emacs-sources