Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Fonction interactive

2 réponses
Avatar
Guillaume Connan
Bonsoir,

étant très casanier, je ne voudrais pas quitter emacs pour graver un
cd, donc j'essaie de créer une petite fonction interactive car emacs
et capable de tout (mais moi de rien)




(defun guillaume-gravure (fichiers)
"Gravure de cd"
(interactive "ffichiers à graver : ")
(shell-command (concat "sudo cdrecord -v -dev=1,0,0 -speed=2 -fs=31m -dao -useinfo -pad"
fichiers
))
(set-window-text-height nil (ceiling (* (frame-height) .7))))

(define-key global-map [(super c) (super g)] 'guillaume-gravure)




Mais manque de chance, comme la commande est effectuée avec sudo, on
me demande le mot de passe et là le mini-buffer n'est plus du tout
interactif. Comment obtenir ce double niveau d'interaction.

Autre problème, normalement, dans un terminal, je sépare les fichiers
à graver par des espaces mais impossible ici.







--
Guillaume Connan

http://gconnan.free.fr

2 réponses

Avatar
Ph. Ivaldi
Salut,

Le 24 juin 2007, Guillaume Connan écrivit :

Mais manque de chance, comme la commande est effectuée avec sudo, on
me demande le mot de passe et là le mini-buffer n'est plus du tout
interactif. Comment obtenir ce double niveau d'interaction.



Je n'ai jamais fait ce genre de chose mais tu peux regarder du côté des
fonctions comint-watch-for-password-prompt et send-invisible.

Autre problème, normalement, dans un terminal, je sépare les fichiers
à graver par des espaces mais impossible ici.



Tu peux utiliser call-process (voir la doc) comme ceci:
(call-process shell-file-name nil (list nil ton_fichier_stdout) nil
shell-command-switch command)

où "command" et "ton_fichier_stdout" sont à modifier en conséquence.
--
Philippe Ivaldi.
http://piprim.tuxfamily.org/
Avatar
Guillaume Connan
Le 25 juin 2007 à 11:06, Ph. Ivaldi s'est librement exprimé ainsi :

Salut,

Le 24 juin 2007, Guillaume Connan écrivit :

Mais manque de chance, comme la commande est effectuée avec sudo,
on me demande le mot de passe et là le mini-buffer n'est plus du
tout interactif. Comment obtenir ce double niveau d'interaction.



Je n'ai jamais fait ce genre de chose mais tu peux regarder du côté
des fonctions comint-watch-for-password-prompt et send-invisible.

Autre problème, normalement, dans un terminal, je sépare les
fichiers à graver par des espaces mais impossible ici.



Tu peux utiliser call-process (voir la doc) comme ceci:
(call-process shell-file-name nil (list nil ton_fichier_stdout) nil
shell-command-switch command)

où "command" et "ton_fichier_stdout" sont à modifier en conséquence.




Merci Philippe, mais...
je reste bloqué(je ne suis pas doué...)

Finalement, je suis passé directement par sh

8<------8<------8<------8<------8<------8<------8<------8<------
#! /bin/sh
# graver les cd.

echo -n "Entrer les fichiers a copier"

read fich;

echo "fich = $fich"

echo

sudo cdrecord -v -dev=1,0,0 -speed=2 -fs1m -dao -useinfo -pad $fich
8<------8<------8<------8<------8<------8<------8<------8<------

Sinon, j'ai deux autres problèmes totalement différents.

- Je ne peux pas écrire de n majuscules dans mes courriers...
- Pour une fois, j'ai modifié mon emacs via le "customize" et mon
changement de police ne fonctionne pas. Il faut que j'édite .emacs
plus evaluate buffer pour que ça marche. Voici ce qu'il y a dans le
.emacs qui a été rajouté par custom


8<------8<------8<------8<------8<------8<------8<------8<------

(custom-set-faces
;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(default ((t (:stipple nil :background "black" :foreground "wheat" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 165 :width normal :family "terminal"))))
'(background "blue")
'(fixed-pitch ((t (:family "terminal"))))
'(font-latex-math-face ((((class color) (background dark)) (:foreground "orange"))))
'(font-latex-verbatim-face ((((class color) (background dark)) (:inherit fixed-pitch :foreground "red" :inverse-video unspecified))))
'(font-lock-builtin-face ((((class color) (background dark)) (:foreground "Turquoise"))))
;; '(font-lock-comment-face ((t (:foreground "MediumAquamarine"))))
'(font-lock-constant-face ((((class color) (background dark)) (:bold t :foreground "DarkOrchid"))))
'(font-lock-doc-string-face ((t (:foreground "green2"))))
'(font-lock-function-name-face ((t (:foreground "SkyBlue"))))
'(font-lock-keyword-face ((t (:bold t :foreground "CornflowerBlue"))))
'(font-lock-preprocessor-face ((t (:italic nil :foreground "CornFlowerBlue"))))
'(font-lock-reference-face ((t (:foreground "DodgerBlue"))))
'(font-lock-string-face ((t (:foreground "LimeGreen"))))
'(font-lock-type-face ((t (:foreground "#9290ff"))))
'(font-lock-variable-name-face ((t (:foreground "PaleGreen"))))
'(font-lock-warning-face ((((class color) (background dark)) (:foreground "yellow" :background "red"))))
'(header-line ((((class color grayscale) (background dark)) (:inherit mode-line :background "grey20" :foreground "grey90" :box nil :family "terminal"))))
'(highlight ((t (:background "orangered"))))
'(list-mode-item-selected ((t (:background "gold"))))
'(makefile-space-face ((t (:background "wheat"))))
'(mode-line ((t (:background "Brown" :foreground "gray" :box (:line-width -1 :style released-button)))))
'(modeline ((t (:background "Brown"))))
'(mouse ((t (:background "grey35"))))
'(paren-match ((t (:background "darkseagreen4"))))
'(pi-big-font pi-small-font)
'(pi-toggle-font pi-toggle-font)
'(region ((t (:background "DarkSlateBlue"))))
;;'(scissors scrmable)
'(scroll-bar ((t (:background "grey45" :foreground "#00ffbf"))))
'(show-paren-match-face ((t (:foreground "black" :background "wheat"))))
'(show-paren-mismatch-face ((((class color)) (:foreground "white" :background "red"))))
'(speedbar-button-face ((((class color) (background dark)) (:foreground "green4"))))
'(speedbar-directory-face ((((class color) (background dark)) (:foreground "khaki"))))
'(speedbar-file-face ((((class color) (background dark)) (:foreground "cyan"))))
'(speedbar-tag-face ((((class color) (background dark)) (:foreground "Springgreen"))))
'(textomail-region textomail-region)
'(vhdl-speedbar-architecture-selected-face ((((class color) (background dark)) (:underline t :foreground "Blue"))))
'(vhdl-speedbar-entity-face ((((class color) (background dark)) (:foreground "darkGreen"))))
'(vhdl-speedbar-entity-selected-face ((((class color) (background dark)) (:underline t :foreground "darkGreen"))))
'(vhdl-speedbar-package-face ((((class color) (background dark)) (:foreground "black"))))
'(vhdl-speedbar-package-selected-face ((((class color) (background dark)) (:underline t :foreground "black"))))
'(widget-field-face ((((class grayscale color) (background light)) (:background "DarkBlue")))))





(custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(LaTeX-verbatim-environments (quote ("verbatim" "verbatim*" "lstlisting" "boxedverbatim")))
'(auto-compression-mode t nil (jka-compr))
'(backup-by-copying t)
'(canlock-password "133aadb960dace95c22833969aae1d7433b437f2")
'(case-fold-search t)
'(current-language-environment "latin-9")
'(default-input-method "latin-9-prefix")
'(delete-old-versions nil)
'(display-time-24hr-format t)
'(face-font-family-alternatives (quote (("helvetica" "fixed") ("helv" "helvetica" "arial" "fixed"))))
'(global-font-lock-mode t nil (font-lock))
'(kept-new-versions 1)
'(mail-yank-prefix "> ")
'(message-directory "~/.Mail/")
'(mm-discouraged-alternatives (quote ("("text/html" "text/richtext")")))
'(pdf-view-command "evince")
'(ps-view-command "evince")
'(read-mail-command (quote gnus))
'(show-paren-mode t nil (paren))
'(speedbar-frame-parameters (quote ((minibuffer) (width . 20) (border-width . 0) (menu-bar-lines . 0) (tool-bar-lines . 0) (unsplittable . t) (set-background-color "black"))))
'(transient-mark-mode t)
'(uniquify-buffer-name-style (quote post-forward-angle-brackets) nil (uniquify)))





--
Guillaume Connan

http://gconnan.free.fr