2014-04-05 5 views
1

현재 사용자 입력 포커스를 얻으려면 프로그래밍 방식으로 강제로 Emacs X Window를 강제 설정합니까?프로그래밍 방식으로 Emacs 창을 입력 포커스로 설정

나는 이맥스 창이 자동으로 윈도우 포커스를 얻을 수 있도록 다음과 같은 배쉬 스크립트

# Debug in Emacs using GDB 
function emacs-gdb() 
{ 
    if [ -z $1 ]; then 
     echo -e "Usage: $FUNCNAME EXE EXE_ARGS..."; 
    else 
     if (($# >= 2)); then 
      local ARGS="--args ${@:1:100}"; 
     else 
      local ARGS="$1"; 
     fi 
    emacsclient --eval "(gdb \"gdb -i=mi $ARGS\")" 
    fi 
} 

이를 사용하고 싶습니다.

답변

1

귀하의 평점 코드에 raise-frame에 대한 전화를 추가하면됩니다. 예를 들어

은 :

emacsclient --eval "(progn (raise-frame) (gdb \"gdb -i=mi $ARGS\"))" 
+0

죄송 합니다만 gnome-shell에서는 작동하지 않습니다. 프레임이 보이지도 아이콘 화되지도 않습니다. –

+0

'gdb'라는 새로운 Emacs 프레임을 만들고 싶다고 생각했습니다. 이 경우'-c' 인수를'emacsclient' 호출에 추가 할 수 있습니다. 그렇지 않으면, 기존의 Emacs 프레임에 초점을 맞추려면 @ abo-abo의 대답과 같은 외부 프로그램 인'wmctrl'을 사용해야합니다. – tungd

0

나는이 곳 org-protocol 관련에서 복사 한 것. 그것은뿐만 아니라 당신을 도움이 될 것입니다 : 이것은 물론 raise-frame를 호출 @ tungd의 조언에 추가됩니다

(defadvice raise-frame (after make-it-work (&optional frame) activate) 
    "Work around some bug? in raise-frame/Emacs/GTK/Metacity/something. 
    Katsumi Yamaoka posted this in 
    http://article.gmane.org/gmane.emacs.devel:39702" 
    (call-process 
    "wmctrl" nil nil nil "-s" "1") 
    (call-process 
    "wmctrl" nil nil nil "-i" "-R" 
    (frame-parameter (or frame (selected-frame)) 'outer-window-id))) 

.