From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Agustin Martin Newsgroups: gmane.emacs.bugs Subject: bug#13019: 24.2; ispell: use of local ispell-personal-dictionary Date: Fri, 30 Nov 2012 18:59:47 +0100 Message-ID: <20121130175947.GA17506@agmartin.aq.upm.es> References: <64FA190B-F4D1-4743-B468-DF2262348DF1@gmail.com> <11368004.8066.1354137417393.JavaMail.root@mx1-new.spamfiltro.es> <20121130171156.GA5521@agmartin.aq.upm.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="J2SCkAp4GZ/dPZZf" X-Trace: ger.gmane.org 1354298412 9994 80.91.229.3 (30 Nov 2012 18:00:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Nov 2012 18:00:12 +0000 (UTC) Cc: Akim Demaille To: 13019@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 30 19:00:24 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TeUsn-0002VZ-9S for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Nov 2012 19:00:13 +0100 Original-Received: from localhost ([::1]:32792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TeUsb-0005IR-3G for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Nov 2012 13:00:01 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TeUsY-0005Hr-4E for bug-gnu-emacs@gnu.org; Fri, 30 Nov 2012 12:59:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TeUsW-0005o6-8B for bug-gnu-emacs@gnu.org; Fri, 30 Nov 2012 12:59:58 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TeUsW-0005o0-4r for bug-gnu-emacs@gnu.org; Fri, 30 Nov 2012 12:59:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TeUuY-0002AT-2x for bug-gnu-emacs@gnu.org; Fri, 30 Nov 2012 13:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Agustin Martin Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Nov 2012 18:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13019 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13019-submit@debbugs.gnu.org id=B13019.13542985208324 (code B ref 13019); Fri, 30 Nov 2012 18:02:02 +0000 Original-Received: (at 13019) by debbugs.gnu.org; 30 Nov 2012 18:02:00 +0000 Original-Received: from localhost ([127.0.0.1]:47271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TeUuV-0002AD-CP for submit@debbugs.gnu.org; Fri, 30 Nov 2012 13:01:59 -0500 Original-Received: from fibonacci.ccupm.upm.es ([138.100.198.70]:55901 helo=smtp.upm.es) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TeUuR-0002A3-KO for 13019@debbugs.gnu.org; Fri, 30 Nov 2012 13:01:57 -0500 Original-Received: from agmartin.aq.upm.es (Agmartin.aq.upm.es [138.100.41.131]) by smtp.upm.es (8.14.3/8.14.3/fibonacci-001) with ESMTP id qAUHxlus000623; Fri, 30 Nov 2012 18:59:47 +0100 Original-Received: by agmartin.aq.upm.es (Postfix, from userid 1000) id 5F605707; Fri, 30 Nov 2012 18:59:47 +0100 (CET) Content-Disposition: inline In-Reply-To: <20121130171156.GA5521@agmartin.aq.upm.es> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:67672 Archived-At: --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Nov 30, 2012 at 06:11:56PM +0100, Agustin Martin wrote: > On Wed, Nov 28, 2012 at 04:16:53PM -0500, Glenn Morris wrote: > > Akim Demaille wrote: > > > > > I have recently upgraded my Emacs from 22.2.1 to 24.2.1, and there is > > > a feature I lost: I could use ispell-personal-dictionary to specify a > > > per-document *local* (i.e., relative to the directory of the file) > > > dictionary. > > > > Presumably due to 2010-09-02 changes to ispell-init-process for > > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6143 > > > > Perhaps a file-name-absolute-p check for various variables could be > > file-local could be added to that. > > > > > | %%% ispell-dictionary: "american" > > > | %%% ispell-personal-dictionary: "../en.dict" > > Actual problem happens in `ispell-start-process' where the string to be > passed to the spellchecker as personal dictionary is expanded, > > (if ispell-current-personal-dictionary ; Use specified pers dict. > (list "-p" (expand-file-name ispell-current-personal-dictionary))) > > and is indeed affected by the changes in `default-dictionary' coming from > `ispell-init-process`. > > I think the only reason for that `expand-file-name' is the tilde expansion > in non-UNIX systems. In UNIX systems tilde can be explicitly passed. > Not sure if the directory {forward,back}slash is also related to this. > > I am thinking about expanding `ispell-current-personal-dictionary' string > only if it contains a tilde prefix. I am now playing with something different, preserve original value of `default-directory' in `current-ispell-directory' variable and expand personal dictionary after it if no absolute path or tilde is used. I think this is a better approach, see attached patch. Let me test this a bit more before committing. Feel free to test it too. -- Agustin --J2SCkAp4GZ/dPZZf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ispell.el_honour-personal-dictionary-path.diff" --- ispell.el.orig 2012-11-30 17:07:14.641701686 +0100 +++ ispell.el 2012-11-30 18:50:08.725283277 +0100 @@ -2669,7 +2669,8 @@ orig-args (if ispell-current-personal-dictionary ; Use specified pers dict. (list "-p" - (expand-file-name ispell-current-personal-dictionary))) + (expand-file-name ispell-current-personal-dictionary + current-ispell-directory))) ;; If we are using recent aspell or hunspell, make sure we use the ;; right encoding for communication. ispell or older aspell/hunspell ;; does not support this. @@ -2706,18 +2707,21 @@ (let* (;; Basename of dictionary used by the spell-checker (dict-bname (or (car (cdr (member "-d" (ispell-get-ispell-args)))) ispell-current-dictionary)) + ;; The directory where process was started. + (current-ispell-directory default-directory) + ;; The default directory for the process. ;; Use "~/" as default-directory unless using Ispell with per-dir ;; personal dictionaries and not in a minibuffer under XEmacs (default-directory (if (or ispell-really-aspell ispell-really-hunspell ;; Protect against bad default-directory - (not (and (file-directory-p default-directory) - (file-readable-p default-directory))) + (not (and (file-directory-p current-ispell-directory) + (file-readable-p current-ispell-directory))) ;; Ispell and per-dir personal dicts available - (not (or (file-readable-p (concat default-directory + (not (or (file-readable-p (concat current-ispell-directory ".ispell_words")) - (file-readable-p (concat default-directory + (file-readable-p (concat current-ispell-directory ".ispell_" (or dict-bname "default"))))) @@ -2725,7 +2729,7 @@ (and (window-minibuffer-p) (not (fboundp 'minibuffer-selected-window)))) (expand-file-name "~/") - (expand-file-name default-directory)))) + (expand-file-name current-ispell-directory)))) ;; Check if process needs restart (if (and ispell-process (eq (ispell-process-status) 'run) --J2SCkAp4GZ/dPZZf--