@number23_cn

  • Archive
  • RSS
  • Ask me anything

Documentation look up

slime-tips:

C-c C-d h  looks up documentation in CLHS. But it works only on symbols, so there are two more bindings:
C-c C-d #  for reader macros
C-c C-d ~  for format directives

Other bindings which may be useful:
C-c C-d d  describes a symbol using DESCRIBE
C-c C-d f  describes a function using DESCRIBE

  • 1 year ago > slime-tips
  • 6
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

equal

EQ is true for identical symbols
EQL is also true for identical numbers and characters
EQUAL is usually true for things that print the same
EQUALP ignores number type and character case

  • 1 year ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

my .emacs

(set-language-environment 'Chinese-GB)
(set-keyboard-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-selection-coding-system 'utf-8)
(modify-coding-system-alist 'process "*" 'utf-8)
(setq default-process-coding-system '(utf-8 . utf-8))
(setq-default pathname-coding-system 'utf-8)
(set-file-name-coding-system 'utf-8)
(setq ansi-color-for-comint-mode t)

(global-set-key (kbd "C-SPC") 'nil)
(setq default-directory "~/")
(fset 'yes-or-no-p 'y-or-n-p)
(setq visible-bell t)
(setq inhibit-startup-message t)
(setq gnus-inhibit-startup-message t)

;;(setq make-backup-files nil)
;;(setq-default make-backup-files nil)
(setq backup-directory-alist (quote (("." . "~/backups"))))
(setq version-control t)
(setq kept-old-versions 2)
(setq kept-new-versions 3)
(setq delete-old-versions t)
(setq backup-directory-alist '(("." . "~/backups")))
(setq backup-by-copying t)
(setq auto-save-default nil)

(setq user-full-name "N23")
(setq user-mail-address "number23.cn@gmail.com")

(display-time-mode t)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq display-time-interval 10)

(set-foreground-color "grey")
(set-background-color "black")
(set-cursor-color "gold1")
(set-mouse-color "gold1")

(setq default-major-mode 'text-mode)
(setq default-fill-column 80)
(show-paren-mode t)
(column-number-mode t)
(setq show-paren-style 'parenthesis)
(setq frame-title-format "emacs@%b")
(setq global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(setq font-lock-global-modes '(not shell-mode text-mode))
(setq font-lock-verbose t)
(setq font-lock-maximum-size '((t . 1048576) (vm-mode . 5250000)))
(setq auto-image-file-mode t)
(setq x-select-enable-clipboard t)
(setq mouse-yank-at-point t)
(setq scroll-margin 3 scroll-conservatively 10000)
(setq enable-recursive-minibuffers t)
(setq kill-ring-max 200)
(setq-default require-final-newline t)
(add-hook 'before-save-hook 'delete-trailing-whitespace)

(setq-default indent-tabs-mode nil)
(setq default-tab-width 4)
(setq tab-stop-list ())

(setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq sentence-end-double-space nil)

(set-scroll-bar-mode nil)
;;(customize-set-variable 'scroll-bar-mode 'right)

(if (eq system-type 'darwin)
  (progn
    (setq ns-pop-up-frames nil)
    (set-frame-font  "Monaco:style=Roman:size=16")))

(if (eq system-type 'gnu/linux)
  (progn
    (tool-bar-mode nil)
    (set-default-font "YaHei Consolas Hybrid-12")))

(add-to-list 'load-path' "~/.emacs.d/site-lisp")
(require 'color-theme)
(color-theme-classic)
(require 'calendar-setting)

(defun copy-lines (&optional arg)
  (interactive "P")
  (save-excursion
    (beginning-of-line)
    (set-mark (point))
    (next-line arg)
    (kill-ring-save (mark) (point))))

(global-set-key (kbd "C-c C-w") 'copy-lines)
(global-set-key (kbd "M-d") 'kill-whole-line)
(global-set-key (kbd "C-c C-j") 'join-line)

(load (expand-file-name "~/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "/usr/local/bin/ccl")
(setq common-lisp-hyperspec-root "http://127.0.0.1/docs/HyperSpec-7-0/HyperSpec/")

(defun lisp-indent-or-complete (&optional arg)
  (interactive "P")
  (if (or (looking-back "^\\s-*") (bolp))
      (call-interactively 'lisp-indent-line)
      (call-interactively 'slime-indent-and-complete-symbol)))

(eval-after-load "lisp-mode"
  '(progn
     (define-key lisp-mode-map (kbd "TAB") 'lisp-indent-or-complete)))

;; w3m
(if (eq system-type 'gnu/linux)
  (progn
    (autoload 'w3m "w3m" "Interface for w3m on Emacs." t)
    (autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
    (autoload 'w3m-search "w3m-search" "Search words using emacs-w3m." t)
    (setq browse-url-browser-function 'w3m-browse-url)
    (setq w3m-command-arguments '("-cookie" "-F"))
    (setq w3m-use-cookies t)
    (setq w3m-home-page "http://www.google.com/")
    (require 'mime-w3m)
    (setq w3m-default-display-inline-image t)
    (setq w3m-default-toggle-inline-images t)))

;; python-mode
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist(cons '("python" . python-mode)
                             interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
;;(setq py-python-command "python")
;;copy pycomplete.py Pymacs into PYTHONPATH
(setq py-python-command "/usr/local/bin/pypy")
(setq-default py-indent-offset 4)
(setq pymacs-python-command py-python-command)
(autoload 'pymacs-load "pymacs" nil t)
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(require 'pycomplete)

;; Automatic start
(server-start)
(slime)

下載

SLIME很爽,可以用ccl把linedit扔了,自動完成,友好的repl,Emacs 其實也不錯,之前幾次想學都冇有成功,為什麼呢?

  • 1 year ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

linedit command keys

比较有用的是:

(defcommand “Up-arrow” ‘history-previous)
(defcommand “Down-arrow” ‘history-next)
(defcommand “Right-arrow” ‘move-char-right)
(defcommand “Left-arrow” ‘move-char-left)

(defcommand “M-I” ‘describe-word)
(defcommand “C-N” ‘history-next)
(defcommand “C-P” ‘history-previous)

最爽的当然是M-I,可以查文档了,可惜还不能在CCL里使用

  • 1 year ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

autocomplete in ccl

在众多的Common Lisp中只有clisp自带了readline,其他的如 ccl, sbcl 都没有,

不过还好有rlwrap,可以方便实现tab autocomplete, history,下面是CCL的wrapper:

#!/bin/sh
BREAK_CHARS="(){}[],^%$#@\"\";''|\\"
RLWRAP="rlwrap -pgreen -r -m -i --history-filename=$HOME/.ccl_history --histsize=1000000 -c -b $BREAK_CHARS -f $HOME/.ccl_completions"

if [ -z "$CCL_DEFAULT_DIRECTORY" ]; then
  CCL_DEFAULT_DIRECTORY=$HOME/opt/ccl
fi

if [ -z "$OPENMCL_KERNEL" ]; then
  case `uname -s` in
    Darwin)
    case `arch` in
      ppc*)
      OPENMCL_KERNEL=dppccl64
      ;;
      i386|x86_64)
      OPENMCL_KERNEL=dx86cl64
      ;;
    esac
    ;;
    Linux)
    case `uname -m` in
      ppc64)
      OPENMCL_KERNEL=ppccl64
      ;;
      x86_64)
      OPENMCL_KERNEL=lx86cl64
      ;;
      *)
      echo "Can't determine machine architecture.  Fix this."
      exit 1
      ;;
    esac
    ;;
    FreeBSD)
    case `uname -m` in
      amd64)
      OPENMCL_KERNEL=fx86cl64
      ;;
      *)
      echo "unsupported architecture"
      exit 1
      ;;
    esac
    ;;
    SunOS)
    case `uname -m` in
      i86pc)
      OPENMCL_KERNEL=sx86cl64
      ;;
      *)
      echo "unsupported architecture"
      exit 1
      ;;
    esac
    ;;
    CYGWIN*)
    OPENMCL_KERNEL=wx86cl64.exe
    CCL_DEFAULT_DIRECTORY="C:/cygwin$CCL_DEFAULT_DIRECTORY"
    ;;
    *)
    echo "Can't determine host OS.  Fix this."
    exit 1
    ;;
  esac
fi

export CCL_DEFAULT_DIRECTORY

if [ $# -eq 0 ]; then
  exec $RLWRAP ${CCL_DEFAULT_DIRECTORY}/${OPENMCL_KERNEL}
else
  exec ${CCL_DEFAULT_DIRECTORY}/${OPENMCL_KERNEL} "$@"
fi

还有这是用来产生.ccl_completions的lisp code:

(let (symbols)
  (do-all-symbols (sym)
    (let ((package (symbol-package sym)))
      (cond
        ((not (fboundp sym)))
        ((or (eql #.(find-package :cl) package)
             (eql #.(find-package :cl-user) package))
         (pushnew (symbol-name sym) symbols))
        ((eql #.(find-package :keyword) package)
         (pushnew (concatenate 'string ":" (symbol-name sym)) symbols))
        (package
          (pushnew (concatenate 'string (package-name package)
                               ":"
                               (symbol-name sym))
                  symbols)))))
  (with-open-file (output (merge-pathnames ".ccl_completions" (user-homedir-pathname))
                          :direction :output :if-exists :overwrite
                          :if-does-not-exist :create)
    (format output "~{~(~A~)~%~}" (sort symbols #'string<))))

用同样的方法当然也可以为sbcl弄一个wrapper,sbcl 还有另一个选择: http://common-lisp.net/project/linedit/

  • 1 year ago
  • 1
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

转:与时俱进的代码

xu-zhe:

try {

    if (you.believe(it) == true || you.believe(it) == false) {

        I.believe(it);

    }

} catch (Exception e) {

    throw new Exception(“It’s a miracle!”);

} finally {

    It.justHappened();

}

  • 1 year ago > xu-zhe
  • 2
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

my favorite tv program on Youtube

Shell:~ >: task list youtube

ID Project Pri Due Active Age   Description                                                                               
10                        1 day YouTube: http://youtu.be
                                8/3/2011 http://rthk.hk
                                8/3/2011 頭條新聞 http://bit.ly/nmXchm
                                8/3/2011 鏗鏘集 http://bit.ly/oVAGgD
                                8/3/2011 http://tvb.com
                                8/3/2011 新聞透視 http://bit.ly/ruoZfl
                                8/3/2011 星期日檔案 http://bit.ly/nWLkTo
                                8/3/2011 http://www.ctitv.com.tw
                                8/3/2011 文茜世界週報 http://bit.ly/oxphjF
                                8/3/2011 全民最大黨 http://bit.ly/p2plpc
                                8/3/2011 康熙來了 http://bit.ly/nu2Rdu
                                8/3/2011 今晚哪裏有問題 http://bit.ly/nr3ulm
                                8/4/2011 youtube-dl format values:
                                8/4/2011 WebM video at 480p: 43
                                8/4/2011 WebM video at 720p: 45
                                8/4/2011 H264 video in MP4 container at 480p: 18
                                8/4/2011 H264 video in MP4 container at 720p: 22
                                8/4/2011 H264 video in MP4 container at 1080p: 37
                                8/4/2011 H264 video in FLV container at 360p: 34
                                8/4/2011 H264 video in FLV container at 480p: 35
                                8/4/2011 H263 video at 240p: 5
                                8/4/2011 3GP video: 17
                                8/4/2011 http://en.wikipedia.org/wiki/YouTube : youtube-dl —all-formats —get-filename URL

1 task
Shell:~ >:

  • 1 year ago
  • 1
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

a task

Shell:~ >: task list lisp

ID Project  Pri Due Active Age     Description                                                                      
 6 mac      H              10 mins install clisp, sbcl on mac                                                       
 4 Learning                  2 hrs Common Lisp                                                                      
                                   6/17/2011 Homepage: http://www.clisp.org                                         
                                   6/17/2011 Quicklisp is a library manager for Common Lisp: http://www.quicklisp.org
                                   6/17/2011 Steel Bank Common Lisp (SBCL) is a high performance Common Lisp compiler
                                   6/17/2011 http://www.sbcl.org                                                    
                                   6/17/2011 http://common-lisp.net                                                 
                                   6/17/2011 http://lisp.org.cn                                                     

2 tasks

  • 2 years ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Object.clone

Object.clone = function (o) {    var obj = Object.create(Object.getPrototypeOf(o)),        prop = Object.getOwnPropertyNames(o);        for (var i = prop.length, p; i--;) {        p = prop[i];        Object.defineProperty(obj, p, Object.getOwnPropertyDescriptor(o, p));    }    return obj;};
view raw gistfile1.js This Gist brought to you by GitHub.

  • 2 years ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Nodejs git url

Shell:~/gitroot >: ./checkout.sh | column -t
colors.js           :  https://github.com/Marak/colors.js.git
connect             :  https://github.com/senchalabs/connect.git
ejs                 :  https://github.com/visionmedia/ejs.git
express             :  https://github.com/visionmedia/express.git
git-extras          :  https://github.com/visionmedia/git-extras.git
git-reference       :  https://github.com/schacon/git-reference.git
html5               :  https://github.com/aredridel/html5.git
jade                :  https://github.com/visionmedia/jade.git
jquery              :  https://github.com/jquery/jquery.git
jsdom               :  https://github.com/tmpvar/jsdom.git
node                :  https://github.com/joyent/node.git
no.de               :  https://github.com/jsjohnst/no.de.git
node-amqp           :  https://github.com/ry/node-amqp.git
node-htmlparser     :  https://github.com/tautologistics/node-htmlparser.git
node.io             :  https://github.com/chriso/node.io.git
node_mdns           :  https://github.com/agnat/node_mdns.git
node-mysql          :  https://github.com/felixge/node-mysql.git
node-optimist       :  https://github.com/substack/node-optimist.git
nodester            :  https://github.com/nodester/nodester.git
npm                 :  https://github.com/isaacs/npm.git
npmdep              :  https://github.com/substack/npmdep.git
npmtop              :  https://github.com/substack/npmtop.git
npm-zsh-completion  :  https://github.com/kuno/npm-zsh-completion.git
request             :  https://github.com/mikeal/request.git
Socket.IO-node      :  https://github.com/LearnBoost/Socket.IO-node.git
underscore          :  https://github.com/documentcloud/underscore.git

  • 2 years ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+
Page 1 of 2
← Newer • Older →

About

a programmer

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile
Effector Theme by Pixel Union