开发者

Gnu Emacs: tab-completion for psql running within sql.el process

I enjoy running Postgres client "psql" under psql.el while interacting with a .sql file in a separate window. Sometimes, I want to use tab-completion within the the buffer running the psql process to find the name of an appropriate table name. However, I can not figure out how to cause the desired result.

A very related question has been asked here: https://superuser.com/questions/236574/how-can-i-send-a-literal-tab-to-bash-in-emacs-shell-mode

without any successful suggestions.

Thanks in advance!

S开发者_运维问答etJmp


Usually programs that designed for interactive use (when they own terminal) disable interactive features (like history for UP/DOWN, completion for TAB) when used in pipe.

Emacs usually use pipes for external processes. So interactive features are disabled.

Even if you send TAB, your client program does not interpret it for you as you want.

You can read man/help for your program and try force interactive mode by providing command line switch (like --login for GNU Bash).

To send TAB eval:

(defun my-comint-send-string (string)
  "Send string to comint buffers. Useful for *compilation* read-only buffer."
  (interactive
   (list (read-input "Type string: " nil 'my-comint-send-hist-list)))
  (comint-send-string (get-buffer-process (current-buffer)) string))
(define-key XXX-mode-map [C-return] 'my-comint-send-string)

and use such key sequence: C-RET C-q TAB RET.

But this may not work if buffering is enabled for stdio of your program (to flush input you must send \n too)...

Mostly same problem discussed at Bash autocompletion in Emacs shell-mode

NOTE M-x term use pseudo terminal so all interactive program work as desired. But in this mode you lose any Emacs editing capabilities...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜