From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.devel Subject: Re: jinx Date: Sat, 01 Apr 2023 10:25:27 +0200 Message-ID: <87edp42emg.fsf@dataswamp.org> References: <87sfdnyuxc.fsf@posteo.de> <83sfdl2z26.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20585"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:N3PBLivaWUc0OPtmy+TKIiNTT2E= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 01 13:15:15 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1piZCV-000597-GB for ged-emacs-devel@m.gmane-mx.org; Sat, 01 Apr 2023 13:15:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1piZBc-0003v5-6c; Sat, 01 Apr 2023 07:14:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piWYR-0005Sv-JK for emacs-devel@gnu.org; Sat, 01 Apr 2023 04:25:46 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piWYP-0006EU-S4 for emacs-devel@gnu.org; Sat, 01 Apr 2023 04:25:43 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1piWYM-0007ax-Aw for emacs-devel@gnu.org; Sat, 01 Apr 2023 10:25:38 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 01 Apr 2023 07:14:19 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304986 Archived-At: Eli Zaretskii wrote: > We cannot assume that "jinx is always available", since it > requires Emacs to be linked against the enchant library. > > Anyway, after looking at jinx, I must say that I don't see > why we should replace ispell and flyspell with jinx. From my > POV, ispell and flyspell provide all the required > spell-checking functionalities: > > . spell-check a word > . spell-check a region > . spell-check the entire buffer > . spell-check comments and strings in a prog-mode buffer > . spell-check as you type Had to do some work on some of that back when I set it up, don't know if that has since then been moved into vanilla Emacs - here is the file anyway ;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/spell.el ;; ;; Debian bug: ;; ispell-init-process: Illegal format hash table ;; /usr/lib/ispell/svenska.hash - expected magic2 0x9602, got 0x414c ;; $ sudo buildhash /usr/share/dict/svenska /usr/lib/ispell/svenska.aff /usr/lib/ispell/svenska.hash (require 'ispell) (when (eq system-type 'gnu/linux) (load-file "/usr/share/dictionaries-common/site-elisp/debian-ispell.el") (load-file "/var/cache/dictionaries-common/emacsen-ispell-dicts.el") ) (setq ispell-program-name "ispell") (setq ispell-silently-savep t) ;; single word (defun spell-word (word) (with-temp-buffer (save-excursion (insert word) ) (condition-case nil (not (ispell-word)) (error nil) ))) ;; (spell-word "length") ; t ;; (spell-word "lenght") ; nil (defun spell-this-word (dict) "`ispell-word' the preceding word with DICT." (ispell-change-dictionary dict) (ispell-word) ) (let ((eng-dict "american-insane")) (defun spell-english () (interactive) (spell eng-dict) ) (defun word () (interactive) (spell-this-word eng-dict) )) ;; test: hello / hxllo (let ((swe-dict "svenska")) (defun spell-swedish () (interactive) (spell swe-dict) ) (defun ord () (interactive) (spell-this-word swe-dict) )) ;; test: hej / hxj ;; buffer / whole / dwim (defun is-code () (member major-mode '(c++-mode c-mode emacs-lisp-mode prolog-mode python-mode sh-mode Shell-script-mode) )) ; add more ... (defun is-message () (eq major-mode 'message-mode) ) (defun spell (dict) "Spell with DICT. If region is active, use `ispell-region'; if editing code, `ispell-comments-and-strings'; if writing a message, `ispell-message'; else, `ispell-buffer'" (ispell-change-dictionary dict) (save-window-excursion (save-excursion (cond ((use-region-p) (ispell-region (region-beginning) (region-end))) ((is-message) (ispell-message)) ((is-code) (ispell-comments-and-strings)) (t (ispell-buffer)) )))) -- underground experts united https://dataswamp.org/~incal