unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* 31.0.50; shell, virtualenv
@ 2024-12-16  8:51 Andreas Röhler
  2024-12-16  9:20 ` Jean Louis
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Röhler @ 2024-12-16  8:51 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Have in init a command like that:

(defun aktivate-My-shell-virtualenv-root()
   (interactive)
   (when (boundp 'My-shell-virtualenv-root)
     (unless (string= "" My-shell-virtualenv-root)
       (dired My-shell-virtualenv-root)
       (setq default-directory My-shell-virtualenv-root)
       (shell)
       (virtualenv-activate My-shell-virtualenv-root))))

When calling this, get an error like:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
   find-file-name-handler(nil file-remote-p)
   file-remote-p(nil)
   with-connection-local-variables-1(#f(compiled-function () #<bytecode 
0x16056352af86ac49>))
   shell()
   (if (string= "" My-shell-virtualenv-root) nil (dired 
My-shell-virtualenv-root) (setq default-directory 
My-shell-virtualenv-root) (shell) (virtualenv-activate 
My-shell-virtualenv-root))
   (progn (if (string= "" My-shell-virtualenv-root) nil (dired 
My-shell-virtualenv-root) (setq default-directory 
My-shell-virtualenv-root) (shell) (virtualenv-activate 
My-shell-virtualenv-root)))
   (if (boundp 'My-shell-virtualenv-root) (progn (if (string= "" 
My-shell-virtualenv-root) nil (dired My-shell-virtualenv-root) (setq 
default-directory My-shell-virtualenv-root) (shell) (virtualenv-activate 
My-shell-virtualenv-root))))
   aktivate-My-shell-virtualenv-root()

The error goes away, when the custom-file is loaded manually before 
evaluating.

A bug?

Cheers,

Andreas

GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.16.0) of 2024-12-11




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 31.0.50; shell, virtualenv
  2024-12-16  8:51 31.0.50; shell, virtualenv Andreas Röhler
@ 2024-12-16  9:20 ` Jean Louis
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Louis @ 2024-12-16  9:20 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs@gnu.org

* Andreas Röhler <andreas.roehler@easy-emacs.de> [2024-12-16 11:54]:
> Have in init a command like that:
> 
> (defun aktivate-My-shell-virtualenv-root()
>   (interactive)
>   (when (boundp 'My-shell-virtualenv-root)
>     (unless (string= "" My-shell-virtualenv-root)
>       (dired My-shell-virtualenv-root)
>       (setq default-directory My-shell-virtualenv-root)
>       (shell)
>       (virtualenv-activate My-shell-virtualenv-root))))

You could ensure that `My-shell-virtualenv-root' is string by using:

(unless (and My-shell-virtualenv-root
	     (stringp My-shell-virtualenv-root)
	     (string= "" My-shell-virtualenv-root))

and I guess you may do this too:

(unless (and (boundp 'My-shell-virtualenv-root) ;; that it is bound
	     My-shell-virtualenv-root           ;; that it is not NIL
	     (stringp My-shell-virtualenv-root) ;; that it is string
	     (string= "" My-shell-virtualenv-root)) ;; that string is empty string

-- 
Jean Louis



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-16  9:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16  8:51 31.0.50; shell, virtualenv Andreas Röhler
2024-12-16  9:20 ` Jean Louis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).