From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: Functions that need X Date: Mon, 03 Jan 2011 09:46:50 +1100 Organization: Unlimited download news at news.astraweb.com Message-ID: <87k4imncth.fsf@puma.rapttech.com.au> References: <87sjxcv2ld.fsf@Compaq.site> <8739pcwake.fsf@puma.rapttech.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1294011647 30106 80.91.229.12 (2 Jan 2011 23:40:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 2 Jan 2011 23:40:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 03 00:40:43 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PZXXV-00073f-Ut for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jan 2011 00:40:42 +0100 Original-Received: from localhost ([127.0.0.1]:45914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZXXV-0002XH-ER for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Jan 2011 18:40:41 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!news2.google.com!news.glorb.com!news-xfer.nntp.sonic.net!news.astraweb.com!border2.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:g1Xl6MGDyIEWLv+z4sy0ChmDyDk= Original-Lines: 91 Original-NNTP-Posting-Host: 1bd18c29.news.astraweb.com Original-X-Trace: DXC=[j5[Of=R?0Z[[POhj[h0F\L?0kYOcDh@Z7^o:UA4R?cUF8TiH9LRjfQ]G; 2>V^?kWSCAkl5c@Xgk^PJKWXSIE`:_=ToAo=^IlmV Original-Xref: usenet.stanford.edu gnu.emacs.help:183867 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:78078 Archived-At: Barry Margolin writes: > In article <8739pcwake.fsf@puma.rapttech.com.au>, > Tim X wrote: > >> Cecil Westerhof writes: >> >> > I have a lot of functionality written for my Emacs. I was asked to >> > maintain a server for a friend. I installed Emacs there and put my >> > Emacs functionality there also. But some things are depending on X. >> > Because of this I made those depended working with X. In the start of >> > my .emacs I have: >> > (defconst +using-X+ (getenv "DISPLAY")) >> > >> >> Alternatively, just use the built-in variable window-system i.e. >> >> (unless (eq 'x window-system) >> ....) >> >> or even better, use one of the display capability predicates, such as >> >> (unless (display-graphic-p) >> ...) >> >> > And where I use X-functionality (not much at the moment) I have: >> > (unless (not +using-X+) >> > (set-scroll-bar-mode 'right) >> > (tool-bar-mode -1)) >> >> Do you actually need the above? Long time since I've used emacs in a >> non-graphics mode, but when I did, you didn't get things like tool-bar >> unless the display could support it. > > The reason is that if the display doesn't support it these functions > aren't even defined, so you get an error when you try to turn off the > nonexistent tool bar. Actually, in emacs 24.0.50, you can call tool-bar-mode with no problems from the console - it doesn't appear to do anything if the display cannot handle tool-bars. You are correct, set-scroll-bar-mode does not exist under the console. I also find the documentation for that command a bit weak i.e. ,----[ C-h f set-scroll-bar-mode RET ] | set-scroll-bar-mode is a compiled Lisp function in `scroll-bar.el'. | | (set-scroll-bar-mode VALUE) | | Set `scroll-bar-mode' to VALUE and put the new value into effect. `---- Documentation of that type reminds me of code comments you see like x := 3; // set x to 3 100% accurate and 100% useless! I think this one deserves a bug report. The documentation should at least give some indication on what the allowed values for 'VALUE' are and what they would do. > > It probably would be better if there were stub versions of all these > functions in console Emacs, so that they would just be ignored. But > since there aren't, you need to check first. I'd not noticed this before as I use Xresources to disable much of this sort of thing in my .emacs, but I think your correct and a stub for this under non-scrolling environments whould be useful. I suspect the reason it doesn't happen is to avoid namespace pollution and loading of unnecessary packages (thinking that any stub would likely be part of scroll-bar.el and without careful or considerable re-engineering, may be difficul to only load sufficient code to just handle that endge case without also loading lots of other unnecessary stuff - not a reason not todo it, but possibly explains why it has not been done). I suspect this is also one of those situations where custom has an advantage over hand crafted code in .emacs i.e. disabling scroll bars using custom does not cause errors when run under the console. I think I'll log a bug report for set-scroll-bar-mode. If it is a consistent mode and follows the norms for +/- 1 or nil etc, it should jus say that. Tim -- tcross (at) rapttech dot com dot au