こんな感じで使えます。
git svn clone https://chaton.svn.sourceforge.net/svnroot/chaton chaton
便利。
yum から入りました。
git svn clone https://chaton.svn.sourceforge.net/svnroot/chaton chaton
process.exit();
rfc.httpモジュールがhttpsコネクションをサポートします (今のところunix限定)。 コネクション自体は外部プログラム(stunnel) に依存します。
(use rfc.http) (use rfc.json) (use rfc.uri) (define *goo.gl-server* "www.googleapis.com") (define *goo.gl-request-uri* "/urlshortener/v1/url") (define my-api-key "hoge") (define (shorten-url url api-key) (body->json (^ _ (goo.gl-request http-post url api-key :msg (construct-json-string `(("longUrl" . ,url))))))) (define (expand-url url api-key) (body->json (^ _ (goo.gl-request http-get url api-key :more-req-uri #`"&shortUrl=,|url|")))) (define (body->json req) (receive (status header body) (req) (parse-json-string body))) (define (goo.gl-request method url api-key :key (more-req-uri "")(msg #f)) (let1 req-uri (string-append *goo.gl-request-uri* "?key=" api-key more-req-uri) (if msg (method *goo.gl-server* req-uri msg :content-type "application/json" :secure #t) (method *goo.gl-server* req-uri :secure #t)))) ;; (shorten-url "http://valvallow.blogspot.com/" my-api-key) ;; (shorten-url "http://practical-scheme.net/" my-api-key) ;; (expand-url "http://goo.gl/wvWgf" my-api-key) ;; (expand-url "http://goo.gl/ZThO" my-api-key)
「だったらストアドにすればいいじゃん。ポスグレなら Scheme でも書けるよ。」 「な、なんだってー!」 > ΩΩ Ω ザワザワ
ダウンロードして展開して README よろしく
- MySQLもPostgreSQLもちゃんと使える
- PostgreSQLはRyan謹製のNode.js製クライアントあり
ry's node_postgres
node-waf configure buildで入りました。
npm install .すると、node_postgres 同梱の test.js も無事動きました。
(require 'frame-arrange) (frame-arrange-mode t) ;; key-map - 「control + shift + 矢印 」で少しずつ位置を変更する (define-key global-map [(C shift down)] 'frange:increment-position-top/current-frame) (define-key global-map [(C shift up)] 'frange:increment-position-bottom/current-frame) (define-key global-map [(C shift left)] 'frange:increment-position-right/current-frame) (define-key global-map [(C shift right)] 'frange:increment-position-left/current-frame) ;; key-chord.el を使用した位置の変更 ;; ;; (auto-install-from-emacswiki "key-chord.el") ;; (require 'key-chord nil t) ;; (setq key-chord-two-keys-delay 0.04) ;; (key-chord-mode 1) (key-chord-define-global "qw" 'frange:arrange/top-left-most/current-frame) (key-chord-define-global "we" 'frange:arrange/top-most/current-frame) (key-chord-define-global "er" 'frange:arrange/top-right-most/current-frame) (key-chord-define-global "as" 'frange:arrange/left-most/current-frame) (key-chord-define-global "df" 'frange:arrange/right-most/current-frame) (key-chord-define-global "zx" 'frange:arrange/bottom-left-most/current-frame) (key-chord-define-global "xc" 'frange:arrange/bottom-most/current-frame) (key-chord-define-global "cv" 'frange:arrange/bottom-right-most/current-frame) ;; 名前を付けて保存してある設定を復元する ;; この場合 min, max という名前で保存してある設定 (define-key global-map (kbd "C-c m") #'(lambda () (interactive) (frange:restore-frame-position-parameter (selected-frame) 'min))) (define-key global-map (kbd "C-c M") #'(lambda () (interactive) (frange:restore-frame-position-parameter (selected-frame) 'max))) ;; 移動距離を設定する (setq frange:position-incremental-value 10) ;; サイズを変更する関数を生成する (def:frange/current-frame increment-size-top (nil height #'(lambda (v frame) (+ v frange:size-incremental-value)))) (def:frange/current-frame decrement-size-top (nil height #'(lambda (v frame) (- v frange:size-incremental-value)))) (def:frange/current-frame increment-size-left (nil width #'(lambda (v frame) (+ v frange:size-incremental-value)))) (def:frange/current-frame decrement-size-left (nil width #'(lambda (v frame) (- v frange:size-incremental-value)))) ;; 「Alt + 矢印」でサイズを変更する (define-key global-map [(M down)] 'frange:increment-size/current-frame) (define-key global-map [(M up)] 'frange:decrement-size/current-frame) (define-key global-map [(M down)] 'frange:increment-size-top/current-frame) (define-key global-map [(M up)] 'frange:decrement-size-top/current-frame) (define-key global-map [(M right)] 'frange:increment-size-left/current-frame) (define-key global-map [(M left)] 'frange:decrement-size-left/current-frame) ;; M-x から呼ぶので短かい名前の関数でラップ ;; regist (defun my-reg-frame () (interactive) (frange:regist-frame-position-parameter-interactive)) ;; restore (defun my-res-frame () (interactive) (frange:restore-frame-position-parameter-interactive)) ;; remove (defun my-rem-frame () (interactive) (frange:remove-arrange-config-alist-interactive)) (defun my-print-frange () (interactive) (frange:print-frame-position-parameter/current-frame)) (defun my-print-frange-n () (interactive) (frange:print-arrange-config-names)) (defun my-print-frange-e () (interactive) (frange:print-arrange-config-alist-entries)) ;; F12 連打で保存してある設定(位置とサイズ)を順番に適用する (define-key global-map [f12] (frange:cycle-arrange-config-gen))設定(位置とサイズ)の保存は frange:regist-frame-position-parameter-interactive から。
;; cycle (defun frange:cycle-arrange-config-gen () (lexical-let ((cur 0)) #'(lambda () (interactive) (let ((conf frange:arrange-config-alist)) (when conf (let* ((len (length conf)) (next (if (<= len (+ cur 1)) 0 (+ cur 1)))) (frange:restore-frame-position-parameter (selected-frame) (car (nth next conf))) (setq cur next)))))))例えば F12 を連打すると保存してある設定(位置とサイズ)を順番に適用します。
(define-key global-map [f12] (frange:cycle-arrange-config-gen))
(setq frange:size-incremental-value 10) (defun my-size-inc () (interactive) (frange:increment-size/current-frame)) (defun my-size-dec () (interactive) (frange:decrement-size/current-frame)) (define-key global-map (kbd "好みのキー") 'my-size-inc) (define-key global-map (kbd "好みのキー") 'my-size-dec)
(defun my-regist-frame () (interactive) (frange:regist-frame-position-parameter-interactive)) (defun my-restore-frame () (interactive) (frange:restore-frame-position-parameter-interactive)) (define-key global-map (kbd "好みのキー") 'my-regist-frame) (define-key global-map (kbd "好みのキー") 'my-restore-frame)
(define-key global-map [(M down)] 'frange:increment-size/current-frame) (define-key global-map [(M up)] 'frange:decrement-size/current-frame)
(require 'frame-arrange) ;; key-map (define-key global-map [(C shift down)] 'frange:increment-position-top/current-frame) (define-key global-map [(C shift up)] 'frange:increment-position-bottom/current-frame) (define-key global-map [(C shift left)] 'frange:increment-position-right/current-frame) (define-key global-map [(C shift right)] 'frange:increment-position-left/current-frame) (define-key global-map (kbd "C-c f q") 'frange:arrange/top-left-most/current-frame) (define-key global-map (kbd "C-c f w") 'frange:arrange/top-most/current-frame) (define-key global-map (kbd "C-c f e") 'frange:arrange/top-right-most/current-frame) (define-key global-map (kbd "C-c f a") 'frange:arrange/left-most/current-frame) (define-key global-map (kbd "C-c f d") 'frange:arrange/right-most/current-frame) (define-key global-map (kbd "C-c f z") 'frange:arrange/bottom-left-most/current-frame) (define-key global-map (kbd "C-c f x") 'frange:arrange/bottom-most/current-frame) (define-key global-map (kbd "C-c f c") 'frange:arrange/bottom-right-most/current-frame)
(def:frange/current-frame arrange/increment-top5
(nil top #'(lambda (v frame)
(+ v 5))))
(frange:arrange/increment-top5/current-frame)
(defun frange:identity (v frame) v) (def:frange/current-frame arrange/top (top top #'frange:identity)) (frange:arrange/top/current-frame 3)
(def:frange/current-frame arrange/bottom-most
(bottom top #'(lambda (v frame)
(- v))))
(frange:arrange/bottom-most/current-frame 15)
で、これを書いていて思ったのは、マクロの引数リストの第一要素・・・イラナイかもしれません。(frange:arrange/f (selected-frame) (frange:arrange-partial-gen '(top left)'(0 0)))
(frange:arrange/alist (selected-frame) '((top . 30)))
(frange:arrange (selected-frame) :y 0)
(require 'frame-arrange) ;; key-map (define-key global-map [(C shift down)] 'frange:increment-position-top/current-frame) (define-key global-map [(C shift up)] 'frange:increment-position-bottom/current-frame) (define-key global-map [(C shift left)] 'frange:increment-position-right/current-frame) (define-key global-map [(C shift right)] 'frange:increment-position-left/current-frame) ;; ;; (auto-install-from-emacswiki "key-chord.el") ;; (require 'key-chord nil t) ;; (setq key-chord-two-keys-delay 0.04) ;; (key-chord-mode 1) (key-chord-define-global "qw" 'frange:arrange/top-left-most/current-frame) (key-chord-define-global "we" 'frange:arrange/top-most/current-frame) (key-chord-define-global "er" 'frange:arrange/top-right-most/current-frame) (key-chord-define-global "as" 'frange:arrange/left-most/current-frame) (key-chord-define-global "df" 'frange:arrange/right-most/current-frame) (key-chord-define-global "zx" 'frange:arrange/bottom-left-most/current-frame) (key-chord-define-global "xc" 'frange:arrange/bottom-most/current-frame) (key-chord-define-global "cv" 'frange:arrange/bottom-right-most/current-frame) (frange:regist-frame-position-parameter 'example-min '((top . 20) (left . 70) (height . 30) (width . 110))) (frange:regist-frame-position-parameter 'example-max '((top + -4) (left + -4) (height . 35) (width . 126))) (define-key global-map (kbd "C-c m") #'(lambda () (interactive) (frange:restore-frame-position-parameter (selected-frame) 'example-min))) (define-key global-map (kbd "C-c M") #'(lambda () (interactive) (frange:restore-frame-position-parameter (selected-frame) 'example-max)))
$ gosh
gosh> (use dbi)
#<undef>
gosh> (use dbd.pg)
#<undef>
gosh> (let1 con (dbi-connect "dbi:pg:dbname=test")
(values (dbi-open? con)
(is-a? con <pg-connection>)
(dbi-close con)
(dbi-open? con)))
#t
#t
#<undef>
#f
gosh>
;; --- bookmark+ --- ;; (require 'bookmark+) ;; --- bookmark-extention --- ;; q : bmkext-bmenu-quit ;; j : bookmark-jump ;; o : bookmark-jump-other-window ;; t : bmkext-bmenu-toggle-marks ;; > : bmkext-bmenu-hide-unmarked ;; < : bmkext-bmenu-hide-marked ;; . : bmkext-bmenu-show-all-bookmarks ;; E : bmkext-bmenu-edit-bookmark ;; F : bmkext-bmenu-list-only-file-bookmarks ;; I : bmkext-bmenu-list-only-info-bookmarks ;; B : bmkext-bmenu-list-only-non-file-bookmarks ;; O : bmkext-bmenu-list-only-last-org-bookmarks ;; S-V : bmkext-bmenu-sort-by-visit-frequency ;; S-T : bmkext-bmenu-sort-by-last-time-visited ;; S-S : bmkext-bmenu-sort-alphabetically ;; M-g : bmkext-bmenu-search ;; M-t : bookmark-bmenu-toggle-filenames ;; %m : bmkext-bmenu-regexp-mark (require 'bookmark-extensions) (set-face-foreground 'bmkext-local-directory (face-foreground font-lock-function-name-face)) (set-face-background 'bmkext-local-directory "black") (set-face-foreground 'bmkext-local-file (face-foreground font-lock-variable-name-face))
declare @tablename varchar (30) set @tablename = 'employee' select cols.column_id as col_id ,left(cols.name, 20) as col_name ,left(types.name, 15) as type_name ,cols.max_length as col_length ,(case cols.is_nullable when 0 then 'no' when 1 then 'yes' else 'nothing' end) as nullable ,left(cast(ext.value as varchar), 50) as comment from sys.columns as cols left outer join (select name ,types.system_type_id from sys.types as types where is_user_defined = 0 group by types.system_type_id ,types.name) as types on types.system_type_id = cols.system_type_id left join sys.objects as obj on obj.object_id = cols.object_id left join sys.extended_properties as ext on cols.object_id = ext.major_id and cols.column_id = ext.minor_id where obj.name like @tablename order by column_id go
;; C-c C-c : 'sql-send-paragraph ;; C-c C-r : 'sql-send-region ;; C-c C-s : 'sql-send-string ;; C-c C-b : 'sql-send-buffer (require 'sql) ;; starting SQL mode loading sql-indent / sql-complete (eval-after-load "sql" '(progn (load-library "sql-indent"))) (custom-set-variables `(sql-indent-first-column-regexp ,(concat "^\\s-*" (regexp-opt '("select" "update" "insert" "delete" "union" "intersect" "from" "where" "into" "group" "having" "order by" "set" "create" "drop" "truncate" "left join" "right join" "inner join" "cross join" "on" "left outer join" "right outer join" "inner join" "begin" "rollback" "commit" "and" "or" "go" "--") t) "\\(\\b\\|\\s-\\)"))) (setq auto-mode-alist (cons '("\\.sql$" . sql-mode) auto-mode-alist)) (sql-set-product-feature 'ms :font-lock 'sql-mode-ms-font-lock-keywords) (custom-set-variables '(sql-ms-program "sqlcmd")) (custom-set-variables '(sql-ms-options '("-U" "-P" "-S" "-d"))) (sql-set-product-feature 'ms :sql-program 'sql-ms-program) (sql-set-product-feature 'ms :sqli-prompt-regexp "^[0-9]*>") (sql-set-product-feature 'ms :sqli-prompt-length 5) (sql-set-product-feature 'ms :sqli-login 'sql-ms-login-params) (sql-set-product-feature 'ms :sqli-connect 'sql-connect-ms) (add-hook 'sql-mode-hook #'(lambda () (setq sql-indent-offset 2) (setq sql-indent-maybe-tab t) (local-set-key "\C-cu" 'sql-to-update) (setq sql-pop-to-buffer-after-send-region nil))) (add-hook 'sql-interactive-mode-hook #'(lambda () (set-buffer-process-coding-system 'sjis-unix 'sjis-unix ) (setq show-trailing-whitespace nil) (setq comint-buffer-maximum-size 500) (setq comint-input-autoexpand t) (setq comint-output-filter-functions 'comint-truncate-buffer))) (defun sql-connect-ms () (let ((login-params (mapcar #'(lambda (e) (symbol-value (symb 'sql- e))) sql-ms-login-params))) (let* ((options (mapcar* #'cons sql-ms-options login-params)) (params (fold-right #'(lambda (e acc) (if (cdr e) (append (list (car e)(cdr e)) acc) acc)) nil options))) ;; (setq sql-ms-options (append params (list "-W"))) (setq sql-ms-options params) (sql-connect-1 sql-ms-program sql-ms-options)))) (defun run-mssql () (interactive) (sql-product-interactive 'ms)) (defvar backup:sql-ms-options sql-ms-options) (defvar backup:sql-ms-login-params sql-ms-login-params) (defun sql:reset-parameters () (interactive) (setq sql-ms-options backup:sql-ms-options) (setq sql-ms-login-params backup:sql-ms-login-params) (setq sql-user nil) (setq sql-password nil) (setq sql-server nil) (setq sql-database)) (defun reset/run-mssql () (interactive) (sql:reset-parameters) (run-mssql))
(defun fold (kons knil ls &rest more) (do ((ls ls (cdr ls)) (more more (mapcar #'cdr more)) (knil knil (apply kons (apply #'list (car ls) (append (mapcar #'car more) (list knil)))))) ((null ls) knil))) (defun fold-right (kons knil ls &rest more) (apply #'fold kons knil (reverse ls) (mapcar #'reverse more)))
(defun mkstr (&rest args) (with-output-to-string (dolist (a args) (princ a))))
(def:frange/current-frame arrange/bottom-right-most (nil top frange:-1) (nil left frange:-1))からは2つの関数定義が生成されるのですが、そのうちの一つを下記のように呼び出すと Emacs のフレームが右下隅に移動すると思います。
(frange:arrange/bottom-right-most/current-frame)
(frange:increment-position-left/current-frame)と呼び出すとフレームが右に少し動く、といった具合です。
(frange:restore-frame-position-parameter (selected-frame) 'example-1) (frange:restore-frame-position-parameter (selected-frame) 'example-2)を交互に実行すると、フレームのサイズが変わると思います。
(defadvice title-time-set (around title-time-set-around) (setq frame-title-format (concat "%b" " - " display-time-string))) (ad-activate 'title-time-set) (setq display-time-interval 30) (setq display-time-string-forms '((format " [ %s/%02d/%02d (%s) - %s:%s ] " year (string-to-number month)(string-to-number day) dayname 24-hours minutes))) (require 'title-time) (display-time)
;; C-c C-c : 'sql-send-paragraph ;; C-c C-r : 'sql-send-region ;; C-c C-s : 'sql-send-string ;; C-c C-b : 'sql-send-buffer (require 'sql) (add-hook 'sql-interactive-mode-hook #'(lambda () (interactive) (set-buffer-process-coding-system 'sjis-unix 'sjis-unix ) (setq show-trailing-whitespace nil))) ;; starting SQL mode loading sql-indent / sql-complete (eval-after-load "sql" '(progn (load-library "sql-indent") (load-library "sql-complete") (load-library "sql-transform"))) (setq auto-mode-alist (cons '("\\.sql$" . sql-mode) auto-mode-alist)) (sql-set-product-feature 'ms :font-lock 'sql-mode-ms-font-lock-keywords) (defcustom sql-ms-program "sqlcmd" "Command to start sqlcmd by SQL Server." :type 'file :group 'SQL) (sql-set-product-feature 'ms :sql-program 'sql-ms-program) (sql-set-product-feature 'ms :sqli-prompt-regexp "^[0-9]*>") (sql-set-product-feature 'ms :sqli-prompt-length 5) (defcustom sql-ms-login-params '(user password server database) "Login parameters to needed to connect to mssql." :type '(repeat (choice (const user) (const password) (const server) (const database))) :group 'SQL) (defcustom sql-ms-options '("-U" "-P" "-S" "-d") "List of additional options for `sql-ms-program'." :type '(repeat string) :group 'SQL) (defun sql-connect-ms () "Connect ti SQL Server DB in a comint buffer." ;; Do something with `sql-user', `sql-password', ;; `sql-database', and `sql-server'. (let ((f #'(lambda (op val) (unless (string= "" val) (setq sql-ms-options (append (list op val) sql-ms-options))))) (params `(("-U" . ,sql-user)("-P" . ,sql-password) ("-S" . ,sql-server)("-d" . ,sql-database)))) (dolist (pair params) (funcall f (car pair)(cdr pair))) (sql-connect-1 sql-ms-program sql-ms-options))) (sql-set-product-feature 'ms :sqli-login 'sql-ms-login-params) (sql-set-product-feature 'ms :sqli-connect 'sql-connect-ms) (defun run-mssql () "Run mssql by SQL Server as an inferior process." (interactive) (sql-product-interactive 'ms))
>osql -U username -S servername
>osql -U usename -S servername -d pubs -i test.sqlsqlcmd も同様。
"GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)でした。
of 2010-07-02 on YAMALOK"
(require 'japanese-holidays) (setq calendar-holidays (append japanese-holidays local-holidays other-holidays)) (setq calendar-weekend-marker 'diary) (add-hook 'today-visible-calendar-hook 'calendar-mark-weekend) (add-hook 'today-invisible-calendar-hook 'calendar-mark-weekend) ;; --- calfw --- ;; (cfw:open-calendar-buffer) ;; (cfw:contents-debug-data) ;; face (custom-set-faces '(cfw:face-title ((t (:foreground "darkgoldenrod3" :weight bold :height 2.0 :inherit variable-pitch)))) '(cfw:face-header ((t (:foreground "maroon2" :weight bold)))) '(cfw:face-sunday ((t :foreground "red" :weight bold))) '(cfw:face-saturday ((t :foreground "blue" :weight bold))) '(cfw:face-holiday ((t :background "grey10" :foreground "purple" :weight bold))) '(cfw:face-default-content ((t :foreground "green2"))) '(cfw:face-regions ((t :foreground "cyan"))) '(cfw:face-day-title ((t :background "grey10"))) '(cfw:face-today-title ((t :background "red4" :weight bold))) '(cfw:face-today ((t :foreground: "cyan" :weight bold))) '(cfw:face-select ((t :background "blue4"))) ;; '(cfw:face-grid ((t :foreground "DarkGrey"))) ;; '(cfw:face-default-day ((t :weight bold :inherit cfw:face-day-title))) ;; '(cfw:face-annotation ((t :foreground "RosyBrown" :inherit cfw:face-day-title))) ) (require 'calfw) (require 'calfw-ical) (defvar cfw:ical-url '("http://www.google.com/calendar/ical/---hoge---/basic.ics")) (setq cfw:ical-calendar-contents-sources cfw:ical-url) ;; (setq cfw:ical-calendar-annotations-sources cfw:ical-url) (cfw:install-ical-schedules) ;; (setq calendar-month-name-array ;; ["January" "February" "March" "April" "May" "June" ;; "July" "August" "September" "October" "November" "December"]) ;; (setq calendar-day-name-array ;; ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"]) ;; (setq calendar-week-start-day 0)
継続の実装は、何を重視するかでかなり違ってくるせいでしょうね。
full continuationの実装は、スタックエリアのコピーという観点
から見ると、次のように分類されます。
(1) 継続作成時にスタックからヒープへのコピーを行い、
継続呼び出し時にヒープからスタックへのコピーを行う
(2) 継続作成時にスタックからヒープへのコピーを行うが、
継続呼び出し時にはコピーを行わない
(3) 継続作成時にはコピーを行わず、
継続呼び出し時にコピーを行う
(4) 継続作成時にも継続呼び出し時にもコピーは行わない
guileやSCMは(1)のタイプです。このタイプは、CとSchemeの
スタックが自由にインターリーブできるのが特徴です(Scheme
ルーチンから呼んだCルーチンからさらにSchemeルーチンを
簡単に呼べる)。したがってC APIが単純になります。また、
スタックエリアのGCを必要としません。しかしコピーの回数が
多いため、継続は非常に重くなります。
SCMよりguileがかなり重いのは何故だかわかりません。
Gaucheは(2)の方法を利用しています。(1)と同様にスタック
エリアのGCが不要で、コピーの回数が少ないのが特徴です。
しかし、呼ばれない継続でも作られる時点でコピーする必要が
あるのであまり良い方法ではないです。将来、スタックエリア
のGCを実装できたら(3)か(4)に移りたいと考えています。
(3)はChez Schemeへの実装の論文があります。Petite Chez
Schemeで使われているかどうかは知りませんが、おそらく
使われているんではないでしょうか。スタックエリアのGCと、
スタックアンダーフローを検出する一種のバリアが必要です。
継続の作成はほぼノーコストです。継続の呼び出しには若干の
オーバヘッドがあります。
(4)は実装技術的にはさらに2つに分かれます。継続を全て
ヒープアロケートする方法と、スタックフレームをポップしない
方法です。完全なcontinuation passing styleなので、
継続の作成、起動ともに理論上ノーコストでできる方法です。
しかし、継続を全てヒープアロケートするのはメモリアクセスの
ローカリティが悪く、最近のCPUでは不利になります。
Chickenは後者の方法 (ポップしないスタックフレーム)を使って
います。理屈の上ではこれが一番良い方法のはずですが、スタック
エリアのGC回数が(3)よりずっと多くなるため、総合的な性能で
比較すると微妙なところです。
--shiro
/ssh:[email protected]#22:~/.emacsとか
/plink:[email protected]#22:~/cap/dev/js/hello.jsというように入力すると、ssh で入って編集するようなサーバのファイルを手元の emacs からローカルファイルを扱うかのように編集できたりします。
$ LANG=C ./configure --prefix=/cygdrive/c/emacs/tramp --with-emacs=/cygdrive/c/emacs/bin/emacs --with-lispdir=/cygdrive/c/emacs/site-lisp/tramp $ LANG=C make $ make installで完了。
(prefer-coding-system 'utf-8-unix) (modify-coding-system-alist 'process "plink" 'utf-8-unix) (setenv "PATH" (apply #'concat `(,@(intersperse ";" (expand-file-names "~/../Program Files/PuTTY" "~/../Program Files/PuTTY" "~/../Program Files/PuTTY" "~/../Program Files/PuTTY" "~/../cygwin/usr/local/bin" "~/../cygwin/usr/bin" "~/../cygwin/bin")) ,(getenv "PATH")))) (require 'tramp) (setq tramp-debug-buffer t) (setq tramp-completion-without-shell-p t) (setq tramp-shell-prompt-pattern "^[ $]+") (defvar tramp-ssh-ppk (expand-file-name "~/.ssh/private-key.ppk")) (defvar tramp-serversman `("serversman" (tramp-login-program "plink") (tramp-login-args (("%h") ("-l" "%u") ("-P" "%p") ("-ssh") ("-i" ,tramp-ssh-ppk))) (tramp-remote-sh "/bin/sh") (tramp-copy-program nil) (tramp-copy-args nil) (tramp-copy-keep-date nil) (tramp-password-end-of-line "xy") (tramp-default-port 22))) (add-to-list 'tramp-methods tramp-serversman)
/serversman:[email protected]#22:~/cap/dev/js/hello.jsポートの指定の仕方がわからず四苦ハックしました。。
(defun expand-file-names (&rest rpaths) (mapcar #'(lambda (rpath) (expand-file-name rpath)) rpaths)) (defun pair-fold1 (proc seed ls) (loop for e on ls by #'cdr for acc = (funcall proc ls seed) then (funcall proc e acc) finally (return acc))) (defun single? (ls) (and (not (null ls)) (null (cdr ls)))) (defun intersperse (item ls) (pair-fold1 #'(lambda (pr acc) (if (single? pr) (cons (car pr) acc) (cons item (cons (car pr) acc)))) '() (reverse ls)))
plink -ssh -P port -i private-key.ppk [email protected]