This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; -*- 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; @@@ 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 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'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; | |
;;; my-cursor.l | |
;;; | |
;;; | |
;;; point value | |
;;; | |
(defun point-bol () | |
"return point which represents beginning-of-line at point." | |
(save-excursion (progn (beginning-of-line) (point)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 "\\") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; @@@ my-grep | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(provide "my-grep") | |
(require "grep") | |
(require "grepd") | |
(require "errors-mod") | |
(in-package "editor") | |
(export '(*my-grep-ignore-pattern*)) |