From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Seweryn Kokot Newsgroups: gmane.emacs.devel Subject: Re: TextLint: Check your scientific writing from Emacs Date: Fri, 9 Sep 2011 11:22:10 +0000 (UTC) Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1315567363 2955 80.91.229.12 (9 Sep 2011 11:22:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Sep 2011 11:22:43 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 09 13:22:37 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R1zAI-0002aG-Sj for ged-emacs-devel@m.gmane.org; Fri, 09 Sep 2011 13:22:35 +0200 Original-Received: from localhost ([::1]:35044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1zAI-0004ar-44 for ged-emacs-devel@m.gmane.org; Fri, 09 Sep 2011 07:22:34 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:37152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1zAF-0004aH-0t for emacs-devel@gnu.org; Fri, 09 Sep 2011 07:22:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1zAC-00073I-PO for emacs-devel@gnu.org; Fri, 09 Sep 2011 07:22:30 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:52341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1zAC-000731-Gf for emacs-devel@gnu.org; Fri, 09 Sep 2011 07:22:28 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R1zA9-0002XG-IM for emacs-devel@gnu.org; Fri, 09 Sep 2011 13:22:25 +0200 Original-Received: from 139.191.131.39 ([139.191.131.39]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 09 Sep 2011 13:22:25 +0200 Original-Received: from sewkokot by 139.191.131.39 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 09 Sep 2011 13:22:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 114 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 139.191.131.39 (Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:143825 Archived-At: Damien Cassou gmail.com> writes: > > TextLint is a tool to check your scientific writing for common style > errors from Emacs: > > http://www.youtube.com/watch?v=CsG2DKgHanE > > For additional information, please see > http://www.emacswiki.org/emacs-en/TextLint > > Feedback is highly appreciated > I created a proof of concept for a subset of features found in TextLint using just emacs lisp. This way you don't need any external tools. It is based on searching predefined words or group of words in the current buffer with M-x my- check-my-writing. This command gives another buffer *WritingCheck* where you can navigate through the issues using RET, TAB and SPC. You need to populate my-writing-words-check variable to your wishes. Regards, Seweryn ----- in .emacs ----- (require 'my-writing-check-mode nil t) (define-key my-writing-check-mode-map (kbd "RET") 'my-writing-check-goto-line) (define-key my-writing-check-mode-map (kbd "TAB") 'my-writing-check-goto-line) (define-key my-writing-check-mode-map (kbd "SPC") 'my-writing-check-see- context) (setq my-writing-words-check '( ;; add here more entries ("words to look for" "explanation what is wrong") ("in the absence of" "without?") ("exhibit" "show") )) -------- my-writing-check-mode.el -------- (define-derived-mode my-writing-check-mode fundamental-mode "Writing Check" "My writing grammar and style check mode") (defvar my-writing-words-check nil "List of words, phrases to search and explanation of what is wrong.") (defvar my-writing-check-orig-buffer nil "Original buffer with text to check") (defvar my-writing-check-check-buffer "*WritingCheck*" "Writing check buffer name") (defun my-check-my-writing () "Check my written text and suggest improvements or corrections" (interactive) (save-excursion (let (line-num) (setq my-writing-check-orig-buffer (window-buffer)) (set-buffer (get-buffer-create my-writing-check-check-buffer)) (erase-buffer) (set-buffer my-writing-check-orig-buffer) (goto-char (point-min)) (loop for (my-words comment) in my-writing-words-check do (save-excursion (while (word-search-forward my-words nil t) ;; (message "line:%s, used: \"%s\", better: \"%s\"" ;; (message "line:%s, \"%s\" --> \"%s\"" (setq line-num (line-number-at-pos)) (save-excursion (set-buffer my-writing-check-check-buffer) (insert (format "%5s: \"%s\" --> \"%s\"\n" line-num my- words comment))) (set-buffer (get-buffer my-writing-check-orig-buffer)) ))) (pop-to-buffer my-writing-check-check-buffer) (goto-char (point-min)) (my-writing-check-mode) ))) (defalias 'my-writing-check 'my-check-my-writing) (defun my-writing-check-goto-line () (interactive) (save-excursion (let (lbp linnum string1) (setq lbp (line-beginning-position)) (message "%s %s %s" my-writing-check-orig-buffer my-writing-check- check-buffer lbp) (goto-char lbp) (re-search-forward "[ ]*\\([0-9]+\\): \"\\(.*\\)\" -->" nil t) (setq linnum (match-string 1)) (setq string1 (match-string 2)) (pop-to-buffer my-writing-check-orig-buffer) (goto-line (string-to-number linnum)) ))) (defun my-writing-check-see-context () (interactive) (save-excursion (let (lbp linnum string1) (setq lbp (line-beginning-position)) (message "%s %s %s" my-writing-check-orig-buffer my-writing-check- check-buffer lbp) (goto-char lbp) (re-search-forward "[ ]*\\([0-9]+\\): \"\\(.*\\)\" -->" nil t) (setq linnum (match-string 1)) (setq string1 (match-string 2)) (pop-to-buffer my-writing-check-orig-buffer) (goto-line (string-to-number linnum)) (pop-to-buffer my-writing-check-check-buffer) ))) (provide 'my-writing-check-mode) ----------------------------------------------------------------------------