all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to click on file in file manager and have gnuclientw open it up
@ 2007-03-02  1:10 William M. Grove
  2007-03-02 16:04 ` weber
  2007-03-02 21:48 ` james
  0 siblings, 2 replies; 3+ messages in thread
From: William M. Grove @ 2007-03-02  1:10 UTC (permalink / raw)
  To: help-gnu-emacs

I use Explorer and other file manager programs (Directory Opus, 
Powerdesk) to browse directory trees in WinXP.  I have associated 
certain file types (e.g., *.r files) with gnuclientw.exe in Windows.  
When I click on an *.r file, gnuclientw starts up and opens a window, 
but the contents of the window are blank (or they show the last file I 
edited in emacs, if I didn't close it out before exiting emacs)---emacs 
doesn't show my the *.r file I clicked on, the way other editing 
programs for Windows will do if they are associated with that file type.  
How can I fix this?  It's tedious to have to start up gnuclientw.exe (or 
runemacs.exe), then use File | Open | etc. to browse down through the 
directory tree to the file's location and open it, or even just do Ctrl-
f and type in the whole path to visit the file in question.

Here is my .emacs file, which tries to start gnuserv.exe up so 
gnuclientw.exe and it are in client-server relationship.  Alas, the 
arrangement isn't working---gnuserv isn't showing up in Task Manager.  I 
am guessing this problem has something to do with my "file clicked on 
doesn't show up in emacs window" problem.

****************** start of .emacs file ********************
;;File:       GROVE-HOME//~/.emacs
;;Author:     William M. Grove
;;Email:      grove001@umn.edu
;;last mod.:  04.06.2005 20:59

(setq debug-on-error t) ; this way no mystery derailments

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                        S T A R T U P
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Don't show splash screen
(setq inhibit-startup-message t)

(message "Loading .emacs")

;; Hundreds of times the default value.  This significantly speeds 
;;    up startup and operations for my computer without crashes
(setq gc-cons-threshold 50000000)

;; set up minibuffer size & location
(setq initial-frame-alist '((minibuffer . t) (name . "William M. Grove") 
(width . 100) (height . 35) (left . 5) (top . 5)))
(setq default-frame-alist '((minibuffer . t) (menu-bar-lines . 1) 
(width. 75) (height . 23)))

;; Set titles for main frame and icon (%f == file name, 
;;    %b == buffer name)
(setq-default frame-title-format (list "Emacs: %f"))
(setq-default icon-title-format "Emacs - %b")

;; location of initial frame
(set-frame-position (selected-frame) 0 0)

;; size of initial frame
(if (window-at 0 0)
    (let ((init-frame (window-frame (window-at 0 0))))
          (set-frame-height init-frame 74)
        (set-frame-width  init-frame 180) )
)

;; Make all "yes or no" prompts show "y or n" instead
(fset 'yes-or-no-p 'y-or-n-p)

(setq my-author-name (getenv "USER"))
(setq user-full-name (getenv "USER"))
(setq default-directory (getenv "HOME"))
;; Start off in user's home directory
(cd (getenv "HOME"))

;; Set my email address for whatever purpose
(setq user-mail-address "grove001@umn.edu")
;; add signature automagically
(setq mail-signature t)

;; Contents of mode line
(line-number-mode 1)
(setq column-number-mode t)
;; show current function
(which-func-mode t)                 

;;; Modeline stuff
(setq default-mode-line-format
      '("-"
;;     mode-line-mule-info
       mode-line-modified
       mode-line-frame-identification
       mode-line-buffer-identification
       "  "
       global-mode-string
       "   %[(" mode-name mode-line-process minor-mode-alist "%n" 
")%]--"
       (line-number-mode "L%l--")
       (column-number-mode "C%c--")
       (-3 . "%p")
       "-%-"))

(set-default 'truncate-lines t)
;; Even though we truncate long lines, I'd like to be able to see 
;;    what I'm missing
(require 'auto-show)
(auto-show-mode 1)
(setq-default auto-show-mode t)
;; Display time in mode line
(setq display-time-day-and-date t)
(display-time)

;; tabs, default color scheme
(setq default-tab-width 3)
(setq-default tab-stop-list; globally set tab stops default
   '(4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67
     70 73 76 79 82 85 88 91 94 97 100 103 106 109 112 115 118))
(defvar tabs-are-spaces nil
  "*If set, replace all tabs with equivalent spaces.  Automatically
buffer-local when set.")
(make-variable-buffer-local 'tabs-are-spaces)

;; Color theme
;; load before all the color stuff happens below
(load-library "color-theme")
(add-to-list 'color-themes '(color-theme-GaryF "GaryF" "Gary Fong 
<gwfong@hotmail.com>"))

;; If you want to have comments displayed in italics, uncomment the
;; following lines. Note that this must be done before font settings!
(setq w32-enable-italics t)
(make-face-italic 'font-lock-comment-face)

;; This loads file to highlight current line
;; Author:  Dave Love <fx@gnu.org>
(load "hl-line")
(setq hl-line-mode t)

;; Bookmarks
(setq bookmark-save-flag 1)

(setq completion-auto-help t)   ; I want as much help as I can get
(setq completion-auto-exit t)   ; Dont want to always hit return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                A B B R E V I A T I O N S
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; In abbrev mode, inserting an abbreviation causes it to expand and 
;;    be replaced by its expansion
 (setq-default abbrev-mode t)
 (quietly-read-abbrev-file "~/.abbrev_defs")
 (setq save-abbrevs t)

; Reads in an abbrev file if it exists
; C-x a i g to create an abbrev
(if (file-exists-p abbrev-file-name)
    (read-abbrev-file))
    
;; Spaces rather than spaces+tabs
(setq unicon-indent-use-only-spaces t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                    A U T O I N S E R T
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; directory with templates
(add-hook 'find-file-hooks 'auto-insert)
(load-library "autoinsert")
(setq auto-insert-directory "~/insert/")
;;; templates
(setq auto-insert-alist
      (append '((awk-mode     . "awk-insert.awk"))
      (append '((bat-mode     . "bat-insert.bat"))
      (append '((btm-mode     . "btm-insert.btm"))
      (append '((cmd-mode     . "cmd-insert.cmd"))
      (append '((fortran-mode . "fortran-insert.fortran"))
      (append '((f90-mode     . "f90-insert.f90"))
      (append '((LaTeX-mode   . "LaTeX-insert.LaTeX"))
      (append '((r-mode       . "r-insert.r"))
      (append '((s-mode       . "s-insert.s"))
      (append '((sas-mode     . "sas-insert.sas")))))))))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                       C O L O R S
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Give me colours in major editing modes

;; First set syntax highlighting, which uses color a lot
(require 'font-lock)
(global-font-lock-mode t)

;; Set the colors of the mode line
;(cond (window-system
;   (set-face-background 'modeline "yellow")
;   (set-face-foreground 'modeline "blue")
;))
;; Font-lock-mode affects colors of mode line, too
;(add-hook 'font-lock-mode-hook
;   '(lambda ()
;      (set-face-background 'modeline "Blue4")
;      (set-face-foreground 'modeline "Gold")
;      (set-face-foreground 'secondary-selection "red")
;      (set-face-background 'highlight "yellow")
;))

;; Set the wanted overall frame color style
;;(change-color-style default-color-style)

;; Background
(set-background-color "white smoke")

;; Override default text colours
(custom-set-faces
   '(font-lock-comment-face ((((class color)) (:foreground 
"firebrick"))))
  ;'(font-lock-comment-face ((((class color)) (:foreground "green4"))))
   '(region ((((class color)) (:background "wheat"))))
   '(highlight ((((class color)) (:background "green1"))))
   '(font-lock-string-face ((((class color)) (:foreground "green4"))))
   '(font-lock-keyword-face ((((class color)) (:foreground "orange"))))
   '(font-lock-type-face ((((class color)) (:foreground "blue"))))
   '(font-lock-variable-name-face ((((class color)) (:foreground 
"brown"))))
   '(font-lock-function-name-face ((((class color)) (:foreground "royal 
blue"))))
  ;'(font-lock-function-name-face ((((class color)) (:foreground 
"firebrick"))))
)

;;; Here are some color preferences.  I've spent a good deal of time
;;; adjusting color settings, trying to get it to look good and also be
;;; fairly easy to read. 
(setq default-frame-alist 
   (append default-frame-alist 
     ;'((foreground-color . "yellow")
     ;'((foreground-color . "green")
     ;'((foreground-color . "wheat")
      '((foreground-color . "black")
      '((background-color . "white smoke")
     ;'((cursor-color . "green3")))
      '((cursor-color . "blue"))))))

(set-face-foreground 'bold "yellow")
(set-face-background 'bold "grey40")

(set-face-foreground 'bold-italic "yellow green")
(set-face-foreground 'italic "yellow3")
(set-face-foreground 'region "white")
(set-face-background 'region "blue")
       
;; Load custom color theme if it exists
;(color-theme-emacs-21)
;(color-theme-subtle-blue)
;(color-theme-GaryF)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                    M I S C.    C O M M A N D S
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; WoMan stuff for reading man pages in emacs
(autoload 'woman "woman" "Decode and browse a UN*X man page." t)
(autoload 'woman-find-file "woman"
  "Find, decode and browse a specific UN*X man-page file." t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                          F A C E S
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Faces
; (set-face-foreground 'region "black")
; (set-face-background 'highlight "CadetBlue")
; (set-face-background 'secondary-selection "MediumSeaGreen")

;; New faces
(defvar font-lock-number-face 'font-lock-number-face)
(defvar font-lock-hexnumber-face 'font-lock-hexnumber-face)
(defvar font-lock-floatnumber-face 'font-lock-floatnumber-face)
(defvar font-lock-keys-face 'font-lock-keys-face)
(defvar font-lock-qt-face 'font-lock-qt-face)

(defface font-lock-number-face
  '(
    (((class grayscale) (background light)) (:foreground 
"LightGray" :bold t))
    (((class grayscale) (background dark)) (:foreground "DimGray" :bold 
t))
    (((class color) (background light)) (:background "hotpink"))
    (((class color) (background dark)) (:foreground "black" :background 
"hotpink"))
    (t (:italic t)))
  "blah"
  :group 'font-lock-highlighting-faces)

(defface font-lock-hexnumber-face
  '(
    (((class grayscale) (background light)) (:foreground 
"LightGray" :bold t))
    (((class grayscale) (background dark)) (:foreground "DimGray" :bold 
t))
    (((class color) (background light)) (:background "darkblue"))
    (((class color) (background dark)) (:foreground "black" :background 
"darkblue"))
    (t (:italic t)))
  "blah"
  :group 'font-lock-highlighting-faces)

(defface font-lock-floatnumber-face
  '(
    (((class grayscale) (background light)) (:foreground 
"LightGray" :bold t))
    (((class grayscale) (background dark)) (:foreground "DimGray" :bold 
t))
    (((class color) (background light)) (:background "darkgreen"))
    (((class color) (background dark)) (:foreground "black" :background 
"darkgreen"))
    (t (:italic t)))
  "blah"
  :group 'font-lock-highlighting-faces)

(defface font-lock-keys-face
  '(
    (((class grayscale) (background light)) (:foreground 
"LightGray" :bold t))
    (((class grayscale) (background dark)) (:foreground "DimGray" :bold 
t))
    (((class color) (background light)) (:background "yellow"))
    (((class color) (background dark)) (:foreground "black" :background 
"yellow"))
    (t (:italic t)))
  "blah"
  :group 'font-lock-highlighting-faces)

(defface font-lock-qt-face
  '(
    (((class grayscale) (background light)) (:foreground 
"LightGray" :bold t))
    (((class grayscale) (background dark)) (:foreground "DimGray" :bold 
t))
    (((class color) (background light)) (:background "brown"))
    (((class color) (background dark)) (:foreground "green" :background 
"brown"))
    (t (:italic t)))
  "blah"
  :group 'font-lock-highlighting-faces)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                      F U N C T I O N S
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; ASCII table function
(defun ascii-table ()
  "Print the ascii table. Based on a defun by Alex Schroeder 
<asc@bsiag.com>"
  (interactive)  (switch-to-buffer "*ASCII*")  (erase-buffer)
  (insert (format "ASCII characters up to number %d.\n" 254))  (let ((i 
0))
    (while (< i 254)      (setq i (+ i 1))
      (insert (format "%4d %c\n" i i))))  (beginning-of-buffer))

;; make-comment-italic
(defun make-comment-italic ()
  (interactive "*")
  (make-face-italic 'font-lock-comment-face))

;; make-comment-unitalic
(defun make-comment-unitalic ()
  (interactive "*")
  (make-face-unitalic 'font-lock-comment-face))

;; make-comment-invisible
(defun make-comment-invisible ()
  (interactive "*")
  (custom-set-faces
 '(font-lock-comment-face ((((class color)) (:foreground "white"))))))

;; make-comment-visible
(defun make-comment-visible ()
  (interactive "*")
  (custom-set-faces
 '(font-lock-comment-face ((((class color)) (:foreground "green4"))))))

;; make-comment-red
(defun make-comment-red ()
  (interactive "*")
  (custom-set-faces
 '(font-lock-comment-face ((((class color)) (:foreground "red3"))))))

(defun wrap-all-lines ()
  "Enable line wrapping"
  (interactive) ;this makes the function a command too
  (set-default 'truncate-lines nil)
)

(defun open-dot-emacs ()
  "opening-dot-emacs"
  (interactive) ;this makes the function a command too
  (find-file "~/.emacs")
)

(defun open-dot-emacs ()
  "opening-dot-emacs"
  (interactive) ;this makes the function a command too
  (find-file "~/.emacs")
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                  K E Y    B I N D I N G S
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;(global-set-key [home] 'beginning-of-line)
;;(global-set-key [end] 'end-of-line)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;             B U F F E R / F I L E    H A N D L I N G
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; syntax highlighting (font-lock)
(cond (window-system
;;     (require 'font-lock-menu) 
       (setq font-lock-maximum-decoration t) 
       (global-font-lock-mode t)        
       (setq font-lock-support-mode 'lazy-lock-mode) 
       (setq font-lock-defer-on-scrolling nil) 
       (setq font-lock-defer-on-the-fly nil) 
       (setq lazy-lock-defer-time 0)         
       (setq lazy-lock-minimum-size 10240)   
       ))

;; Getting new features into Emacs: load and autoload
;; Emacs gets built with a lot of default functionality for commonly 
;;    used functions and modes, but sometimes there is a need to 
;;    load in external Emacs LISP code to do special things; most of 
;;    this is handled automatically by Emacs such that you will only 
;;    see the messages from it when a new feature is being added.  
;;    You can add autoloads in your .emacs for features which Emacs 
;;    hasn't provided though, such as whist.el and wconfig.el in 
;;    ~gnu/emacs/local, as in the following examples
(autoload 'whist "whist" "Add history entries to a file" t)
(autoload 'wconfig-ring-save "wconfig" "Store the current window 
config." t)
 
;; Loading should be done only for functions which you intend to use
;;    every time you run Emacs; since additional features use more 
;;    memory, take more time for Emacs to start-up and can slow down 
;;    the overall performance of the machine which Emacs is being 
;;    run on (if lots of features were added), it is better to use 
;;    autoload.  The following are loaded directly because of 
;;    actions they take when loaded.

;; recentf --- menu of recently visited files
(require 'recentf)
(recentf-mode 1)

;; This method of killing the current buffer, when bound to C-x C-c, 
;;    allows you to close an emacs frame the same way, whether it's 
;;    the sole window you have open, or whether it's a "child" frame 
;;    of a "parent" frame.  If you're like me, and use emacs in a 
;;    windowing environment, you probably have lots of frames open 
;;    at any given time.  Well, it's a pain to remember to do 
;;    Ctrl-x 5 0 to dispose of a child frame, and to remember to do 
;;    C-x C-x to close the main frame (and if you're not careful, 
;;    doing so will take all the child frames away with it).  This 
;;    is my solution to that:  an intelligent close-frame operation 
;;    that works in all cases (even in an emacs -nw session).  
(defun intelligent-close ()
  "quit a frame the same way no matter what kind of frame you are on"
  (interactive)
  (if (eq (car (visible-frame-list)) (selected-frame))
      ;;for parent/master frame...
      (if (> (length (visible-frame-list)) 1)
          ;;close a parent with children present
   (delete-frame (selected-frame))
        ;;close a parent with no children present
 (save-buffers-kill-emacs))
    ;;close a child frame
    (delete-frame (selected-frame)))
)

;; scrolling a buffer's frame just one line at a time
(setq scroll-step 1)

;; Alas, this next thing doesn't seem to work right now
(setq auto-save-directory (expand-file-name "~/autosaves/"))
(setq auto-save-interval 125)

;; Add Time-stamp <> or Time-stamp " " anywhere in the top 8 lines 
;;    of a file to insert save date and time and user:
(add-hook 'write-file-hooks 'time-stamp)
;; (add-hook 'server-visit-hook '(lambda ()
;;                                 (interactive)
;;                                 (yes-or-no-p "Hello there")))
(add-hook 'server-switch-hook 'make-frame-command)
;; (add-hook 'server-done-hook '(lambda ()
;;                                (interactive)
;;                                (if (is-buffer-a-client)
;;                                    (delete-frame))))
                                                      
;; add a comment character in front of all lines in the region
(defun ewd-comment-region (start end)
  "Add one comment character in front of all lines in the region."       
  (interactive "*r")                  
  (or comment-start (setq comment-start (read-input "Comment char?: ")))
  (ewd-prepend start end comment-start)
)
  
;; remove a comment character from in front of all lines in the region
(defun ewd-uncomment-region (start end)
  "Remove one comment character from in front of all lines in the 
region."
  (interactive "*r")                  
  (or comment-start (setq comment-start (read-input "Comment char?: ")))
  (ewd-unprepend start end comment-start)
)

(defun kill-buffer-and-window ()
  "Kill the current buffer and delete the selected window."
  (interactive)
  (let ((buffer (current-buffer)))
    (delete-window (selected-window))
    (kill-buffer buffer))
)

;; let split windows display different buffers
(defun split-window-switch-buffer () (interactive)
  "Split current window and display the two last buffers used."
  (split-window)
  (switch-to-buffer (other-buffer (current-buffer)))
)

(defun hsplit-window-switch-buffer () (interactive)
  "Split current window horizontally and display the two last buffers 
used."
  (split-window-horizontally)
  (switch-to-buffer (other-buffer (current-buffer)))
)

(defun kill-current-buffer ()
  "Kill the current buffer, without confirmation."
  (interactive)
  (kill-buffer (current-buffer))
)

(defun kill-buffer-other-window (arg)
  "Kill the buffer in the other window, and make the current buffer full 
size.  If no other window, kills current buffer."
  (interactive "p")
  (let ((buf (save-window-excursion
        (other-window arg)
        (current-buffer))))
    (delete-windows-on buf)
    (kill-buffer buf))
)

(defun kill-buffer-jump-other-window (arg)
  "Kill this buffer and jump to other window."
  (interactive "p")
    (other-window arg)
    (kill-buffer-other-window arg)
)

(fset 'scroll-cursor-to-top
   "\C-u1\C-l")

(defun Kill-Line ()
  "Kills the whole line under cursor"
  (interactive)
  (beginning-of-line)
  (kill-line)
)

;;begin buffer-switching methods, which I bind to Ctrl-TAB and 
;;   Ctrl-Shift-TAB
;; ------------------------------------------------------------------
;;     Original yic-buffer.el
;;     From: choo@cs.yale.edu (young-il choo)
;;     Date: 7 Aug 90 23:39:19 GMT
;;
;;     Modified 
;; ------------------------------------------------------------------

(defun yic-ignore (str)
  (or
   ;;buffers I don't want to switch to 
   (string-match "\\*Buffer List\\*" str)
   (string-match "^TAGS" str)
   (string-match "^\\*Messages\\*$" str)
   (string-match "^\\*Completions\\*$" str)
   (string-match "^ " str)

   ;; Test to see if the window is visible on an existing visible 
   ;;    frame.  Because I can always ALT-TAB to that visible frame, 
   ;;    I never want to Ctrl-TAB to that buffer in the current 
   ;;    frame.  That would cause a duplicate top-level buffer 
   ;;    inside two frames.
(memq str                
      (mapcar 
       (lambda (x) 
         (buffer-name 
          (window-buffer 
           (frame-selected-window x))))
       (visible-frame-list))))
)

(defun yic-next (ls)
  "Switch to next buffer in ls skipping unwanted ones."
  (let* ((ptr ls)
         bf bn go
         )
    (while (and ptr (null go))
      (setq bf (car ptr)  bn (buffer-name bf))
      (if (null (yic-ignore bn))        ;skip over
   (setq go bf)
        (setq ptr (cdr ptr))
        )
      )
    (if go
        (switch-to-buffer go)))
)

(defun yic-prev-buffer ()
  "Switch to previous buffer in current window."
  (interactive)
  (yic-next (reverse (buffer-list)))
)

(defun yic-next-buffer ()
  "Switch to the other buffer (2nd in list-buffer) in current window."
  (interactive)
  (bury-buffer (current-buffer))
  (yic-next (buffer-list))
)
;; end of yic buffer-switching methods

(autoload 'goto-last-buffer "goto-last-buffer" nil t)
(global-set-key [(control c) (b)] 'goto-last-buffer)
(global-set-key [(control c) (B)] 'buffer-menu)

;; Make region visible (only up to next operation on it)
(setq transient-mark-mode t)

;; Filename case-sensitivity.  For Windows systems only
(if (eq system-type 'windows-nt)
    (setq w32-downcase-file-names t)
)

;; Convert DOS cr-lf to UNIX newline
(defun dos-unix () (interactive) (goto-char (point-min))
  (while (search-forward "\r" nil t) (replace-match "")))

;; Convert UNIX newline to DOS cr-lf
(defun unix-dos () (interactive) (goto-char (point-min))
  (while (search-forward "\n" nil t) (replace-match "\r\n"))
)

;; Insert date into buffer
(defun insert-date ()
  "Insert date at point."
  (interactive)
  (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %z"))
)

;; some programs require this, few if any of mine are bothered by it
(setq require-final-newline t)

;;;;; rect-mark ;;;;;
;; Support for marking a rectangle of text with highlighting (rect-
mark.el).
; Only needed for emacs - xemacs has something similar built in.
; ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/
(if (boundp 'running-xemacs)
 ; Just bind mouse rectangle select similarly to rect-mark.el on GNU 
Emacs.
 ; Note you can't show a rectangular region during keyboard select -
 ; only during mouse select.
    (progn
      (global-set-key [(shift button1)] 'mouse-track-do-rectangle)
      (global-set-key (kbd "C-x r C-SPC") 'set-mark-command)
      (global-set-key (kbd "C-x r C-x") 'exchange-point-and-mark)
      (global-set-key (kbd "C-x r C-w") 'kill-rectangle)
      )
  ;(else GNU Emacs
  (progn
    (global-set-key (kbd "C-x r C-SPC") 'rm-set-mark)
    (global-set-key (kbd "C-x r C-x") 'rm-exchange-point-and-mark)
    (global-set-key (kbd "C-x r C-w") 'rm-kill-region)
    (global-set-key (kbd "C-x r M-w") 'rm-kill-ring-save)
    ;<shift>-<mouse button 1> now does a rectangular mark.
    (global-set-key [(shift down-mouse-1)] 'rm-mouse-drag-region)
    (autoload 'rm-set-mark "rect-mark"
      "Set mark for rectangle." t)
    (autoload 'rm-exchange-point-and-mark "rect-mark"
      "Exchange point and mark for rectangle." t)
    (autoload 'rm-kill-region "rect-mark"
      "Kill a rectangular region and save it in the kill ring." t)
    (autoload 'rm-kill-ring-save "rect-mark"
      "Copy a rectangular region to the kill ring." t)
    (autoload 'rm-mouse-drag-region "rect-mark"
      "Drag out a rectangular region with the mouse." t)
    )
)

;; dealing with marking, yanking rectangular regions
;;(defun option-package-start-rect-mark ()
;;  (autoload 'rm-set-mark "rect-mark"
;;    "Set mark for rectangle." t)
;;  (autoload 'rm-exchange-point-and-mark "rect-mark"
;;    "Exchange point and mark for rectangle." t)
;;  (autoload 'rm-kill-region "rect-mark"
;;    "Kill a rectangular region and save it in the kill ring." t)
;;  (autoload 'rm-kill-ring-save "rect-mark"
;;    "Copy a rectangular region to the kill ring." t)
;;  (autoload 'rm-mouse-drag-region "rect-mark"
;;    "Drag out a rectangular region with the mouse." t)
;;  (option-enable-keys 'option-keys-rect-mark-alist)
;;)
;;(defun option-package-end-rect-mark ()
;;  (option-disable-keys 'option-keys-rect-mark-alist)
;;)

;;; session management
(require 'desktop)
(load "desktop")
(desktop-load-default)
(desktop-read)

;;; misc key bindings
(global-set-key [(alt g)] 'goto-line)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;        O U T P U T    O F    M - X    C U S T O M I Z E
;;    D O    N O T    E D I T    B E L O W    T H I S    L I N E
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; 06/02/2005 1909
(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste 
it!
  ;; Your init file should contain only one such instance.
 '(abbrev-mode t)
 '(bookmark-save-flag 3)
 '(calculator-number-digits 6)
 '(case-fold-search t)
 '(current-language-environment "Latin-1")
 '(default-input-method "latin-1-prefix")
 '(explicit-shell-file-name "d:\\UWIN\\usr\\bin\\ksh.exe")
 '(global-font-lock-mode t nil (font-lock))
 '(global-hl-line-mode t nil (hl-line))
 '(hl-line-face (quote highlight))
 '(mouse-wheel-mode t nil (mwheel))
 '(msb-mode t nil (msb))
 '(only-global-abbrevs t)
 '(save-completions-retention-time 672)
 '(save-place t nil (saveplace))
 '(server-program "c:/emacs-21.3/bin/gnuserv.exe")
 '(sh-alias-alist (quote ((ksh . ksh93) (bash2 . bash) (sh5 . sh) 
(nil))))
 '(show-paren-mode t nil (paren))
 '(show-paren-ring-bell-on-mismatch t)
 '(show-paren-style (quote expression))
 '(tempo-insert-region t)
 '(tempo-interactive t))
(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 )

;; -----------------------------------------------------------------
;; AUC TeX

;(add-to-list 'load-path "d:/emacs-21.3/site-lisp/auctex/")
(add-to-list 'Info-default-directory-list "d:/emacs-21.3/site-
lisp/auctex/doc/")
(load "tex-site") 

;; -----------------------------------------------------------------
;; Reftex activation (Reftex is included with Emacs 21.1)

(autoload 'reftex-mode     "reftex" "RefTeX Minor Mode" t)
(autoload 'turn-on-reftex  "reftex" "RefTeX Minor Mode" nil)
(autoload 'reftex-citation "reftex-cite" "Make citation" nil)
(autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode

;; 
----------------------------------------------------------------------
;; Info for Ispell
(add-to-list 'Info-default-directory-list "d:/Cygwin/usr/local/info/")

;; info for Aspell
;; Enable aspell as the spell program
;; (Requires that the Aspell program and a dictionary be installed on 
the PC.
;;  Install them in: c:\Aspell
;;  Add the following to the PATH variable: c:\Aspell\bin
;;  The latest version of the Aspell program, Aspell-<version>.exe,
;;  and the dictionary of your choice, for example: aspell-en-
<version>.exe,
;;  can be found at http://aspell.net/win32/).
(setq-default ispell-program-name "aspell")

(message ".emacs loaded.")
;; EOF

(put 'downcase-region 'disabled nil)

(put 'upcase-region 'disabled nil)
****************** end of .emacs file **********************

Note: the ****start**** and ****end**** lines are _not_ part of the 
.emacs file, of course.

Thanks in advance for suggestions anyone can provide.

Sincerely,
Will Grove, a none-too-savvy emacs user

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to click on file in file manager and have gnuclientw open it up
  2007-03-02  1:10 how to click on file in file manager and have gnuclientw open it up William M. Grove
@ 2007-03-02 16:04 ` weber
  2007-03-02 21:48 ` james
  1 sibling, 0 replies; 3+ messages in thread
From: weber @ 2007-03-02 16:04 UTC (permalink / raw)
  To: help-gnu-emacs

I use Windows Xp and the EmacsW32 with emacsclient works great, does
the same thing that gnuserv I guess.
Cheers,
weber

William M. Grove escreveu:

> I use Explorer and other file manager programs (Directory Opus,
> Powerdesk) to browse directory trees in WinXP.  I have associated
> certain file types (e.g., *.r files) with gnuclientw.exe in Windows.
> When I click on an *.r file, gnuclientw starts up and opens a window,
> but the contents of the window are blank (or they show the last file I
> edited in emacs, if I didn't close it out before exiting emacs)---emacs
> doesn't show my the *.r file I clicked on, the way other editing
> programs for Windows will do if they are associated with that file type.
> How can I fix this?  It's tedious to have to start up gnuclientw.exe (or
> runemacs.exe), then use File | Open | etc. to browse down through the
> directory tree to the file's location and open it, or even just do Ctrl-
> f and type in the whole path to visit the file in question.
>
> Here is my .emacs file, which tries to start gnuserv.exe up so
> gnuclientw.exe and it are in client-server relationship.  Alas, the
> arrangement isn't working---gnuserv isn't showing up in Task Manager.  I
> am guessing this problem has something to do with my "file clicked on
> doesn't show up in emacs window" problem.
>
> ****************** start of .emacs file ********************
> ;;File:       GROVE-HOME//~/.emacs
> ;;Author:     William M. Grove
> ;;Email:      grove001@umn.edu
> ;;last mod.:  04.06.2005 20:59
>
> (setq debug-on-error t) ; this way no mystery derailments
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;                        S T A R T U P
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;; Don't show splash screen
> (setq inhibit-startup-message t)
>
> (message "Loading .emacs")
>
> ;; Hundreds of times the default value.  This significantly speeds
> ;;    up startup and operations for my computer without crashes
> (setq gc-cons-threshold 50000000)
>
> ;; set up minibuffer size & location
> (setq initial-frame-alist '((minibuffer . t) (name . "William M. Grove")
> (width . 100) (height . 35) (left . 5) (top . 5)))
> (setq default-frame-alist '((minibuffer . t) (menu-bar-lines . 1)
> (width. 75) (height . 23)))
>
> ;; Set titles for main frame and icon (%f == file name,
> ;;    %b == buffer name)
> (setq-default frame-title-format (list "Emacs: %f"))
> (setq-default icon-title-format "Emacs - %b")
>
> ;; location of initial frame
> (set-frame-position (selected-frame) 0 0)
>
> ;; size of initial frame
> (if (window-at 0 0)
>     (let ((init-frame (window-frame (window-at 0 0))))
>           (set-frame-height init-frame 74)
>         (set-frame-width  init-frame 180) )
> )
>
> ;; Make all "yes or no" prompts show "y or n" instead
> (fset 'yes-or-no-p 'y-or-n-p)
>
> (setq my-author-name (getenv "USER"))
> (setq user-full-name (getenv "USER"))
> (setq default-directory (getenv "HOME"))
> ;; Start off in user's home directory
> (cd (getenv "HOME"))
>
> ;; Set my email address for whatever purpose
> (setq user-mail-address "grove001@umn.edu")
> ;; add signature automagically
> (setq mail-signature t)
>
> ;; Contents of mode line
> (line-number-mode 1)
> (setq column-number-mode t)
> ;; show current function
> (which-func-mode t)
>
> ;;; Modeline stuff
> (setq default-mode-line-format
>       '("-"
> ;;     mode-line-mule-info
>        mode-line-modified
>        mode-line-frame-identification
>        mode-line-buffer-identification
>        "  "
>        global-mode-string
>        "   %[(" mode-name mode-line-process minor-mode-alist "%n"
> ")%]--"
>        (line-number-mode "L%l--")
>        (column-number-mode "C%c--")
>        (-3 . "%p")
>        "-%-"))
>
> (set-default 'truncate-lines t)
> ;; Even though we truncate long lines, I'd like to be able to see
> ;;    what I'm missing
> (require 'auto-show)
> (auto-show-mode 1)
> (setq-default auto-show-mode t)
> ;; Display time in mode line
> (setq display-time-day-and-date t)
> (display-time)
>
> ;; tabs, default color scheme
> (setq default-tab-width 3)
> (setq-default tab-stop-list; globally set tab stops default
>    '(4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67
>      70 73 76 79 82 85 88 91 94 97 100 103 106 109 112 115 118))
> (defvar tabs-are-spaces nil
>   "*If set, replace all tabs with equivalent spaces.  Automatically
> buffer-local when set.")
> (make-variable-buffer-local 'tabs-are-spaces)
>
> ;; Color theme
> ;; load before all the color stuff happens below
> (load-library "color-theme")
> (add-to-list 'color-themes '(color-theme-GaryF "GaryF" "Gary Fong
> <gwfong@hotmail.com>"))
>
> ;; If you want to have comments displayed in italics, uncomment the
> ;; following lines. Note that this must be done before font settings!
> (setq w32-enable-italics t)
> (make-face-italic 'font-lock-comment-face)
>
> ;; This loads file to highlight current line
> ;; Author:  Dave Love <fx@gnu.org>
> (load "hl-line")
> (setq hl-line-mode t)
>
> ;; Bookmarks
> (setq bookmark-save-flag 1)
>
> (setq completion-auto-help t)   ; I want as much help as I can get
> (setq completion-auto-exit t)   ; Dont want to always hit return
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;                A B B R E V I A T I O N S
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;; In abbrev mode, inserting an abbreviation causes it to expand and
> ;;    be replaced by its expansion
>  (setq-default abbrev-mode t)
>  (quietly-read-abbrev-file "~/.abbrev_defs")
>  (setq save-abbrevs t)
>
> ; Reads in an abbrev file if it exists
> ; C-x a i g to create an abbrev
> (if (file-exists-p abbrev-file-name)
>     (read-abbrev-file))
>
> ;; Spaces rather than spaces+tabs
> (setq unicon-indent-use-only-spaces t)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;                    A U T O I N S E R T
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;; directory with templates
> (add-hook 'find-file-hooks 'auto-insert)
> (load-library "autoinsert")
> (setq auto-insert-directory "~/insert/")
> ;;; templates
> (setq auto-insert-alist
>       (append '((awk-mode     . "awk-insert.awk"))
>       (append '((bat-mode     . "bat-insert.bat"))
>       (append '((btm-mode     . "btm-insert.btm"))
>       (append '((cmd-mode     . "cmd-insert.cmd"))
>       (append '((fortran-mode . "fortran-insert.fortran"))
>       (append '((f90-mode     . "f90-insert.f90"))
>       (append '((LaTeX-mode   . "LaTeX-insert.LaTeX"))
>       (append '((r-mode       . "r-insert.r"))
>       (append '((s-mode       . "s-insert.s"))
>       (append '((sas-mode     . "sas-insert.sas")))))))))))))
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;                       C O L O R S
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; Give me colours in major editing modes
>
> ;; First set syntax highlighting, which uses color a lot
> (require 'font-lock)
> (global-font-lock-mode t)
>
> ;; Set the colors of the mode line
> ;(cond (window-system
> ;   (set-face-background 'modeline "yellow")
> ;   (set-face-foreground 'modeline "blue")
> ;))
> ;; Font-lock-mode affects colors of mode line, too
> ;(add-hook 'font-lock-mode-hook
> ;   '(lambda ()
> ;      (set-face-background 'modeline "Blue4")
> ;      (set-face-foreground 'modeline "Gold")
> ;      (set-face-foreground 'secondary-selection "red")
> ;      (set-face-background 'highlight "yellow")
> ;))
>
> ;; Set the wanted overall frame color style
> ;;(change-color-style default-color-style)
>
> ;; Background
> (set-background-color "white smoke")
>
> ;; Override default text colours
> (custom-set-faces
>    '(font-lock-comment-face ((((class color)) (:foreground
> "firebrick"))))
>   ;'(font-lock-comment-face ((((class color)) (:foreground "green4"))))
>    '(region ((((class color)) (:background "wheat"))))
>    '(highlight ((((class color)) (:background "green1"))))
>    '(font-lock-string-face ((((class color)) (:foreground "green4"))))
>    '(font-lock-keyword-face ((((class color)) (:foreground "orange"))))
>    '(font-lock-type-face ((((class color)) (:foreground "blue"))))
>    '(font-lock-variable-name-face ((((class color)) (:foreground
> "brown"))))
>    '(font-lock-function-name-face ((((class color)) (:foreground "royal
> blue"))))
>   ;'(font-lock-function-name-face ((((class color)) (:foreground
> "firebrick"))))
> )
>
> ;;; Here are some color preferences.  I've spent a good deal of time
> ;;; adjusting color settings, trying to get it to look good and also be
> ;;; fairly easy to read.
> (setq default-frame-alist
>    (append default-frame-alist
>      ;'((foreground-color . "yellow")
>      ;'((foreground-color . "green")
>      ;'((foreground-color . "wheat")
>       '((foreground-color . "black")
>       '((background-color . "white smoke")
>      ;'((cursor-color . "green3")))
>       '((cursor-color . "blue"))))))
>
> (set-face-foreground 'bold "yellow")
> (set-face-background 'bold "grey40")
>
> (set-face-foreground 'bold-italic "yellow green")
> (set-face-foreground 'italic "yellow3")
> (set-face-foreground 'region "white")
> (set-face-background 'region "blue")
>
> ;; Load custom color theme if it exists
> ;(color-theme-emacs-21)
> ;(color-theme-subtle-blue)
> ;(color-theme-GaryF)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;                    M I S C.    C O M M A N D S
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;; WoMan stuff for reading man pages in emacs
> (autoload 'woman "woman" "Decode and browse a UN*X man page." t)
> (autoload 'woman-find-file "woman"
>   "Find, decode and browse a specific UN*X man-page file." t)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;                          F A C E S
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;Faces
> ; (set-face-foreground 'region "black")
> ; (set-face-background 'highlight "CadetBlue")
> ; (set-face-background 'secondary-selection "MediumSeaGreen")
>
> ;; New faces
> (defvar font-lock-number-face 'font-lock-number-face)
> (defvar font-lock-hexnumber-face 'font-lock-hexnumber-face)
> (defvar font-lock-floatnumber-face 'font-lock-floatnumber-face)
> (defvar font-lock-keys-face 'font-lock-keys-face)
> (defvar font-lock-qt-face 'font-lock-qt-face)
>
> (defface font-lock-number-face
>   '(
>     (((class grayscale) (background light)) (:foreground
> "LightGray" :bold t))
>     (((class grayscale) (background dark)) (:foreground "DimGray" :bold
> t))
>     (((class color) (background light)) (:background "hotpink"))
>     (((class color) (background dark)) (:foreground "black" :background
> "hotpink"))
>     (t (:italic t)))
>   "blah"
>   :group 'font-lock-highlighting-faces)
>
> (defface font-lock-hexnumber-face
>   '(
>     (((class grayscale) (background light)) (:foreground
> "LightGray" :bold t))
>     (((class grayscale) (background dark)) (:foreground "DimGray" :bold
> t))
>     (((class color) (background light)) (:background "darkblue"))
>     (((class color) (background dark)) (:foreground "black" :background
> "darkblue"))
>     (t (:italic t)))
>   "blah"
>   :group 'font-lock-highlighting-faces)
>
> (defface font-lock-floatnumber-face
>   '(
>     (((class grayscale) (background light)) (:foreground
> "LightGray" :bold t))
>     (((class grayscale) (background dark)) (:foreground "DimGray" :bold
> t))
>     (((class color) (background light)) (:background "darkgreen"))
>     (((class color) (background dark)) (:foreground "black" :background
> "darkgreen"))
>     (t (:italic t)))
>   "blah"
>   :group 'font-lock-highlighting-faces)
>
> (defface font-lock-keys-face
>   '(
>     (((class grayscale) (background light)) (:foreground
> "LightGray" :bold t))
>     (((class grayscale) (background dark)) (:foreground "DimGray" :bold
> t))
>     (((class color) (background light)) (:background "yellow"))
>     (((class color) (background dark)) (:foreground "black" :background
> "yellow"))
>     (t (:italic t)))
>   "blah"
>   :group 'font-lock-highlighting-faces)
>
> (defface font-lock-qt-face
>   '(
>     (((class grayscale) (background light)) (:foreground
> "LightGray" :bold t))
>     (((class grayscale) (background dark)) (:foreground "DimGray" :bold
> t))
>     (((class color) (background light)) (:background "brown"))
>     (((class color) (background dark)) (:foreground "green" :background
> "brown"))
>     (t (:italic t)))
>   "blah"
>   :group 'font-lock-highlighting-faces)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;                      F U N C T I O N S
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;; ASCII table function
> (defun ascii-table ()
>   "Print the ascii table. Based on a defun by Alex Schroeder
> <asc@bsiag.com>"
>   (interactive)  (switch-to-buffer "*ASCII*")  (erase-buffer)
>   (insert (format "ASCII characters up to number %d.\n" 254))  (let ((i
> 0))
>     (while (< i 254)      (setq i (+ i 1))
>       (insert (format "%4d %c\n" i i))))  (beginning-of-buffer))
>
> ;; make-comment-italic
> (defun make-comment-italic ()
>   (interactive "*")
>   (make-face-italic 'font-lock-comment-face))
>
> ;; make-comment-unitalic
> (defun make-comment-unitalic ()
>   (interactive "*")
>   (make-face-unitalic 'font-lock-comment-face))
>
> ;; make-comment-invisible
> (defun make-comment-invisible ()
>   (interactive "*")
>   (custom-set-faces
>  '(font-lock-comment-face ((((class color)) (:foreground "white"))))))
>
> ;; make-comment-visible
> (defun make-comment-visible ()
>   (interactive "*")
>   (custom-set-faces
>  '(font-lock-comment-face ((((class color)) (:foreground "green4"))))))
>
> ;; make-comment-red
> (defun make-comment-red ()
>   (interactive "*")
>   (custom-set-faces
>  '(font-lock-comment-face ((((class color)) (:foreground "red3"))))))
>
> (defun wrap-all-lines ()
>   "Enable line wrapping"
>   (interactive) ;this makes the function a command too
>   (set-default 'truncate-lines nil)
> )
>
> (defun open-dot-emacs ()
>   "opening-dot-emacs"
>   (interactive) ;this makes the function a command too
>   (find-file "~/.emacs")
> )
>
> (defun open-dot-emacs ()
>   "opening-dot-emacs"
>   (interactive) ;this makes the function a command too
>   (find-file "~/.emacs")
> )
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;                  K E Y    B I N D I N G S
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;;(global-set-key [home] 'beginning-of-line)
> ;;(global-set-key [end] 'end-of-line)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;             B U F F E R / F I L E    H A N D L I N G
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;; syntax highlighting (font-lock)
> (cond (window-system
> ;;     (require 'font-lock-menu)
>        (setq font-lock-maximum-decoration t)
>        (global-font-lock-mode t)
>        (setq font-lock-support-mode 'lazy-lock-mode)
>        (setq font-lock-defer-on-scrolling nil)
>        (setq font-lock-defer-on-the-fly nil)
>        (setq lazy-lock-defer-time 0)
>        (setq lazy-lock-minimum-size 10240)
>        ))
>
> ;; Getting new features into Emacs: load and autoload
> ;; Emacs gets built with a lot of default functionality for commonly
> ;;    used functions and modes, but sometimes there is a need to
> ;;    load in external Emacs LISP code to do special things; most of
> ;;    this is handled automatically by Emacs such that you will only
> ;;    see the messages from it when a new feature is being added.
> ;;    You can add autoloads in your .emacs for features which Emacs
> ;;    hasn't provided though, such as whist.el and wconfig.el in
> ;;    ~gnu/emacs/local, as in the following examples
> (autoload 'whist "whist" "Add history entries to a file" t)
> (autoload 'wconfig-ring-save "wconfig" "Store the current window
> config." t)
>
> ;; Loading should be done only for functions which you intend to use
> ;;    every time you run Emacs; since additional features use more
> ;;    memory, take more time for Emacs to start-up and can slow down
> ;;    the overall performance of the machine which Emacs is being
> ;;    run on (if lots of features were added), it is better to use
> ;;    autoload.  The following are loaded directly because of
> ;;    actions they take when loaded.
>
> ;; recentf --- menu of recently visited files
> (require 'recentf)
> (recentf-mode 1)
>
> ;; This method of killing the current buffer, when bound to C-x C-c,
> ;;    allows you to close an emacs frame the same way, whether it's
> ;;    the sole window you have open, or whether it's a "child" frame
> ;;    of a "parent" frame.  If you're like me, and use emacs in a
> ;;    windowing environment, you probably have lots of frames open
> ;;    at any given time.  Well, it's a pain to remember to do
> ;;    Ctrl-x 5 0 to dispose of a child frame, and to remember to do
> ;;    C-x C-x to close the main frame (and if you're not careful,
> ;;    doing so will take all the child frames away with it).  This
> ;;    is my solution to that:  an intelligent close-frame operation
> ;;    that works in all cases (even in an emacs -nw session).
> (defun intelligent-close ()
>   "quit a frame the same way no matter what kind of frame you are on"
>   (interactive)
>   (if (eq (car (visible-frame-list)) (selected-frame))
>       ;;for parent/master frame...
>       (if (> (length (visible-frame-list)) 1)
>           ;;close a parent with children present
>    (delete-frame (selected-frame))
>         ;;close a parent with no children present
>  (save-buffers-kill-emacs))
>     ;;close a child frame
>     (delete-frame (selected-frame)))
> )
>
> ;; scrolling a buffer's frame just one line at a time
> (setq scroll-step 1)
>
> ;; Alas, this next thing doesn't seem to work right now
> (setq auto-save-directory (expand-file-name "~/autosaves/"))
> (setq auto-save-interval 125)
>
> ;; Add Time-stamp <> or Time-stamp " " anywhere in the top 8 lines
> ;;    of a file to insert save date and time and user:
> (add-hook 'write-file-hooks 'time-stamp)
> ;; (add-hook 'server-visit-hook '(lambda ()
> ;;                                 (interactive)
> ;;                                 (yes-or-no-p "Hello there")))
> (add-hook 'server-switch-hook 'make-frame-command)
> ;; (add-hook 'server-done-hook '(lambda ()
> ;;                                (interactive)
> ;;                                (if (is-buffer-a-client)
> ;;                                    (delete-frame))))
>
> ;; add a comment character in front of all lines in the region
> (defun ewd-comment-region (start end)
>   "Add one comment character in front of all lines in the region."
>   (interactive "*r")
>   (or comment-start (setq comment-start (read-input "Comment char?: ")))
>   (ewd-prepend start end comment-start)
> )
>
> ;; remove a comment character from in front of all lines in the region
> (defun ewd-uncomment-region (start end)
>   "Remove one comment character from in front of all lines in the
> region."
>   (interactive "*r")
>   (or comment-start (setq comment-start (read-input "Comment char?: ")))
>   (ewd-unprepend start end comment-start)
> )
>
> (defun kill-buffer-and-window ()
>   "Kill the current buffer and delete the selected window."
>   (interactive)
>   (let ((buffer (current-buffer)))
>     (delete-window (selected-window))
>     (kill-buffer buffer))
> )
>
> ;; let split windows display different buffers
> (defun split-window-switch-buffer () (interactive)
>   "Split current window and display the two last buffers used."
>   (split-window)
>   (switch-to-buffer (other-buffer (current-buffer)))
> )
>
> (defun hsplit-window-switch-buffer () (interactive)
>   "Split current window horizontally and display the two last buffers
> used."
>   (split-window-horizontally)
>   (switch-to-buffer (other-buffer (current-buffer)))
> )
>
> (defun kill-current-buffer ()
>   "Kill the current buffer, without confirmation."
>   (interactive)
>   (kill-buffer (current-buffer))
> )
>
> (defun kill-buffer-other-window (arg)
>   "Kill the buffer in the other window, and make the current buffer full
> size.  If no other window, kills current buffer."
>   (interactive "p")
>   (let ((buf (save-window-excursion
>         (other-window arg)
>         (current-buffer))))
>     (delete-windows-on buf)
>     (kill-buffer buf))
> )
>
> (defun kill-buffer-jump-other-window (arg)
>   "Kill this buffer and jump to other window."
>   (interactive "p")
>     (other-window arg)
>     (kill-buffer-other-window arg)
> )
>
> (fset 'scroll-cursor-to-top
>    "\C-u1\C-l")
>
> (defun Kill-Line ()
>   "Kills the whole line under cursor"
>   (interactive)
>   (beginning-of-line)
>   (kill-line)
> )
>
> ;;begin buffer-switching methods, which I bind to Ctrl-TAB and
> ;;   Ctrl-Shift-TAB
> ;; ------------------------------------------------------------------
> ;;     Original yic-buffer.el
> ;;     From: choo@cs.yale.edu (young-il choo)
> ;;     Date: 7 Aug 90 23:39:19 GMT
> ;;
> ;;     Modified
> ;; ------------------------------------------------------------------
>
> (defun yic-ignore (str)
>   (or
>    ;;buffers I don't want to switch to
>    (string-match "\\*Buffer List\\*" str)
>    (string-match "^TAGS" str)
>    (string-match "^\\*Messages\\*$" str)
>    (string-match "^\\*Completions\\*$" str)
>    (string-match "^ " str)
>
>    ;; Test to see if the window is visible on an existing visible
>    ;;    frame.  Because I can always ALT-TAB to that visible frame,
>    ;;    I never want to Ctrl-TAB to that buffer in the current
>    ;;    frame.  That would cause a duplicate top-level buffer
>    ;;    inside two frames.
> (memq str
>       (mapcar
>        (lambda (x)
>          (buffer-name
>           (window-buffer
>            (frame-selected-window x))))
>        (visible-frame-list))))
> )
>
> (defun yic-next (ls)
>   "Switch to next buffer in ls skipping unwanted ones."
>   (let* ((ptr ls)
>          bf bn go
>          )
>     (while (and ptr (null go))
>       (setq bf (car ptr)  bn (buffer-name bf))
>       (if (null (yic-ignore bn))        ;skip over
>    (setq go bf)
>         (setq ptr (cdr ptr))
>         )
>       )
>     (if go
>         (switch-to-buffer go)))
> )
>
> (defun yic-prev-buffer ()
>   "Switch to previous buffer in current window."
>   (interactive)
>   (yic-next (reverse (buffer-list)))
> )
>
> (defun yic-next-buffer ()
>   "Switch to the other buffer (2nd in list-buffer) in current window."
>   (interactive)
>   (bury-buffer (current-buffer))
>   (yic-next (buffer-list))
> )
> ;; end of yic buffer-switching methods
>
> (autoload 'goto-last-buffer "goto-last-buffer" nil t)
> (global-set-key [(control c) (b)] 'goto-last-buffer)
> (global-set-key [(control c) (B)] 'buffer-menu)
>
> ;; Make region visible (only up to next operation on it)
> (setq transient-mark-mode t)
>
> ;; Filename case-sensitivity.  For Windows systems only
> (if (eq system-type 'windows-nt)
>     (setq w32-downcase-file-names t)
> )
>
> ;; Convert DOS cr-lf to UNIX newline
> (defun dos-unix () (interactive) (goto-char (point-min))
>   (while (search-forward "\r" nil t) (replace-match "")))
>
> ;; Convert UNIX newline to DOS cr-lf
> (defun unix-dos () (interactive) (goto-char (point-min))
>   (while (search-forward "\n" nil t) (replace-match "\r\n"))
> )
>
> ;; Insert date into buffer
> (defun insert-date ()
>   "Insert date at point."
>   (interactive)
>   (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %z"))
> )
>
> ;; some programs require this, few if any of mine are bothered by it
> (setq require-final-newline t)
>
> ;;;;; rect-mark ;;;;;
> ;; Support for marking a rectangle of text with highlighting (rect-
> mark.el).
> ; Only needed for emacs - xemacs has something similar built in.
> ; ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/
> (if (boundp 'running-xemacs)
>  ; Just bind mouse rectangle select similarly to rect-mark.el on GNU
> Emacs.
>  ; Note you can't show a rectangular region during keyboard select -
>  ; only during mouse select.
>     (progn
>       (global-set-key [(shift button1)] 'mouse-track-do-rectangle)
>       (global-set-key (kbd "C-x r C-SPC") 'set-mark-command)
>       (global-set-key (kbd "C-x r C-x") 'exchange-point-and-mark)
>       (global-set-key (kbd "C-x r C-w") 'kill-rectangle)
>       )
>   ;(else GNU Emacs
>   (progn
>     (global-set-key (kbd "C-x r C-SPC") 'rm-set-mark)
>     (global-set-key (kbd "C-x r C-x") 'rm-exchange-point-and-mark)
>     (global-set-key (kbd "C-x r C-w") 'rm-kill-region)
>     (global-set-key (kbd "C-x r M-w") 'rm-kill-ring-save)
>     ;<shift>-<mouse button 1> now does a rectangular mark.
>     (global-set-key [(shift down-mouse-1)] 'rm-mouse-drag-region)
>     (autoload 'rm-set-mark "rect-mark"
>       "Set mark for rectangle." t)
>     (autoload 'rm-exchange-point-and-mark "rect-mark"
>       "Exchange point and mark for rectangle." t)
>     (autoload 'rm-kill-region "rect-mark"
>       "Kill a rectangular region and save it in the kill ring." t)
>     (autoload 'rm-kill-ring-save "rect-mark"
>       "Copy a rectangular region to the kill ring." t)
>     (autoload 'rm-mouse-drag-region "rect-mark"
>       "Drag out a rectangular region with the mouse." t)
>     )
> )
>
> ;; dealing with marking, yanking rectangular regions
> ;;(defun option-package-start-rect-mark ()
> ;;  (autoload 'rm-set-mark "rect-mark"
> ;;    "Set mark for rectangle." t)
> ;;  (autoload 'rm-exchange-point-and-mark "rect-mark"
> ;;    "Exchange point and mark for rectangle." t)
> ;;  (autoload 'rm-kill-region "rect-mark"
> ;;    "Kill a rectangular region and save it in the kill ring." t)
> ;;  (autoload 'rm-kill-ring-save "rect-mark"
> ;;    "Copy a rectangular region to the kill ring." t)
> ;;  (autoload 'rm-mouse-drag-region "rect-mark"
> ;;    "Drag out a rectangular region with the mouse." t)
> ;;  (option-enable-keys 'option-keys-rect-mark-alist)
> ;;)
> ;;(defun option-package-end-rect-mark ()
> ;;  (option-disable-keys 'option-keys-rect-mark-alist)
> ;;)
>
> ;;; session management
> (require 'desktop)
> (load "desktop")
> (desktop-load-default)
> (desktop-read)
>
> ;;; misc key bindings
> (global-set-key [(alt g)] 'goto-line)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;        O U T P U T    O F    M - X    C U S T O M I Z E
> ;;    D O    N O T    E D I T    B E L O W    T H I S    L I N E
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ;; 06/02/2005 1909
> (custom-set-variables
>   ;; custom-set-variables was added by Custom -- don't edit or cut/paste
> it!
>   ;; Your init file should contain only one such instance.
>  '(abbrev-mode t)
>  '(bookmark-save-flag 3)
>  '(calculator-number-digits 6)
>  '(case-fold-search t)
>  '(current-language-environment "Latin-1")
>  '(default-input-method "latin-1-prefix")
>  '(explicit-shell-file-name "d:\\UWIN\\usr\\bin\\ksh.exe")
>  '(global-font-lock-mode t nil (font-lock))
>  '(global-hl-line-mode t nil (hl-line))
>  '(hl-line-face (quote highlight))
>  '(mouse-wheel-mode t nil (mwheel))
>  '(msb-mode t nil (msb))
>  '(only-global-abbrevs t)
>  '(save-completions-retention-time 672)
>  '(save-place t nil (saveplace))
>  '(server-program "c:/emacs-21.3/bin/gnuserv.exe")
>  '(sh-alias-alist (quote ((ksh . ksh93) (bash2 . bash) (sh5 . sh)
> (nil))))
>  '(show-paren-mode t nil (paren))
>  '(show-paren-ring-bell-on-mismatch t)
>  '(show-paren-style (quote expression))
>  '(tempo-insert-region t)
>  '(tempo-interactive t))
> (custom-set-faces
>   ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
>   ;; Your init file should contain only one such instance.
>  )
>
> ;; -----------------------------------------------------------------
> ;; AUC TeX
>
> ;(add-to-list 'load-path "d:/emacs-21.3/site-lisp/auctex/")
> (add-to-list 'Info-default-directory-list "d:/emacs-21.3/site-
> lisp/auctex/doc/")
> (load "tex-site")
>
> ;; -----------------------------------------------------------------
> ;; Reftex activation (Reftex is included with Emacs 21.1)
>
> (autoload 'reftex-mode     "reftex" "RefTeX Minor Mode" t)
> (autoload 'turn-on-reftex  "reftex" "RefTeX Minor Mode" nil)
> (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
> (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
> (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
> (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
>
> ;;
> ----------------------------------------------------------------------
> ;; Info for Ispell
> (add-to-list 'Info-default-directory-list "d:/Cygwin/usr/local/info/")
>
> ;; info for Aspell
> ;; Enable aspell as the spell program
> ;; (Requires that the Aspell program and a dictionary be installed on
> the PC.
> ;;  Install them in: c:\Aspell
> ;;  Add the following to the PATH variable: c:\Aspell\bin
> ;;  The latest version of the Aspell program, Aspell-<version>.exe,
> ;;  and the dictionary of your choice, for example: aspell-en-
> <version>.exe,
> ;;  can be found at http://aspell.net/win32/).
> (setq-default ispell-program-name "aspell")
>
> (message ".emacs loaded.")
> ;; EOF
>
> (put 'downcase-region 'disabled nil)
>
> (put 'upcase-region 'disabled nil)
> ****************** end of .emacs file **********************
>
> Note: the ****start**** and ****end**** lines are _not_ part of the
> .emacs file, of course.
>
> Thanks in advance for suggestions anyone can provide.
>
> Sincerely,
> Will Grove, a none-too-savvy emacs user

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to click on file in file manager and have gnuclientw open it up
  2007-03-02  1:10 how to click on file in file manager and have gnuclientw open it up William M. Grove
  2007-03-02 16:04 ` weber
@ 2007-03-02 21:48 ` james
  1 sibling, 0 replies; 3+ messages in thread
From: james @ 2007-03-02 21:48 UTC (permalink / raw)
  To: help-gnu-emacs

I think you'll want this in there somewhere:
(server-start)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-03-02 21:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-02  1:10 how to click on file in file manager and have gnuclientw open it up William M. Grove
2007-03-02 16:04 ` weber
2007-03-02 21:48 ` james

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.