免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: flw
打印 上一主题 下一主题

有关 Emacs 使用技巧的内容请在这个帖子讨论。 [复制链接]

论坛徽章:
0
1 [报告]
发表于 2006-07-29 21:38 |显示全部楼层
M+P

论坛徽章:
0
2 [报告]
发表于 2006-12-06 19:22 |显示全部楼层
原帖由 redjade 于 2006-12-4 17:35 发表
我在本地windows机器上运行emacs, 现在可以用FTP登录到远程solaris机器, 进行远程文件编辑和保存.
   可是我想知道,如何能登录到远程机器上,执行shell命令.


telnet, windows自带的telnet不行, 建议你装下cygwin
在.emacs下配置:
(setenv "PATH" (concat "C:/cygwin/bin;" (getenv "PATH")))
(setq exec-path (cons "C:/cygwin/bin/" exec-path))
(require 'cygwin-mount)
(cygwin-mount-activate)
(add-hook 'comint-output-filter-functions
                                        'shell-strip-ctrl-m nil t)
(add-hook 'comint-output-filter-functions
                                        'comint-watch-for-password-prompt nil t)
(setq explicit-shell-file-name "bash.exe")
;; For subprocesses invoked via the shell
;; (e.g., "shell -c command")
(setq shell-file-name explicit-shell-file-name)
(require 'telnet)
(defun telnet (host)
  "Open a network login connection to host named HOST (a string).
Communication with HOST is recorded in a buffer `*PROGRAM-HOST*'
where PROGRAM is the telnet program being used.  This program
is controlled by the contents of the global variable
`telnet-host-properties', falling back on the value of the
global variable `telnet-program'. Normally input is edited
in Emacs and sent a line at a time."
  (interactive "sOpen connection to host: ")
  (let* ((comint-delimiter-argument-list '(?\  ?\t))
         (properties (cdr (assoc host telnet-host-properties)))
         (telnet-program (if properties (car properties) telnet-program))
         (name (concat telnet-program "-" (comint-arguments host 0 nil) ))
         (buffer (get-buffer (concat "*" name "*")))
         (telnet-options (if (cdr properties)
                                                                                                                 (cons "-l" (cdr properties))))
         process)
    (if (and buffer (get-buffer-process buffer))
        (pop-to-buffer (concat "*" name "*"))
      (pop-to-buffer
       (apply 'make-comint name telnet-program nil telnet-options))
      (setq process (get-buffer-process (current-buffer)))
      ;;(set-process-filter process 'telnet-initial-filter)
      ;; Don't send the `open' cmd till telnet is ready for it.
      ;;(accept-process-output process)
      (erase-buffer)
      (send-string process (concat "open " host "\n"))
      (telnet-mode)
      (setq telnet-remote-echoes nil)
      (setq telnet-new-line "\n")        ;; needed for cygwin 1.3.11
      (setq comint-input-sender 'telnet-simple-send)
      (setq telnet-count telnet-initial-count)
      (setq comint-process-echoes t)
      )))

论坛徽章:
0
3 [报告]
发表于 2006-12-06 19:24 |显示全部楼层
然后执行alt+x telnet 输入ip 回车密码回车即可使用, 比什么crt等等有很多优点。ssh也可以类似配置出来

论坛徽章:
0
4 [报告]
发表于 2006-12-06 19:27 |显示全部楼层
原帖由 centerplain 于 2006-12-5 14:11 发表
emacs怎样配置才能拥有交叉编译和在线调试的功能呢?
在cygwin下可以实现这种功能么?
我在Windows NT上装了cygwin,它本身带了一个emacs,但是只能是命令行式的
我也不知道怎么把它搞成代码浏览ECB的形式
反 ...


alt+x shell就很好用啊,还有emacs gdb支持
ECB太慢了, cscope 足够了, 速度快够用

论坛徽章:
0
5 [报告]
发表于 2006-12-06 19:29 |显示全部楼层
原帖由 hawk2012 于 2006-12-6 16:42 发表
我在windows下面使用emacs. 请问.emacs在哪里啊??


ft, C+X C+F, 输入~/.emacs回车, 看看是那里不就知道了

论坛徽章:
0
6 [报告]
发表于 2006-12-07 10:55 |显示全部楼层
原帖由 hawk2012 于 2006-12-7 10:52 发表


我的没有呀,这个是目录下的东西:  //没有.emacs
c:/JADE-DTK/cygwin/home/Administrator:
  total used in directory 2 available 21535744
  drwxrwxrwx   1 Administrator root            0 12-06 15 ...

not "//", use "~/"

论坛徽章:
0
7 [报告]
发表于 2006-12-08 17:18 |显示全部楼层
原帖由 hawk2012 于 2006-12-8 12:50 发表


晕! "//"意思表示注释

你看到我贴的目录下的文件了.没有.emacs呀


ft,没有就自己建一个啊

论坛徽章:
0
8 [报告]
发表于 2006-12-13 15:38 |显示全部楼层
原帖由 redjade 于 2006-12-13 10:56 发表
而且在cygwin下,emacs是单色的,看起来不好用


不好意思, 忘记说我emacs版本了, 我用的是emacs22, cywin自带的我是不用的。
win下.emacs没问题的

cywin mount文件:
cygwin-mount.el
google一下, 下的到
你只需要放到 emacs loadpath里面就行, loadpath可以在.emacs中这么配置:
(add-to-list 'load-path "C:/emacs/site-lisp")


你那个错误就不报了

论坛徽章:
0
9 [报告]
发表于 2006-12-25 20:56 |显示全部楼层
原帖由 redjade 于 2006-12-22 10:04 发表


是不报错误了,可是telnet还是登不上.出错信息是:
Process telnet-x.x.x.x exited abnormally with code 255

是否跟SSH的配置有关?我.emacs的配置如下: (cygwin和emacs都装在c:/myrun/下)

(setq tramp- ...


主意: win的telnet由于是新开终端程序所以不能用, 一定要用cygwin的telnet, 请检查你cygwin/bin下是否有telnet程序
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP