help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how do i find out the platform emacs runs on?


From: Sébastien Kirche
Subject: Re: how do i find out the platform emacs runs on?
Date: Thu, 27 Nov 2003 11:02:08 +0100


Le mercredi, 26 nov 2003, à 18:36 Europe/Paris, Phillip Lord a écrit :

One important question to ask though, is why are you doing this? In
general its better to ask Emacs for its capabilities rather than its
platform.

Checking between console and windowing environment seems a good way to
do things.

This way if Emacs on different systems gains new functionality, it
should all just work.

Of course there are times when you might just not be bothered to do
this, or when its too much effort (checking whether external programs
like diff are available for instance).

Well, i actually do that for platform specific (headaches cause) settings.
Mostly keyboard remapping, and some defuns.
With the keep in mind to have only one .emacs that i have just to copy from one platform to another if i made new settings.

If you see a smarter way to do that, i am open to any suggestion, as i am still a learning user for emacs, especially for elisp.

I pasted the actual portion of .emacs (rewritten thanks to Kevin Rogers) relative to that. I left the french comments, but i guess still understandable for english people :)

Thanks
Sébastien Kirche

;======= SPECIFIQUE PLATEFORME ==========================================================
(cond ((eq system-type 'darwin)   ; réglages pour le mac
           (progn
                 ;(message "on est sous mac")
                 ;(setq mac-command-key-is-meta nil)
                 (set-keyboard-coding-system 'mac-roman)
                 ;(set-frame-font "fontset-mac")
                 (if window-system
                         (setq default-frame-alist '((width . 100)
                                                                                
 (height . 44)
                                                                                
 (top . 50);pixels
                                                                                
 (left . 50);pixels
                                                                                 (font . 
"fontset-mac")))
                   )
                 (global-set-key (kbd "<kp-delete>") 'delete-char)    ;touche 
suppr
(global-set-key (kbd "<kp-divide>") "/") ;touche division sur pavé num (inactif sur mon poste ?)
                 (global-set-key (kbd "<C-kp-home>") (kbd "<C-home>"));idem /
                 (global-set-key (kbd "<C-kp-end>") (kbd "<C-end>"))  ;idem /
                 ;(global-set-key "€" (sk-insere-euro t));j'arrive pas avec 
l'euro ;(

                 (defvar sw-last-applescript nil
                   "Stores the last Applescript command executed from Emacs.")
                
                 (defvar sw-applescript-buffer-name "*AppleScript output*"
                   "Name for the buffer to display AppleScript output.")
                
                 (defun sw-applescript-run-buffer ()
                   "Execute the whole buffer as an Applescript"
                   (interactive)
                   (setq sw-last-applescript (buffer-string))
                   (sw-run-and-display-applescript (buffer-string)))
        
                 (defun sw-applescript-run-region ()
                   "Execute the region as an Applescript"
                   (interactive)
                   (let ((region (buffer-substring (region-beginning) 
(region-end))))
                         (setq sw-last-applescript region)
                         (sw-run-and-display-applescript region)))
        
                 (defun sw-run-last-applescript ()
                   "Run the last Applescript command again"
                   (interactive)
                   (sw-run-and-display-applescript sw-last-applescript))
                
                 (defun sw-run-and-display-applescript (code)
"Switch to the AppleScript buffer, erase it, run the code and display the results."
                   (switch-to-buffer (get-buffer-create 
sw-applescript-buffer-name))
                   (erase-buffer)
                   (insert (do-applescript code)))
        
                 ))

;=================================================================

          ((eq system-type 'windows-nt); réglages pour windows
           (progn
                ;(message "on est sous ouin-ouin")
(global-set-key [128] 'sk-insere-euro); C-h l donne \200 pour l'euro soit 128 en décimal
                 ();rien d'autre
                 )
           )

;=================================================================

          ((eq system-type 'linux); réglages pour Linux
           (progn
             ;(message "on est avec le pingouin")
                 ();nada
                 )
           ))

;=================================================================


; fonction pour insérer l'euro (fonction à 10€ ? ;o)
(defun sk-insere-euro (&optional arg) "Insère le symbole Euro ISO 8859-15.
Avec un préfixe, insère la version Unicode."
  (interactive "*P")
  (if arg
          (insert (make-char 'mule-unicode-0100-24ff 116 76))
        (insert (make-char 'latin-iso8859-15 164))))



--
E pluribus UNIX





reply via email to

[Prev in Thread] Current Thread [Next in Thread]