Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
;;; misc-funcs.el --- miscellaneous functions ;; Copyright (C) 1999-2001 YAMASHITA Junji ;; Author: YAMASHITA Junji ;; Keywords: misc ;; Version: $Id: misc-funcs.el,v 1.18 2002/04/06 10:01:43 ysjj Exp $ ;; Content-Type: text/plain; charset=iso-2022-jp ;; Commentary: ;;; Code: (when (boundp 'my-cygwin-dir) (unless (file-directory-p my-cygwin-dir) (message "Warning: %s isn't exist or not directory." my-cygwin-dir)) (defsubst my-cygwin-file (file-name) "concat `my-cygwin-dir', \"/\" and FILE-NAME." (concat my-cygwin-dir "/" file-name))) (defsubst my-edata-file (file-name) "Concat `my-emacs-dir', \"/etc/\" and FILE-NAME." (concat my-emacs-dir "/etc/" file-name)) (defsubst my-elisp-file (file-name) "Concat `my-elisp-dir', \"/\" and FILE-NAME." (concat my-elisp-dir "/" file-name)) (defsubst my-site-lisp (file-name) "Concat `my-emacs-dir', \"/site-lisp/\" and FILE-NAME." (concat my-emacs-dir "/site-lisp/" file-name)) (defun my-forms-find-file (forms-fn) "Wrap the `forms-find-file' to set default directory." (interactive (list (read-file-name "Forms file: " (concat my-emacs-dir "/etc/forms/")))) (forms-find-file forms-fn)) (defun my-isearch-backward-other-window (arg) "Do incremental search backward on the ARG'th different window of this frame." (interactive "p") (save-excursion (other-window arg) (isearch-backward) (other-window (- arg)))) (defun my-isearch-forward-other-window (arg) "Do incremental search forward on the ARG'th different window of this frame." (interactive "p") (save-excursion (other-window arg) (isearch-forward) (other-window (- arg)))) (defun my-isearch-backward-regexp-other-window (arg) "Do incremental search backward for regular expression on the ARG'th different window of this frame. Like ordinary incremental search except that your input is treated as a regexp" (interactive "p") (save-excursion (other-window arg) (isearch-backward-regexp) (other-window (- arg)))) (defun my-isearch-forward-regexp-other-window (arg) "Do incremental search forward for regular expression on the ARG'th different window of this frame. Like ordinary incremental search except that your input is treated as a regexp" (interactive "p") (save-excursion (other-window arg) (isearch-forward-regexp) (other-window (- arg)))) (if (fboundp 'show-message-log) (defalias 'my-show-message-log 'show-message-log) (defun my-show-message-log () "Show the \"*Messages*\" buffer, which contains old messages and errors." (interactive) (pop-to-buffer (get-buffer "*Messages*")))) ;; (defun cyclic-windows (arg) (interactive "p") (let ((window-buffer-save (window-buffer)) (selected-window-save (selected-window)) other-window-save other-window-buffer-save) (other-window arg) (setq other-window-buffer-save (window-buffer)) (set-window-buffer (selected-window) window-buffer-save) (set-window-buffer selected-window-save other-window-buffer-save))) ;; (defvar frame-min-width (* 2 window-min-width)) (defvar frame-min-height (* 2 window-min-height)) (defun set-current-frame-width (cols) (interactive "Nframe width: ") (and (< cols frame-min-width) (setq cols frame-min-width)) (set-frame-width nil cols)) (defun set-current-frame-height (lines) (interactive "Nframe height: ") (and (< lines frame-min-height) (setq lines frame-min-height)) (set-frame-height nil lines)) ;; (defun set-cursor-type (cursor-type) "Set the text cursor type of the selected frame to type. When called interactively, prompt for the type to use. To get the frame's current cursor type, use `frame-parameters'." (interactive "sCursor type: ") (if (stringp cursor-type) (setq cursor-type (intern cursor-type))) (or (memq cursor-type '(box bar)) (error (format "%s: cursor type should be `box' or `bar'" cursor-type))) (modify-frame-parameters (selected-frame) (list (cons 'cursor-type cursor-type)))) ;; (defun toggle-tab-width (arg) "*Toggle `tab-width' between 4 and 8. With arg, set `tab-width' to 4 if and only if arg is positive." (interactive "P") (let ((width (if (integerp arg) (if (> arg 0) 4 8) (if (eq 8 tab-width) 4 8)))) (set (make-local-variable 'tab-width) width) (set (make-local-variable 'tab-stop-list) nil) (let ((n width) (max 132)) (while (<= n max) (setq tab-stop-list (nconc tab-stop-list (list n)) n (+ n width)))) (force-mode-line-update) (if (interactive-p) (message "Set tab width to %d." width)))) ;; (defsubst coding-category-sjis-p (coding-system) (and coding-system (eq (coding-system-category (coding-system-base coding-system)) 'coding-category-sjis))) ;; (defun ascii-region (beg end) (interactive "r") (let ((buffer-read-only nil) (buffer-modified (buffer-modified-p)) (ascii-string (apply 'string (mapcar #'(lambda (char) (condition-case nil (make-char 'ascii (char-codepoint char)) (error char))) (string-to-list (buffer-substring beg end)))))) (save-excursion (delete-region beg end) (goto-char beg) (insert ascii-string) (set-buffer-modified-p buffer-modified)))) ;; ps-print (defun ps-set-style-internal (values) (let (sym val) (while (setq sym (car values)) (setq val (cadr values)) (set sym val) (setq values (cddr values))))) (defun ps-set-style (stylename) (interactive (list (completing-read "Which style? " ps-style-alist nil t nil 'ps-set-style-history))) (and (symbolp stylename) (setq stylename (symbol-name stylename))) (let ((values (cdr (or (assoc stylename ps-style-alist) (error (format "%s: no such style" stylename)))))) (or (string-equal stylename "default") (ps-set-style-internal (cdr (assoc "default" ps-style-alist)))) (ps-set-style-internal values))) ;; search-url (defun search-url (search-url word) (browse-url (concat search-url (or word (read-from-minibuffer "Search word: " (thing-at-point 'word)))))) ;; foldoc (defun foldoc-search (&optional word) (interactive "P") (search-url "http://www.foldoc.org/?" word)) ;; wdic (defun wdic-search (&optional word) (interactive "P") (search-url "http://www.wdic.org/?word=" word)) ;; netnews (defun groups-search (&optional word) (interactive "P") (search-url "http://groups.google.com/groups?q=" word)) ;; fj (defun fj-search (&optional word) (interactive "P") (search-url "http://queen.heart.ne.jp/cgi-bin/queen4?msgid=" word)) ;; hi-whitespace (when (boundp 'hi-lock-mode) (defvar hi-space-face 'hi-blue) (defvar hi-wspace-face 'hi-green) (defvar hi-tab-face 'hi-pink) (defun hi-whitespace-mode (&optional arg) (interactive) (or (local-variable-p 'hi-lock-mode) (make-local-variable 'hi-lock-mode)) (if (interactive-p) (call-interactively 'hi-lock-mode) (hi-lock-mode arg)) (if hi-lock-mode (hi-lock-set-patterns `((" " (0 (quote ,hi-space-face) append)) (" " (0 (quote ,hi-wspace-face) append)) ("\t" (0 (quote ,hi-tab-face) append)))))) (defalias 'blank-mode (symbol-function 'hi-whitespace-mode))) (defun toggle-gnuserv () "Start and/or shutdown gnuserv. " (interactive) (if (and (boundp 'gnuserv-process) gnuserv-process) (gnuserv-shutdown) (gnuserv-start)) (if (interactive-p) (message "gnuserv is %s" (if gnuserv-process "started" "shutdown")))) (defsubst my-make-from (address &optional ja) (concat user-full-name (and ja (concat " (" user-full-name-ja ")")) " <" address ">")) (defsubst my-make-signature (address &optional ja) (concat "-- \n" (if ja user-full-name-ja user-full-name) "\tmailto:" address "\n")) ;;; misc-funcs.el ends here