emacs - Elisp में ऑपरेटिंग सिस्टम कैसे निर्धारित करें?
(5)
अब विंडोज के लिए लिनक्स सबसिस्टम भी है (विंडोज 10 के तहत बैश) जहां system-type
gnu/linux
। इस सिस्टम का उपयोग करने के लिए प्रकार का उपयोग करें:
(if
(string-match "Microsoft"
(with-temp-buffer (shell-command "uname -r" t)
(goto-char (point-max))
(delete-char -1)
(buffer-string)))
(message "Running under Linux subsystem for Windows")
(message "Not running under Linux subsystem for Windows")
)
मैं प्रोग्रामैटिक रूप से यह निर्धारित कैसे करूं कि ईएलआईएसपी में कौन सा ओएस एएक्स चल रहा है?
मैं ओएस के आधार पर .emacs
में अलग कोड चलाने के लिए चाहता हूँ।
एक .emacs में, न केवल system-type
, बल्कि window-system
चर भी है। यह तब उपयोगी होता है जब आप कुछ एक्स केवल विकल्प, या टर्मिनल या मैकोज़ सेटिंग के बीच चयन करना चाहते हैं।
यदि आप निर्माण प्रणाली में अंतर के लिए समायोजित करना चाहते हैं, तो भी (24/25 कम से कम) system-configuration
में है।
यह ज्यादातर पहले से ही उत्तर दिया गया है, लेकिन रुचि रखने वालों के लिए, मैंने अभी फ्रीबीएसडी पर इसका परीक्षण किया और वहां बताया गया मूल्य "बर्कले-यूनिक्स" था।
system-type
चर:
system-type is a variable defined in `C source code'.
Its value is darwin
Documentation:
Value is symbol indicating type of operating system you are using.
Special values:
`gnu' compiled for a GNU Hurd system.
`gnu/linux' compiled for a GNU/Linux system.
`darwin' compiled for Darwin (GNU-Darwin, Mac OS X, ...).
`ms-dos' compiled as an MS-DOS application.
`windows-nt' compiled as a native W32 application.
`cygwin' compiled using the Cygwin library.
Anything else indicates some sort of Unix system.