Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@hidsh
hidsh / reb.py
Created February 21, 2012 05:49
python tiny regular expression utility which is aimed to be re-builder on emacs
# reb.py - tiny regular expression utility which is aimed to be re-builder
#
# NOTE: on IDLE, you can copy'n paste following lines for ease to use.
""" -- FOR IDLE --
import sys
sys.path.append('d:\\g\\py')
from reb import reb
"""
import re
@hidsh
hidsh / in-discrete.l
Created February 22, 2012 06:41
bak for xyzzy
(defun bak ()
(interactive)
(if (get-buffer-file-name)
(call-interactively #'(lambda (name)
(interactive "FBAK as: " :default0 (concat
(get-buffer-file-name)
".bak"))
(write-file name)))
(call-interactively 'save-buffer)))
@hidsh
hidsh / py-mode.l
Created February 28, 2012 00:52
xyzzy py-mode mod
;;; -*- Mode: Lisp; Last updated: "2007/04/07" -*-
;;;
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
@hidsh
hidsh / obj-set.py
Created February 28, 2012 02:14
python test: set of class object
# test: set of class object
class part():
def __init__(self, name='unknown', val=100, flag=False):
self.name = name
self.val = val
self.flag = flag
def __eq__(self, other):
if isinstance(other, str):
return self.name==other
@hidsh
hidsh / class_test3.py
Created February 28, 2012 08:12
python test __setattr_()
# test: set of class object
class part(object):
def __init__(self, name='unknown', val=100, flag=False):
self.name = name
self.val = val
self.flag = flag
def __setattr__(self, name, value):
if name=='name':
# if isinstance(value, str): self.__dict__[name] = value
if isinstance(value, str): object.__setattr__(self, name, value)
@hidsh
hidsh / in-discrete.l
Created March 7, 2012 00:20
xyzzy ウィンドウ最大化、トグル
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; @@@ maximize-xyzzy
;;; http://plaza.umin.ac.jp/~takeshou/xyzzy/setting.html
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require "wip/winapi")
(c:define-dll-entry winapi:BOOL ShowWindow (winapi:HWND c:int) "user32")
;; ウィンドウ最大化
(defun maximize-xyzzy ()
(interactive)
@hidsh
hidsh / gist:1997781
Created March 8, 2012 01:16
python dictionary filter test
>>> dk = {'a':'0001', 'b':'0300', 'c':'0000', 'd':'0002', 'x':'0000'}
>>> dict((k,v) for k, v in dk.iteritems() if v=='0000')
{'x': '0000', 'c': '0000'}
>>> [k for k, v in dk.iteritems() if v=='0000']
['x', 'c']
@hidsh
hidsh / my-cursor.l
Created March 14, 2012 08:34
xyzzy my-cursor
;;;
;;; my-cursor.l
;;;
;;;
;;; point value
;;;
(defun point-bol ()
"return point which represents beginning-of-line at point."
(save-excursion (progn (beginning-of-line) (point))))
@hidsh
hidsh / discrete.l
Created March 21, 2012 07:39
xyzzy: replace '/' <--> '\' at current line (for path string win and linux)
(defun slash-to-backslash-line ()
"replace '/' <--> '\' at current line. (toggle)"
(interactive)
(save-excursion
(let ((eol (progn (goto-eol) (point)))
(bol (progn (goto-bol) (point))))
(save-restriction
(narrow-to-region bol eol)
(let (from to)
(cond ((looking-for "\\") (setq from "\\")
@hidsh
hidsh / my-grep.l
Created April 3, 2012 04:09
xyzzy: my-grep
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; @@@ my-grep
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(provide "my-grep")
(require "grep")
(require "grepd")
(require "errors-mod")
(in-package "editor")
(export '(*my-grep-ignore-pattern*))