help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 31.0.50; shell, virtualenv


From: Jean Louis
Subject: Re: 31.0.50; shell, virtualenv
Date: Mon, 16 Dec 2024 12:20:40 +0300
User-agent: Mutt/2.2.12 (2023-09-09)

* 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]