unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* code listp to determine wich os I'm running on
@ 2014-01-29 18:41 Renato
  0 siblings, 0 replies; 25+ messages in thread
From: Renato @ 2014-01-29 18:41 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,
I'm looking for some code to insert in my .emacs to determine wich s.o 
I'm running.
've foud this code:
_______________________________________
;; check OS type (cond((string-equalsystem-type"windows-nt") ; Microsoft 
Windows (progn(message"Microsoft Windows") ) ) 
((string-equalsystem-type"darwin") ; Mac OS X (progn(message"Mac OS X") 
) ) ((string-equalsystem-type"gnu/linux") ; linux (progn(message"Linux") 
) ) )
________________________
but I do't know lisp (I will learn it, of course...but not now...)
I've understand that if I'm running Linux if I press F1-e, in the buffer 
I can read "linux".

But What do I have to do to set a particular path (setq load-path... to 
start from if I click
for my C-x f in emacs on linux or win?

I mean wich variable do I have to check? and how do I build the if 
statement?

TIA

Renato


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

* Re: code listp to determine wich os I'm running on
       [not found] <mailman.13113.1391020728.10748.help-gnu-emacs@gnu.org>
@ 2014-01-29 20:28 ` Emanuel Berg
  2014-01-29 22:12   ` Renato
       [not found]   ` <mailman.13124.1391033590.10748.help-gnu-emacs@gnu.org>
  2014-01-29 21:14 ` Pascal J. Bourguignon
  2014-01-30  2:43 ` Rusi
  2 siblings, 2 replies; 25+ messages in thread
From: Emanuel Berg @ 2014-01-29 20:28 UTC (permalink / raw)
  To: help-gnu-emacs

Renato <renato.pontefice@gmail.com> writes:

> Hi, I'm looking for some code to insert in my .emacs
> to determine wich s.o I'm running. ...

Instead of `string-equal', there is string= which is an
alias for `string-equal'. Might be faster to type and
takes less place.

You don't need to use progn for a single form. Use
progn when you want to execute a bunch of forms, and
then have the *last* form's value to be the evaluation
of the whole progn form. This is what the "n" is -
execute n programs, and return the value of the last
(the "nth"). Compare: prog1

(progn 1 2 3) ; 3
(prog1 1 2 3) ; 1

The if in Lisp looks like this:

(if condition then else)

E.g., (if (> x y) x y) => x, if x is bigger than y,
else y. (You may omit the "else" part if it is `nil',
since then the whole if form will evaluate to nil
anyway, if not the condition is true.)

But you already used `cond'. `cond' and if are the
same: cond is nested ifs, if you like. To you, as a
programmer, it doesn't matter if cond is syntactic
sugar for `if', or if it is the other way around. This
only matters to the guy not programming Lisp programs,
but the Lisp system itself.

(if (string= system-type "gnu/linux")
    (setq some-variable "...")
  (if (string= system-type "...")
      (setq some-variable "...") ))

Or with `cond':

(setq some-variable
      (cond ((string= system-type "gnu/linux") 'value-1)
            ((string= system-type "...")       'value-2) ))

And so on. (You can do this in any way you like.)

You don't need to do the F1 maneuver to check
results. Just place point (the cursor) to the right of
the right-most paren, then hit `C-x C-e' (for
`eval-last-sexp'). This also works for symbols
(variables).

With the load-path though - do you really need to set
it?

-- 
underground experts united:
http://user.it.uu.se/~embe8573


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

* Re: code listp to determine wich os I'm running on
       [not found] <mailman.13113.1391020728.10748.help-gnu-emacs@gnu.org>
  2014-01-29 20:28 ` code listp to determine wich os I'm running on Emanuel Berg
@ 2014-01-29 21:14 ` Pascal J. Bourguignon
  2014-01-29 23:52   ` Emanuel Berg
  2014-01-30  2:43 ` Rusi
  2 siblings, 1 reply; 25+ messages in thread
From: Pascal J. Bourguignon @ 2014-01-29 21:14 UTC (permalink / raw)
  To: help-gnu-emacs

Renato <renato.pontefice@gmail.com> writes:

> Hi,
> I'm looking for some code to insert in my .emacs to determine wich s.o
> I'm running.
> 've foud this code:
> _______________________________________
> ;; check OS type (cond((string-equalsystem-type"windows-nt") ;
> Microsoft Windows (progn(message"Microsoft Windows") ) )
> ((string-equalsystem-type"darwin") ; Mac OS X (progn(message"Mac OS
> X") ) ) ((string-equalsystem-type"gnu/linux") ; linux
> (progn(message"Linux") ) ) )
> ________________________
> but I do't know lisp (I will learn it, of course...but not now...)
> I've understand that if I'm running Linux if I press F1-e, in the
> buffer I can read "linux".
>
> But What do I have to do to set a particular path (setq
> load-path... to start from if I click
> for my C-x f in emacs on linux or win?
>
> I mean wich variable do I have to check? and how do I build the if
> statement?

There are those variables, and probably other too.

;; system-type          darwin   gnu/linux  cygwin windows-nt
;; system-name          "naiad.informatimago.com" "hermes.afaa.asso.fr"
;; system-configuration "i686-pc-linux-gnu" "i686-pc-cygwin" "i386-apple-darwin9.8.0"
;; window-system        nil x mac ns w32
;; emacs-major-version  18 19 20 21 23
;; emacs-minor-version  0 1 2 3
;; emacs-version        "20.7.2" "21.2.1" 


-- 
__Pascal Bourguignon__
http://www.informatimago.com/
"Le mercure monte ?  C'est le moment d'acheter !"


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

* Re: code listp to determine wich os I'm running on
  2014-01-29 20:28 ` code listp to determine wich os I'm running on Emanuel Berg
@ 2014-01-29 22:12   ` Renato
  2014-01-29 23:26     ` Peter Dyballa
  2014-01-30  0:11     ` Stefan Monnier
       [not found]   ` <mailman.13124.1391033590.10748.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 25+ messages in thread
From: Renato @ 2014-01-29 22:12 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

Sorry Emanuel...
what's wrong?

(if (string= system-type "gnu/linux")
     (setq percorso-variable "\home\renato\Dropbox\emacs_prof\")
   (message "fatto"))
   (if (string= system-type "windows-nt")
       (setq percorso "c:/doc/Dropbox") ))

It does,t works... :-(

Renato


On 29/01/2014 21:28, Emanuel Berg wrote:
> Renato <renato.pontefice@gmail.com> writes:
>
>> Hi, I'm looking for some code to insert in my .emacs
>> to determine wich s.o I'm running. ...
> Instead of `string-equal', there is string= which is an
> alias for `string-equal'. Might be faster to type and
> takes less place.
>
> You don't need to use progn for a single form. Use
> progn when you want to execute a bunch of forms, and
> then have the *last* form's value to be the evaluation
> of the whole progn form. This is what the "n" is -
> execute n programs, and return the value of the last
> (the "nth"). Compare: prog1
>
> (progn 1 2 3) ; 3
> (prog1 1 2 3) ; 1
>
> The if in Lisp looks like this:
>
> (if condition then else)
>
> E.g., (if (> x y) x y) => x, if x is bigger than y,
> else y. (You may omit the "else" part if it is `nil',
> since then the whole if form will evaluate to nil
> anyway, if not the condition is true.)
>
> But you already used `cond'. `cond' and if are the
> same: cond is nested ifs, if you like. To you, as a
> programmer, it doesn't matter if cond is syntactic
> sugar for `if', or if it is the other way around. This
> only matters to the guy not programming Lisp programs,
> but the Lisp system itself.
>
> (if (string= system-type "gnu/linux")
>      (setq some-variable "...")
>    (if (string= system-type "...")
>        (setq some-variable "...") ))
>
> Or with `cond':
>
> (setq some-variable
>        (cond ((string= system-type "gnu/linux") 'value-1)
>              ((string= system-type "...")       'value-2) ))
>
> And so on. (You can do this in any way you like.)
>
> You don't need to do the F1 maneuver to check
> results. Just place point (the cursor) to the right of
> the right-most paren, then hit `C-x C-e' (for
> `eval-last-sexp'). This also works for symbols
> (variables).
>
> With the load-path though - do you really need to set
> it?
>




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

* Re: code listp to determine wich os I'm running on
       [not found]   ` <mailman.13124.1391033590.10748.help-gnu-emacs@gnu.org>
@ 2014-01-29 22:27     ` Emanuel Berg
  2014-01-30  2:27     ` Rusi
  2014-01-30  2:47     ` Rusi
  2 siblings, 0 replies; 25+ messages in thread
From: Emanuel Berg @ 2014-01-29 22:27 UTC (permalink / raw)
  To: help-gnu-emacs

Renato <renato.pontefice@gmail.com> writes:

> (if (string= system-type "gnu/linux") (setq
> percorso-variable "\home\renato\Dropbox\emacs_prof\")
> (message "fatto")) (if (string= system-type
> "windows-nt") (setq percorso "c:/doc/Dropbox") ))
>
> It does,t works... :-(

No :)

With the `if' in Lisp, if you have more than one form
either for THEN or ELSE, you must use some block
container around those, else the first one will be the
THEN branch, and the second will be the ELSE branch.

So, for example, you can use the `progn' you used
earlier to set the variable *and* message "fatto"
("done" in Italian?) in case of the condition being t -

(if condition
  (progn (do-one-thing) (do-second-thing)) ; true
  (do-else-thing))                         ; false

Also, your Linux slashes are the wrong way (\ instead
of /). This also makes for the string delimiter (")
being *quoted*, so it doesn't terminate the string, but
is instead a string *char*, which should break the
whole thing.

But keep trying :)

-- 
underground experts united:
http://user.it.uu.se/~embe8573


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

* Re: code listp to determine wich os I'm running on
  2014-01-29 22:12   ` Renato
@ 2014-01-29 23:26     ` Peter Dyballa
  2014-01-30  0:11     ` Stefan Monnier
  1 sibling, 0 replies; 25+ messages in thread
From: Peter Dyballa @ 2014-01-29 23:26 UTC (permalink / raw)
  To: Renato; +Cc: GNU Emacs users list


Am 29.01.2014 um 23:12 schrieb Renato:

>    (setq percorso-variable "\home\renato\Dropbox\emacs_prof\")

Better do not use backslashes here! Forward slashes work better. Backslashes work differently, as in UNIX…

--
Greetings

  Pete

You can never know too little of what is not worth knowing at all.
			– Anon.





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

* Re: code listp to determine wich os I'm running on
  2014-01-29 21:14 ` Pascal J. Bourguignon
@ 2014-01-29 23:52   ` Emanuel Berg
  0 siblings, 0 replies; 25+ messages in thread
From: Emanuel Berg @ 2014-01-29 23:52 UTC (permalink / raw)
  To: help-gnu-emacs

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:

> There are those variables, and probably other
> too. ...

One should remember that such variables are data, and
even impressive looking functions can be mere
lookups. There is no probing to it.

If you strike 'lscpu' in (parts of) the Linux world, it
is perhaps easy to forget that it is basically a
parsing of /proc/cpuinfo - somehow, 'cat /proc/cpuinfo'
doesn't have the same authority to it!

But yes, those can be used to have one (the same)
configuration file on several machines. I have the same
.zshrc on my Debian machine as on my school's
Solaris/SunOS, I just use uname at the end to drop a
couple of things that is only present at my home
system.

Some experimentation on this:

(system-name) ; half of 'uname -n' (--nodename)
system-name   ; same

system-configuration ; "i486-pc-linux-gnu"
;; "Value is string indicating configuration Emacs was
;; built for."
;; 'uname -m' (--machine) tells me i686 which is 32-bit Linux
;; 'uname -o' (--operating-system) says "GNU/Linux"

(window-system)     ; nil
window-system       ; nil
(display-graphic-p) ; nil; help says this is better

emacs-major-version   ; 24
emacs-minor-version   ; 3
emacs-version         ; 24.3.1
(emacs-version t)     ; GNU Emacs 24.3.1
                      ; (i486-pc-linux-gnu, GTK+
                      ; Version 3.8.4) of 2013-10-01 on
                      ; biber, modified by Debian
                      ; help says system-configuration is better

-- 
underground experts united:
http://user.it.uu.se/~embe8573


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

* Re: code listp to determine wich os I'm running on
  2014-01-29 22:12   ` Renato
  2014-01-29 23:26     ` Peter Dyballa
@ 2014-01-30  0:11     ` Stefan Monnier
  1 sibling, 0 replies; 25+ messages in thread
From: Stefan Monnier @ 2014-01-30  0:11 UTC (permalink / raw)
  To: help-gnu-emacs

> It does,t works... :-(

Even if you correct it to "it doesn't work" it still doesn't say much
about what does not satisfy you.
IOW remember that "it doesn't work" is not a good way to ask for help
because that doesn't give enough info to those who might help you.

I wish I could point to a "doesnt-work-considered-harmful" diatribe.


        Stefan




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

* Re: code listp to determine wich os I'm running on
@ 2014-01-30  1:55 Louis-Guillaume Gagnon
  2014-01-30  1:57 ` Louis-Guillaume Gagnon
  0 siblings, 1 reply; 25+ messages in thread
From: Louis-Guillaume Gagnon @ 2014-01-30  1:55 UTC (permalink / raw)
  To: help-gnu-emacs

2014-01-29 Stefan Monnier <monnier@iro.umontreal.ca>:
> I wish I could point to a "doesnt-work-considered-harmful" diatribe.
>

Not a diatribe per se, but still a relevant read: How To Ask Questions
The Smart Way

glg



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

* Re: code listp to determine wich os I'm running on
  2014-01-30  1:55 Louis-Guillaume Gagnon
@ 2014-01-30  1:57 ` Louis-Guillaume Gagnon
  0 siblings, 0 replies; 25+ messages in thread
From: Louis-Guillaume Gagnon @ 2014-01-30  1:57 UTC (permalink / raw)
  To: help-gnu-emacs

2014-01-29 Louis-Guillaume Gagnon <louis.guillaume.gagnon@gmail.com>:
> 2014-01-29 Stefan Monnier <monnier@iro.umontreal.ca>:
>> I wish I could point to a "doesnt-work-considered-harmful" diatribe.
>>
>
> Not a diatribe per se, but still a relevant read: How To Ask Questions
> The Smart Way
>
> glg


oops, forgot the link:

http://www.catb.org/esr/faqs/smart-questions.html

glg



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

* Re: code listp to determine wich os I'm running on
       [not found]   ` <mailman.13124.1391033590.10748.help-gnu-emacs@gnu.org>
  2014-01-29 22:27     ` Emanuel Berg
@ 2014-01-30  2:27     ` Rusi
  2014-01-30  2:47     ` Rusi
  2 siblings, 0 replies; 25+ messages in thread
From: Rusi @ 2014-01-30  2:27 UTC (permalink / raw)
  To: help-gnu-emacs

On Thursday, January 30, 2014 3:42:58 AM UTC+5:30, Renato wrote:
> Sorry Emanuel...
> what's wrong?

> (if (string= system-type "gnu/linux")
>      (setq percorso-variable "\home\renato\Dropbox\emacs_prof\")
>    (message "fatto"))
>    (if (string= system-type "windows-nt")
>        (setq percorso "c:/doc/Dropbox") ))

> It does,t works... :-(

A very common pattern (in 'normal' languages like C/Java etc) is like this

if cond1
   statement1
else if cond2
   statement2
else statement3

You could use an if in lisp for this, but many people prefer a cond

(cond (cond1 statement1)
      (cond2 statement2)
      (t statement3)
)

Look up
M-: (info "(elisp)Conditionals")
for how to write that -- getting the number of parentheses right is tricky for beginners.

Also for other neat shortforms like unless, when etc


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

* Re: code listp to determine wich os I'm running on
       [not found] <mailman.13113.1391020728.10748.help-gnu-emacs@gnu.org>
  2014-01-29 20:28 ` code listp to determine wich os I'm running on Emanuel Berg
  2014-01-29 21:14 ` Pascal J. Bourguignon
@ 2014-01-30  2:43 ` Rusi
  2014-01-30  3:47   ` Stefan Monnier
       [not found]   ` <mailman.13151.1391053674.10748.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 25+ messages in thread
From: Rusi @ 2014-01-30  2:43 UTC (permalink / raw)
  To: help-gnu-emacs

On Thursday, January 30, 2014 12:11:00 AM UTC+5:30, Renato wrote:
> Hi,
> I'm looking for some code to insert in my .emacs to determine wich s.o 
> I'm running.
> 've foud this code:
> _______________________________________
> ;; check OS type (cond((string-equalsystem-type"windows-nt") ; Microsoft 
> Windows (progn(message"Microsoft Windows") ) ) 
> ((string-equalsystem-type"darwin") ; Mac OS X (progn(message"Mac OS X") 
> ) ) ((string-equalsystem-type"gnu/linux") ; linux (progn(message"Linux") 
> ) ) )
> ________________________
> but I do't know lisp (I will learn it, of course...but not now...)
> I've understand that if I'm running Linux if I press F1-e, in the buffer 
> I can read "linux".

> But What do I have to do to set a particular path (setq load-path... to 
> start from if I click
> for my C-x f in emacs on linux or win?

Heres your code written a little more legibly and which you are trying to write
as using if

(cond ((string= system-type "windows-nt") (message "Microsoft Windows"))
      ((string= system-type "darwin")     (message "Darwin"))
      ((string= system-type "gnu/linux")  (message "Gnu/Linux"))
      (t                                  (message "Unknown system")))

[Ive only checked on linux]

Now you can replace those (message "...") calls with what you like

Mind you though setting load-path with a setq is a BAD idea
usually better to make small additions like this

(add-to-list 'load-path "~/.emacs.d/downloads")

Replace the string with whatever you want to add to the load-path


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

* Re: code listp to determine wich os I'm running on
       [not found]   ` <mailman.13124.1391033590.10748.help-gnu-emacs@gnu.org>
  2014-01-29 22:27     ` Emanuel Berg
  2014-01-30  2:27     ` Rusi
@ 2014-01-30  2:47     ` Rusi
  2 siblings, 0 replies; 25+ messages in thread
From: Rusi @ 2014-01-30  2:47 UTC (permalink / raw)
  To: help-gnu-emacs

On Thursday, January 30, 2014 3:42:58 AM UTC+5:30, Renato wrote:
> Sorry Emanuel...
> what's wrong?

> (if (string= system-type "gnu/linux")
>      (setq percorso-variable "\home\renato\Dropbox\emacs_prof\")
             ^^^^^
>    (message "fatto"))
>    (if (string= system-type "windows-nt")
>        (setq percorso "c:/doc/Dropbox") ))
               ^^^^^ 



> It does,t works... :-(

> Renato

You are setting different variables???


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

* Re: code listp to determine wich os I'm running on
  2014-01-30  2:43 ` Rusi
@ 2014-01-30  3:47   ` Stefan Monnier
       [not found]   ` <mailman.13151.1391053674.10748.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 25+ messages in thread
From: Stefan Monnier @ 2014-01-30  3:47 UTC (permalink / raw)
  To: help-gnu-emacs

> (cond ((string= system-type "windows-nt") (message "Microsoft Windows"))
>       ((string= system-type "darwin")     (message "Darwin"))
>       ((string= system-type "gnu/linux")  (message "Gnu/Linux"))
>       (t                                  (message "Unknown system")))

Please don't compare symbols with string= (which is meant for strings):

   (cond ((eq system-type 'windows-nt) (message "Microsoft Windows"))
         ((eq system-type 'darwin)     (message "Darwin"))
         ((eq system-type 'gnu/linux)  (message "Gnu/Linux"))
         (t                            (message "Unknown system")))


-- Stefan




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

* Re: code listp to determine wich os I'm running on
       [not found]   ` <mailman.13151.1391053674.10748.help-gnu-emacs@gnu.org>
@ 2014-01-30  4:01     ` Rusi
  2014-01-30 12:59       ` Rusi
  0 siblings, 1 reply; 25+ messages in thread
From: Rusi @ 2014-01-30  4:01 UTC (permalink / raw)
  To: help-gnu-emacs

On Thursday, January 30, 2014 9:17:26 AM UTC+5:30, Stefan Monnier wrote:
> > (cond ((string= system-type "windows-nt") (message "Microsoft Windows"))
> >       ((string= system-type "darwin")     (message "Darwin"))
> >       ((string= system-type "gnu/linux")  (message "Gnu/Linux"))
> >       (t                                  (message "Unknown system")))

> Please don't compare symbols with string= (which is meant for strings):

>    (cond ((eq system-type 'windows-nt) (message "Microsoft Windows"))
>          ((eq system-type 'darwin)     (message "Darwin"))
>          ((eq system-type 'gnu/linux)  (message "Gnu/Linux"))
>          (t                            (message "Unknown system")))

Whoops!

Actually I did have a vague uneasy feel on seeing those strings... Didn't look further


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

* Re: code listp to determine wich os I'm running on
  2014-01-30  4:01     ` Rusi
@ 2014-01-30 12:59       ` Rusi
  0 siblings, 0 replies; 25+ messages in thread
From: Rusi @ 2014-01-30 12:59 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, Jan 30, 2014 at 5:26 PM, Renato Pontefice wrote:
>
> Hi Rusi!
> it seem to work!
> _______________________________________________---
> (cond
>  ((eq system-type 'windows-nt)(setq default-directory "C:/Documents and Settings/renatop/Documenti/Dropbox/Documenti/org") )
>  ((eq system-type 'darwin)     (message "Darwin"))
>  ((eq system-type 'gnu/linux)  (setq default-directory "/home/renato/Dropbox/Documenti/org") )
>  (t                            (message "Unknown system")))
>
> for now, I've tested it on Win! And it works. This afternoon I will check  on Linux. I think I've understand.
>
> Thank you again
>
> Renato
>

Not sure what you are trying to do...

However globally setting a buffer-local variable like default-directory may not be what you want.
Maybe someone else can suggest a better variable.

Couple of things I can think of (for windows): You can change the 'start in' option of the emacs-shortcut
You can set the windows (not emacs!) variable HOME, ie set it in control-panel


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

* code listp to determine wich os I'm running on
@ 2014-01-31  8:39 Renato Pontefice
  0 siblings, 0 replies; 25+ messages in thread
From: Renato Pontefice @ 2014-01-31  8:39 UTC (permalink / raw)
  To: help-gnu-emacs

emh....doesn't works on linux :-(

this is the F1 e result
Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50asym
ptote.el (source)...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el
(source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el
(source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50festival.el (source)...done
Loading /etc/emacs/site-start.d/50psvn.el (source)...done
Loading /etc/emacs/site-start.d/50python-docutils.el (source)...done
Loading /home/renato/Dropbox/emacs_prof/.emacs...done
For information about GNU Emacs and the GNU system, type C-h C-a.

and this is the .emacs (part of...)
;;-----------setta la directory di default (dove aprire e salvare file) su
Dropbox a seconda del s.o. con cui si apre emacs

(cond
 ((eq system-type 'windows-nt)(setq default-directory "C:/Documents and
Settings/renatop/Documenti/Dropbox/Documenti/org") )
 ((eq system-type 'darwin)     (message "Darwin"))
 ((eq system-type 'gnu/linux)  (message "č linux"))

;; ((eq system-type 'gnu/linux)  (setq default-directory
"/home/renato/Dropbox/Documenti/org"))
 (t                            (message "Unknown system")))
(message system-type)

why....:-(


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

* code listp to determine wich os I'm running on
@ 2014-01-31  9:03 Renato Pontefice
  2014-01-31 13:28 ` Stefan Monnier
       [not found] ` <mailman.13357.1391175021.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 25+ messages in thread
From: Renato Pontefice @ 2014-01-31  9:03 UTC (permalink / raw)
  To: help-gnu-emacs

emh....doesn't works on linux :-(

this is the F1 e result
Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50asym
ptote.el (source)...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el
(source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el
(source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50festival.el (source)...done
Loading /etc/emacs/site-start.d/50psvn.el (source)...done
Loading /etc/emacs/site-start.d/50python-docutils.el (source)...done
Loading /home/renato/Dropbox/emacs_prof/.emacs...done
For information about GNU Emacs and the GNU system, type C-h C-a.

and this is the .emacs (part of...)
;;-----------setta la directory di default (dove aprire e salvare file) su
Dropbox a seconda del s.o. con cui si apre emacs

(cond
 ((eq system-type 'windows-nt)(setq default-directory "C:/Documents and
Settings/renatop/Documenti/Dropbox/Documenti/org") )
 ((eq system-type 'darwin)     (message "Darwin"))
 ((eq system-type 'gnu/linux)  (message "č linux"))

;; ((eq system-type 'gnu/linux)  (setq default-directory
"/home/renato/Dropbox/Documenti/org"))
 (t                            (message "Unknown system")))
(message system-type)

why....:-(


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

* Re: code listp to determine wich os I'm running on
       [not found] <mailman.13331.1391158986.10748.help-gnu-emacs@gnu.org>
@ 2014-01-31 11:57 ` Rusi
  0 siblings, 0 replies; 25+ messages in thread
From: Rusi @ 2014-01-31 11:57 UTC (permalink / raw)
  To: help-gnu-emacs

On Friday, January 31, 2014 2:33:01 PM UTC+5:30, Renato Pontefice wrote:
> emh....doesn't works on linux :-(

> this is the F1 e result
> Loading 00debian-vars...done
> Loading /etc/emacs/site-start.d/50asym
> ptote.el (source)...done
> Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
> Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
> Loading debian-ispell...
> Loading /var/cache/dictionaries-common/emacsen-ispell-default.el
> (source)...done
> Loading debian-ispell...done
> Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el
> (source)...done
> Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
> Loading /etc/emacs/site-start.d/50festival.el (source)...done
> Loading /etc/emacs/site-start.d/50psvn.el (source)...done
> Loading /etc/emacs/site-start.d/50python-docutils.el (source)...done
> Loading /home/renato/Dropbox/emacs_prof/.emacs...done
> For information about GNU Emacs and the GNU system, type C-h C-a.

> and this is the .emacs (part of...)
> ;;-----------setta la directory di default (dove aprire e salvare file) su
> Dropbox a seconda del s.o. con cui si apre emacs

> (cond
>  ((eq system-type 'windows-nt)(setq default-directory "C:/Documents and
> Settings/renatop/Documenti/Dropbox/Documenti/org") )
>  ((eq system-type 'darwin)     (message "Darwin"))
>  ((eq system-type 'gnu/linux)  (message "č linux"))

> ;; ((eq system-type 'gnu/linux)  (setq default-directory
> "/home/renato/Dropbox/Documenti/org"))
>  (t                            (message "Unknown system")))
> (message system-type)

> why....:-(

Heh Renato!

You need to tell us (beyond "its not working")

- what you did
- what you saw/received as response from the system
- what instead you wanted to see

Also please remember
- we dont know Italian (at least not most of us :D)
- there seem to be some encoding issues: (message "č linux")

I suggest you start once again by simply stating what you want to achieve


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

* Re: code listp to determine wich os I'm running on
  2014-01-31  9:03 Renato Pontefice
@ 2014-01-31 13:28 ` Stefan Monnier
  2014-01-31 23:01   ` Tassilo Horn
       [not found] ` <mailman.13357.1391175021.10748.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 25+ messages in thread
From: Stefan Monnier @ 2014-01-31 13:28 UTC (permalink / raw)
  To: help-gnu-emacs

> (message system-type)

This should signal an error, since system-type is not a string and is
hence inappropriate for the first arg of message.
So, if you don't see any error message in your *Messages*, that means
this bit of code was not executed.


        Stefan




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

* Re: code listp to determine wich os I'm running on
       [not found] ` <mailman.13357.1391175021.10748.help-gnu-emacs@gnu.org>
@ 2014-01-31 14:05   ` Rusi
  2014-01-31 17:02     ` Renato
       [not found]     ` <mailman.13385.1391187779.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 25+ messages in thread
From: Rusi @ 2014-01-31 14:05 UTC (permalink / raw)
  To: help-gnu-emacs

On Friday, January 31, 2014 6:58:36 PM UTC+5:30, Stefan Monnier wrote:
> > (message system-type)

> This should signal an error, since system-type is not a string and is
> hence inappropriate for the first arg of message.
> So, if you don't see any error message in your *Messages*, that means
> this bit of code was not executed.

>         Stefan

So you can do this instead

(message "System is %s" system-type)

[If you know printf in C this should make sense...  No?]


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

* Re: code listp to determine wich os I'm running on
  2014-01-31 14:05   ` Rusi
@ 2014-01-31 17:02     ` Renato
       [not found]     ` <mailman.13385.1391187779.10748.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 25+ messages in thread
From: Renato @ 2014-01-31 17:02 UTC (permalink / raw)
  To: help-gnu-emacs


> So you can do this instead
>
> (message "System is %s" system-type)
>
> [If you know printf in C this should make sense...  No?]

Ok, I've Done it. I've puteed it as a first line.
My last line of messages buffer...say:
"Loading /home/renato/Dropbox/emacs_prof/.emacs...done"

it seems like it execute the entire .emacs but not the (message...)
Why? :-(

Renato



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

* Re: code listp to determine wich os I'm running on
       [not found]     ` <mailman.13385.1391187779.10748.help-gnu-emacs@gnu.org>
@ 2014-01-31 17:15       ` Rusi
  2014-01-31 17:32       ` Rusi
  1 sibling, 0 replies; 25+ messages in thread
From: Rusi @ 2014-01-31 17:15 UTC (permalink / raw)
  To: help-gnu-emacs

On Friday, January 31, 2014 10:32:36 PM UTC+5:30, Renato wrote:
> > So you can do this instead
> > (message "System is %s" system-type)
> > [If you know printf in C this should make sense...  No?]

> Ok, I've Done it. I've puteed it as a first line.
> My last line of messages buffer...say:
> "Loading /home/renato/Dropbox/emacs_prof/.emacs...done"

> it seems like it execute the entire .emacs but not the (message...)
> Why? :-(

Do you know that your init file is being reached at all??

init file means either .emacs.d/init.el or .emacs (file)
Simple way to check -- put a bunch of open-parens without close
Like this in the file
((((((

You should see something like this on starting emacs

--------------------
Warning (initialization): An error occurred while loading `/home/renato/.emacs.d/init.el':

End of file during parsing: /home/renato/.emacs.d/init.el

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.
---------------------

If not then you need to match your notion of init file with emacs variable
'user-init-file'


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

* Re: code listp to determine wich os I'm running on
       [not found]     ` <mailman.13385.1391187779.10748.help-gnu-emacs@gnu.org>
  2014-01-31 17:15       ` Rusi
@ 2014-01-31 17:32       ` Rusi
  1 sibling, 0 replies; 25+ messages in thread
From: Rusi @ 2014-01-31 17:32 UTC (permalink / raw)
  To: help-gnu-emacs

On Friday, January 31, 2014 10:32:36 PM UTC+5:30, Renato wrote:
> > So you can do this instead
> > (message "System is %s" system-type)
> > [If you know printf in C this should make sense...  No?]

> Ok, I've Done it. I've puteed it as a first line.
> My last line of messages buffer...say:
> "Loading /home/renato/Dropbox/emacs_prof/.emacs...done"

And what does the first line of messages buffer say?




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

* Re: code listp to determine wich os I'm running on
  2014-01-31 13:28 ` Stefan Monnier
@ 2014-01-31 23:01   ` Tassilo Horn
  0 siblings, 0 replies; 25+ messages in thread
From: Tassilo Horn @ 2014-01-31 23:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> (message system-type)
>
> This should signal an error, since system-type is not a string and is
> hence inappropriate for the first arg of message.
> So, if you don't see any error message in your *Messages*, that means
> this bit of code was not executed.

And what you actually wanted do use is

  (message "Look mom, I'm running on %s!" system-type)

Bye,
Tassilo



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

end of thread, other threads:[~2014-01-31 23:01 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.13113.1391020728.10748.help-gnu-emacs@gnu.org>
2014-01-29 20:28 ` code listp to determine wich os I'm running on Emanuel Berg
2014-01-29 22:12   ` Renato
2014-01-29 23:26     ` Peter Dyballa
2014-01-30  0:11     ` Stefan Monnier
     [not found]   ` <mailman.13124.1391033590.10748.help-gnu-emacs@gnu.org>
2014-01-29 22:27     ` Emanuel Berg
2014-01-30  2:27     ` Rusi
2014-01-30  2:47     ` Rusi
2014-01-29 21:14 ` Pascal J. Bourguignon
2014-01-29 23:52   ` Emanuel Berg
2014-01-30  2:43 ` Rusi
2014-01-30  3:47   ` Stefan Monnier
     [not found]   ` <mailman.13151.1391053674.10748.help-gnu-emacs@gnu.org>
2014-01-30  4:01     ` Rusi
2014-01-30 12:59       ` Rusi
     [not found] <mailman.13331.1391158986.10748.help-gnu-emacs@gnu.org>
2014-01-31 11:57 ` Rusi
2014-01-31  9:03 Renato Pontefice
2014-01-31 13:28 ` Stefan Monnier
2014-01-31 23:01   ` Tassilo Horn
     [not found] ` <mailman.13357.1391175021.10748.help-gnu-emacs@gnu.org>
2014-01-31 14:05   ` Rusi
2014-01-31 17:02     ` Renato
     [not found]     ` <mailman.13385.1391187779.10748.help-gnu-emacs@gnu.org>
2014-01-31 17:15       ` Rusi
2014-01-31 17:32       ` Rusi
  -- strict thread matches above, loose matches on Subject: below --
2014-01-31  8:39 Renato Pontefice
2014-01-30  1:55 Louis-Guillaume Gagnon
2014-01-30  1:57 ` Louis-Guillaume Gagnon
2014-01-29 18:41 Renato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).