Deutsch   English   Français   Italiano  
<87tuv6dn3a.fsf@s02.forall>

View for Bookmarking (what is this?)
Look up another Usenet article

X-Received: by 2002:a05:600c:1149:: with SMTP id z9mr1543736wmz.180.1602087642555;
        Wed, 07 Oct 2020 09:20:42 -0700 (PDT)
Path: ...!news-out.google.com!nntp.google.com!proxad.net!feeder1-2.proxad.net!cleanfeed3-b.proxad.net!nnrp1-1.free.fr!not-for-mail
From: Valrik <nospam@valrik.invalid>
Newsgroups: fr.comp.applications.emacs
Subject: Laisser passer les touches de fonctions =?utf-8?Q?=C2=AB?= Fn
 =?utf-8?Q?=C2=BB?= dans un terminal.
Date: Wed, 07 Oct 2020 18:20:41 +0200
Message-ID: <87tuv6dn3a.fsf@s02.forall>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:K4thfr/GhVnXYi6qxE/UEHgvQQ0=
MIME-Version: 1.0
Lines: 71
Organization: Guest of ProXad - France
NNTP-Posting-Date: 07 Oct 2020 18:20:42 CEST
NNTP-Posting-Host: 91.172.153.64
X-Trace: 1602087642 news-4.free.fr 5893 91.172.153.64:51772
X-Complaints-To: abuse@proxad.net
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Bytes: 3574

Bonjour =C3=A0 tous.

Je souhaiterais utiliser l'application pamix (r=C3=A9glage du son) dans un
terminal Emacs.

Seulement voila, pour passer d'un =C2=AB panneau =C2=BB =C3=A0 l'autre de c=
elle-ci, il
faut utiliser les touches de fonctions F1 =C3=A0 F4. Mais elles sont =C2=AB
intercept=C3=A9es =C2=BB par le terminal d'Emacs.

J'ai trouv=C3=A9 sur
https://stackoverflow.com/questions/2396680/let-emacs-send-fn-keys-to-progr=
ams-in-ansi-term
un bout de code int=C3=A9ressant et que j'ai adapt=C3=A9 comme suit :

(defun term-send-function-key ()
  "suivant : https://stackoverflow.com/questions/2396680/let-emacs-send-fn-=
keys-to-programs-in-ansi-term"
  (interactive)
  (let* ((char last-input-event)
         (output (cdr (assoc char term-function-key-alist))))
    (term-send-raw-string output)))


(defun ma-term-init-appel_initialisation_des_raccourcis_clavier()
  "Appel de toutes les fonctions d'initialisation des raccourcis
clavier."

  ;; d'apr=C3=A8s "https://stackoverflow.com/questions/5500035/set-custom-k=
eybinding-for-specific-emacs-mode"
  (eval-after-load 'term-mode
    (progn
      (local-set-key (kbd "<f6> ck") 'ma-term-copie_kill_ring_dans_term)
      ;; (local-set-key [(shift f7)] (lambda () (interactive) (term-send-ra=
w-string "^[OR"))) ;; Essai
      ;; (local-set-key [(shift f1)] (lambda () (interactive) (term-send-ra=
w-string "q"))) ;; Essai

      (defconst term-function-key-alist '((f1 . "\e[OP")
					  (f2 . "\e[OQ")
					  (f3 . "\e[OR")
					  (f4 . "\e[OS")
					  (f7 . "q")))

      (dolist (spec term-function-key-alist)
	(define-key term-raw-map
	  (read-kbd-macro (format "<%s>" (car spec)))
	  'term-send-function-key))

)))

Cela fonctionne correctement pour la touche F7 (arr=C3=AAt de pamix et reto=
ur
au shell), mais pas pour les autres. En glanant des =C3=A9l=C3=A9ments sur =
le net,
j'ai =C3=A9galement essay=C3=A9 pas mal de combinaisons en utilisant M-: RET
(term-send-raw-string "le_code_=C3=A0_tester") : rien =C3=A0 faire, pamix r=
este
imperturbable. Sauf pour =C2=AB q =C2=BB bien s=C3=BBr.

Ce n'est donc pas un probl=C3=A8me dans le code Elisp, mais bien le code des
touches fonction =C2=AB Fn =C2=BB qui pose probl=C3=A8me. Mais je ne trouve=
 pas la
solution dans la documentation.

D=C3=A9j=C3=A0, si je pouvais d=C3=A9sactiver toute interpr=C3=A9tation la =
frappe des
touches par le terminal, je pourrais utiliser les outils Unix afin
d'identifier les codes correspondants.

Un grand merci pour votre attention.