POV-Ray : Newsgroups : povray.unix : Emacs C++ mode with Windows shortcuts? Server Time
24 Dec 2024 20:59:47 EST (-0500)
  Emacs C++ mode with Windows shortcuts? (Message 1 to 8 of 8)  
From: Peter Popov
Subject: Emacs C++ mode with Windows shortcuts?
Date: 27 Apr 2001 18:36:55
Message: <bc6ietosahupskk1j52thdr48ucgcv15uj@4ax.com>
Sorry if this is a bit off-topic.

Does anyone use a C++ mode for Emacs which is set up to use
Windows-friendly shortcuts (ctrl-C, ctrl-V, shift-arrows, ctrl-home
etc.)? Alternatively, one compatible with the Borland environment
(ctrl-ins, shift-ins, ctrl-y etc.) would still work for me. I will
only use it in Emacs (i.e. not XEmacs), if that makes a difference.

Thanks in advance.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Steve
Subject: Re: Emacs C++ mode with Windows shortcuts?
Date: 27 Apr 2001 21:22:02
Message: <slrn9ek6o6.m7o.steve@zero-pps.localdomain>
On Sat, 28 Apr 2001 01:34:21 +0300, Peter Popov wrote:
>Sorry if this is a bit off-topic.
>
>Does anyone use a C++ mode for Emacs which is set up to use
>Windows-friendly shortcuts (ctrl-C, ctrl-V, shift-arrows, ctrl-home
>etc.)? Alternatively, one compatible with the Borland environment
>(ctrl-ins, shift-ins, ctrl-y etc.) would still work for me. I will
>only use it in Emacs (i.e. not XEmacs), if that makes a difference.


I'm using GNU Emacs 20.5.1, and have the following in 
my .emacs file:

(pc-selection-mode)

I've just checked it and it works perfectly in cc-mode. 

I'm running this in X. 

Hope that helps. 

-- 
Cheers
Steve              email mailto:ste### [at] zeroppsuklinuxnet

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.zeropps.uklinux.net/

or  http://start.at/zero-pps

  2:14am  up 85 days,  3:00,  2 users,  load average: 1.27, 1.19, 1.13


Post a reply to this message

From: Warp
Subject: Re: Emacs C++ mode with Windows shortcuts?
Date: 28 Apr 2001 12:52:55
Message: <3aeaf567@news.povray.org>
I can post relevant parts of my .emacs if you want.
  Besides using the pc-selection-mode (which adds quite a lot of stuff indeed),
I have it configured so that:

  - Page-up and page-down work as they should, that is, the text is scrolled
    one screenfull up or down but the cursor position on the screen does
    not change (unless it ends on a past-the-end-of-line place, in which case
    it moves to the end of that line).

  - Fixes home, end, delete and backspace to work as in other editors.

  - ctrl-y deletes the current line immediately (handier than ctrl-k). Also
    other miscellaneous key settings.

  - Loads povmode.elc (you must get it yourself).

  - The column number is shown on the status bar.

  - Scrolls one line at a time when the cursor goes up the first line or
    down the last line (by default emacs scrolls a half-page).

  - Several font-lock options (eg. turns on full keyword coloring and
    automatic indenting for all known languages).

-- 
#local D=array[6]{11117333955,7382340,3358,3900569407,970,4254934330}
#local I=0;#macro M()<mod(D[I],13)-6,mod(div(D[I],13),8)-3,10>#end
#while(I<6)cylinder{M()#local D[I]=div(D[I],104);M().1
pigment{rgb M()}}#local I=(D[I]>99?I:I+1);#end              /*- Warp -*/


Post a reply to this message

From: Ole Laursen
Subject: Re: Emacs C++ mode with Windows shortcuts?
Date: 29 Apr 2001 06:55:19
Message: <m37l04dlev.fsf@bach.composers>
>   - ctrl-y deletes the current line immediately (handier than
>     ctrl-k). Also other miscellaneous key settings.

Hm, I'd say doing this is evil since C-y is used by lot of other
software as 'insert'. Rather rebind C-k so you later have the option
of trying the Emacsian way of doing things.

When I first came to Emacs, I was trying to do the same as you've done
- making Emacs adopt the way of editing I was used to from my
DOS/Windows background. However, my brother who had been using Emacs
for half a decade or so (he's nine years older than me), encouraged me
to try using C-f, C-b, C-n, C-p and so on for moving around.

So I tried it a day or two, found it difficult to get used to, dropped
it a few days but then finally got back to it. And within a week I was
quite fluent and had found that it actually boosted my typing
performance a lot, eventually say 50%. It is really a relief not
having to lift and move the right hand every time you need to move the
cursor, especially when programming where there are typically lots of
small adjustments.

The idea of leaving the mark behind with C-SPC, moving the cursor to
the other end of a piece of text to be copied and pressing M-w also
makes sense once you get used to it, though it probably requires that
one is using C-f, C-b etc. to be effective.

Since most people are using these keys, a lot of other programs in
Linux/Unix also support such bindings (or perhaps VI ones).

Anyway, if anyone is interested in learning them, there is a nice
tutorial in Emacs in the help menu. It takes time to learn, but
eventually it pays off... :-)


Just wanted to throw in another aspect,

-- 
Ole Laursen 
http://sunsite.dk/olau/


Post a reply to this message

From: Peter Popov
Subject: Re: Emacs C++ mode with Windows shortcuts?
Date: 29 Apr 2001 10:33:15
Message: <v29oet8ik89gv1lf4gd5n6ei1g5fgh8pit@4ax.com>
On 28 Apr 2001 12:52:55 -0400, Warp <war### [at] tagpovrayorg> wrote:

>  I can post relevant parts of my .emacs if you want.

That would be really nice. Either that, or e-mail the whole thing if
it's not a problem.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Steve
Subject: Re: Emacs C++ mode with Windows shortcuts?
Date: 29 Apr 2001 13:44:51
Message: <slrn9eo3uj.viv.steve@zero-pps.localdomain>
In addition to the stuff that warp mentioned, I have 
F2 save
F3 exit without saving
F8 refontify

PS: wasn't C-y line delete in Word Star. 

-- 
Cheers
Steve              email mailto:ste### [at] zeroppsuklinuxnet

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.zeropps.uklinux.net/

or  http://start.at/zero-pps

  1:44pm  up 86 days, 14:30,  2 users,  load average: 1.00, 1.01, 1.10


Post a reply to this message

From: Warp
Subject: Re: Emacs C++ mode with Windows shortcuts?
Date: 1 May 2001 07:23:58
Message: <3aee9ccd@news.povray.org>
Peter Popov <pet### [at] vipbg> wrote:
: That would be really nice. Either that, or e-mail the whole thing if
: it's not a problem.

  Ok, here it is:

-----------8<-----------8<-----------8<-----------8<-----------8<-----------

;;; This line adds a LOT of stuff. Among other things it adds
;;; shift+cursor movement painting, ctrl-ins copying, shift-ins pasting, etc.
;;; Works only in emacs, not in xemacs:
(pc-selection-mode)

;;; Show also column number besides line number:
(column-number-mode t)

;;; Doesn't add new lines at the end of the doc when cursor is there and
;;; return is pressed:
(setq next-line-add-newlines nil)

;;; Don't create backup files:
(setq auto-save-default nil)
;;; Scroll one line at a time, not half-page:
(setq scroll-step 1)
;;; Colors:
(set-background-color "black")
(set-foreground-color "white")
(set-cursor-color "yellow")
(standard-display-european t) 
(set-input-mode (car (current-input-mode)) 
                (nth 1 (current-input-mode)) 
                0) 

;;; Fix home, end and delete to work as they should:
(global-set-key '[home] 'beginning-of-line)
(global-set-key '[end] 'end-of-line)
(global-set-key '[delete] 'delete-char)
;;; Use ctrl-y to kill a line immediately. Much handier than ctrl-k
(global-set-key "\C-y" 'kill-complete-line)
;;; Other key settings:
(global-set-key [(alt x)] 'save-buffers-kill-emacs)
(global-set-key [(alt f3)] 'delete-window)
(global-set-key '[f2] 'save-buffer)
(global-set-key '[f9] 'compile)
(global-set-key "\C-r" 'insert-file)
;;; Fix bacspace to delete characters instead of popping up the help.
;;; To pop up the help, press F1.
(global-set-key "\C-h" 'delete-backward-char)

;;; Misc settings:
(auto-fill-mode)
(defun kill-complete-line () 
  "Kill the complete line." 
  (interactive) 
  (beginning-of-line) 
  (if (eobp) (error "End of buffer")) 
  (let ((beg (point))) 
    (forward-line 1) 
    (kill-region beg (point)))) 

(setq font-lock-maximum-decoration t) 
(global-font-lock-mode t) 

;;; Misc help functions:
(defun contents-move (dir checkpoint)
  (let ((oldColumn (current-column)))
    (if (not (pos-visible-in-window-p checkpoint))
        ((lambda ()
           (save-excursion
             (goto-char (window-start))
             (forward-line dir)
             (set-window-start (selected-window) (point))))))
    (forward-line dir)
    (move-to-column oldColumn)))
 
(defun contents-one-down ()
  (interactive)
  (contents-move -1 (point-min)))
 
(defun contents-one-up ()
  (interactive)
  (contents-move 1 (point-max)))
 
(defun generic-page-scroll (lines)
  (let ((oldColumn (current-column)))
    (save-excursion
      (goto-char (window-start))
      (forward-line lines)
      (set-window-start (selected-window) (point)))
    (forward-line lines)
    (move-to-column oldColumn)))
 
(defun page-scroll-up ()
  (interactive)
  (if (not (pos-visible-in-window-p (point-max)))
      (generic-page-scroll (- (1- (window-height)) next-screen-context-lines))
    (goto-char (point-max))))
 
(defun page-scroll-down ()
  (interactive)
  (if (not (pos-visible-in-window-p (point-min)))
      (generic-page-scroll (- next-screen-context-lines (1- (window-height))))
    (goto-char (point-min))))
 
;;; Use ctrl-up and ctrl-down to scroll:
(global-set-key '[(control up)] 'contents-one-down)
(global-set-key '[(control down)] 'contents-one-up)
;;; Fix page up and page down to work as they should:
(global-set-key '[next] 'page-scroll-up)
(global-set-key '[prior] 'page-scroll-down)

;; POV-Ray related stuff
;; =====================
;;; Fix the path to pov-mode.elc!
(autoload 'pov-mode "/home/warp/temp/pov-mode.elc" "PoVray scene file mode" t)
(setq auto-mode-alist
      (append '(("\\.pov$" . pov-mode)
                ("\\.inc$" . pov-mode)
                ("\\.mcr$" . pov-mode))
              auto-mode-alist))
(add-hook 'pov-mode-hook 'turn-on-font-lock)


;;; Insert file at the current position uuencoded with ctrl-c-u
(defun insert-file-uuencoded (filename)
  (interactive "fInsert file (uuencoded): ")
  (shell-command (concat "uuencode " filename " " (substring filename (string-match
"[^/]+$" filename)) " | sed 's/^ $/`/'") t)
)

(global-set-key [(control c) (control u)] 'insert-file-uuencoded)

;;; Kill all whitespace chars forward from cursor with ctrl-t
(defun kill-white-space()
  (interactive)
  (if (re-search-forward "\\(\\s-\\|\n\\)+" nil t)
      (replace-match "")))

(global-set-key '[(control t)] 'kill-white-space)


;;; Color settings
(custom-set-variables)
(custom-set-faces
 '(default ((t (:foreground "white" :background "black"))))
 '(font-lock-comment-face ((((class color) (background dark)) (:foreground
"ForestGreen"))))
 '(font-lock-string-face ((((class color) (background dark)) (:foreground
"Magenta"))))
 '(region ((t (:foreground "black" :background "#99CCFF"))))
 '(font-lock-keyword-face ((((class color) (background dark)) (:foreground
"Yellow"))))
 '(font-lock-constant-face ((((class color) (background dark)) (:foreground
"GreenYellow"))))
 '(font-lock-type-face ((((class color) (background dark)) (:foreground "#40A0FF"))))
 '(modeline ((t (:foreground "yellow" :background "Blue"))))
 '(font-lock-variable-name-face ((((class color) (background dark)) (:foreground
"thistle"))))
 '(font-lock-function-name-face ((((class color) (background dark)) (:foreground
"Coral"))))
 '(font-lock-builtin-face ((((class color) (background dark)) (:foreground
"Green")))))


;;; C indentation settings
(defun oma-c-mode-common-hook ()
  (interactive)
  (setq c-basic-offset 4)
  (c-set-offset 'substatement-open 0)
  (c-set-offset 'case-label 2)
  (c-set-offset 'block-open 0)
  (c-set-offset 'knr-argdecl-intro '-)
  (c-set-offset 'arglist-close 'c-lineup-arglist)
  (c-set-offset 'access-label -3)
  (c-set-offset 'inclass 4)	
  (c-set-offset 'inline-open 0)
  (setq tab-width 8
        ;; this will make sure spaces are used instead of tabs
        indent-tabs-mode nil)
)
(add-hook 'c-mode-common-hook 'oma-c-mode-common-hook)

-----------8<-----------8<-----------8<-----------8<-----------8<-----------


-- 
#local D=array[6]{11117333955,7382340,3358,3900569407,970,4254934330}
#local I=0;#macro M()<mod(D[I],13)-6,mod(div(D[I],13),8)-3,10>#end
#while(I<6)cylinder{M()#local D[I]=div(D[I],104);M().1
pigment{rgb M()}}#local I=(D[I]>99?I:I+1);#end              /*- Warp -*/


Post a reply to this message

From: Warp
Subject: Re: Emacs C++ mode with Windows shortcuts?
Date: 1 May 2001 07:24:52
Message: <3aee9d04@news.povray.org>
Forgot to mention one handy feature added by my .emacs:

  - ctrl-up and ctrl-down scrolls the text.

-- 
#local D=array[6]{11117333955,7382340,3358,3900569407,970,4254934330}
#local I=0;#macro M()<mod(D[I],13)-6,mod(div(D[I],13),8)-3,10>#end
#while(I<6)cylinder{M()#local D[I]=div(D[I],104);M().1
pigment{rgb M()}}#local I=(D[I]>99?I:I+1);#end              /*- Warp -*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.