all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: emacs-devel@gnu.org
Subject: Re: Info-insert-dir
Date: Mon, 19 Mar 2007 01:15:13 -0400	[thread overview]
Message-ID: <E1HTADB-0003Uw-9R@fencepost.gnu.org> (raw)
In-Reply-To: <45FD35C4.7060207@gmx.at> (message from martin rudalics on Sun, 18 Mar 2007 13:51:16 +0100)

    My last statement was incorrect.  The value of `default-directory' in
    the *info* buffer is not nil but a directory that doesn't exist.

This nonexistent directory came from `Info-additional-directory-list',
right?  So I think that if this is a bug, the bug would be at the
earlier stage, where the value of `Info-additional-directory-list' was
set up.  Do you disagree?

      More disconcerting,
    however, is that any part of Emacs that relies on a valid, existing
    default directory won't work reliably.

You can set `default-directory' to any string, so Emacs facilities
should not assume it is an existing directory unless it part of
their definition to need that.

Therefore, those other features such as spell checking should be
changed not to depend on this.  As far as I know, ispell and aspell
have no need to use the default directory.  Indeed one call-process
call in ispell.el already handles the case of nonexistent default
directory.

Does this patch make it work?


*** ispell.el	17 Feb 2007 15:40:35 -0500	1.208
--- ispell.el	18 Mar 2007 19:27:09 -0500	
***************
*** 895,901 ****
    (let* ((dictionaries
  	  (split-string
  	   (with-temp-buffer
! 	     (call-process ispell-program-name nil t nil "dicts")
  	     (buffer-string))))
  	 ;; Search for the named dictionaries.
  	 (found
--- 895,904 ----
    (let* ((dictionaries
  	  (split-string
  	   (with-temp-buffer
! 	     (let ((default-directory default-directory))
! 	       (unless (file-exists-p default-directory)
! 		 (setq default-directory (expand-file-name "~/")))
! 	       (call-process ispell-program-name nil t nil "dicts"))
  	     (buffer-string))))
  	 ;; Search for the named dictionaries.
  	 (found
***************
*** 928,934 ****
    "Return value of Aspell configuration option KEY.
  Assumes that value contains no whitespace."
    (with-temp-buffer
!     (call-process ispell-program-name nil t nil "config" key)
      (car (split-string (buffer-string)))))
  
  (defun ispell-aspell-find-dictionary (dict-name)
--- 931,940 ----
    "Return value of Aspell configuration option KEY.
  Assumes that value contains no whitespace."
    (with-temp-buffer
!     (let ((default-directory default-directory))
!       (unless (file-exists-p default-directory)
! 	(setq default-directory (expand-file-name "~/")))
!       (call-process ispell-program-name nil t nil "config" key))
      (car (split-string (buffer-string)))))
  
  (defun ispell-aspell-find-dictionary (dict-name)
***************
*** 1499,1509 ****
  	      (set-buffer output-buf)
  	      (erase-buffer)
  	      (set-buffer session-buf)
! 	      (setq status
! 		    (apply 'call-process-region (point-min) (point-max)
! 			   ispell-program-name nil
! 			   output-buf nil
! 			   "-a" "-m" ispell-args))
  	      (set-buffer output-buf)
  	      (goto-char (point-min))
  	      (save-match-data
--- 1505,1518 ----
  	      (set-buffer output-buf)
  	      (erase-buffer)
  	      (set-buffer session-buf)
! 	      (let ((default-directory default-directory))
! 		(unless (file-exists-p default-directory)
! 		  (setq default-directory (expand-file-name "~/")))
! 		(setq status
! 		      (apply 'call-process-region (point-min) (point-max)
! 			     ispell-program-name nil
! 			     output-buf nil
! 			     "-a" "-m" ispell-args)))
  	      (set-buffer output-buf)
  	      (goto-char (point-min))
  	      (save-match-data
***************
*** 2197,2209 ****
  	    (while (search-backward "*" nil t) (insert "."))
  	    (setq word (buffer-string))
  	    (erase-buffer))
! 	  (setq status (apply 'call-process prog nil t nil
! 			      (nconc (if (and args (> (length args) 0))
! 					 (list args)
! 				       (if look-p nil
! 					 (list "-e")))
! 				     (list word)
! 				     (if lookup-dict (list lookup-dict)))))
  	  ;; grep returns status 1 and no output when word not found, which
  	  ;; is a perfectly normal thing.
  	  (if (stringp status)
--- 2206,2221 ----
  	    (while (search-backward "*" nil t) (insert "."))
  	    (setq word (buffer-string))
  	    (erase-buffer))
! 	  (let ((default-directory default-directory))
! 	    (unless (file-exists-p default-directory)
! 	      (setq default-directory (expand-file-name "~/")))
! 	    (setq status (apply 'call-process prog nil t nil
! 				(nconc (if (and args (> (length args) 0))
! 					   (list args)
! 					 (if look-p nil
! 					   (list "-e")))
! 				       (list word)
! 				       (if lookup-dict (list lookup-dict))))))
  	  ;; grep returns status 1 and no output when word not found, which
  	  ;; is a perfectly normal thing.
  	  (if (stringp status)

  parent reply	other threads:[~2007-03-19  5:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-16 19:44 Info-insert-dir martin rudalics
     [not found] ` <E1HSuLw-0005So-CU@fencepost.gnu.org>
     [not found]   ` <45FD35C4.7060207@gmx.at>
2007-03-19  5:15     ` Richard Stallman [this message]
2007-03-19  9:50       ` Info-insert-dir martin rudalics
2007-03-19 21:57         ` Info-insert-dir Richard Stallman
2007-03-20  9:56           ` Info-insert-dir martin rudalics
2007-03-21  0:42             ` Info-insert-dir Richard Stallman
2007-03-21  0:42             ` Info-insert-dir Richard Stallman
2007-03-21  7:38               ` Info-insert-dir martin rudalics
2007-03-22  5:01                 ` Info-insert-dir Richard Stallman
2007-03-22  7:19                   ` Info-insert-dir martin rudalics
2007-03-22 22:50                     ` Info-insert-dir Richard Stallman
2007-03-23  9:01                       ` Info-insert-dir martin rudalics
2007-03-23 18:00                         ` Info-insert-dir Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1HTADB-0003Uw-9R@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.