* setting line-length for mediawiki-mode?
@ 2017-03-16 16:51 Sharon Kimble
2017-03-16 17:51 ` hector
0 siblings, 1 reply; 6+ messages in thread
From: Sharon Kimble @ 2017-03-16 16:51 UTC (permalink / raw)
To: help-emacs
[-- Attachment #1: Type: text/plain, Size: 607 bytes --]
I'm trying to set the line length for mediawiki mode, I'm using this -
--8<---------------cut here---------------start------------->8---
(toggle-truncate-lines 0) ; do not truncate
(abbrev-mode 1)
(set-fill-column 65000)
(auto-fill-mode 0)
--8<---------------cut here---------------end--------------->8---
But I want it to be mediawiki specific, but how do I do it please?
Thanks
Sharon.
--
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = http://www.drugfacts.org.uk
Debian 8.6, fluxbox 1.3.5-2, emacs 25.1.1.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: setting line-length for mediawiki-mode?
2017-03-16 16:51 setting line-length for mediawiki-mode? Sharon Kimble
@ 2017-03-16 17:51 ` hector
2017-03-16 19:08 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: hector @ 2017-03-16 17:51 UTC (permalink / raw)
To: Sharon Kimble; +Cc: help-gnu-emacs
On Thu, Mar 16, 2017 at 04:51:10PM +0000, Sharon Kimble wrote:
>
> I'm trying to set the line length for mediawiki mode, I'm using this -
>
> --8<---------------cut here---------------start------------->8---
> (toggle-truncate-lines 0) ; do not truncate
> (abbrev-mode 1)
> (set-fill-column 65000)
> (auto-fill-mode 0)
> --8<---------------cut here---------------end--------------->8---
>
> But I want it to be mediawiki specific, but how do I do it please?
>
I think you could use a hook if this mode uses hooks.
Add to your .emacs
(add-hook 'mediawiki-mode-hook
'(lambda ()
(toggle-truncate-lines 0) ; do not truncate
(abbrev-mode 1)
(set-fill-column 65000)
(auto-fill-mode 0)))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: setting line-length for mediawiki-mode?
2017-03-16 17:51 ` hector
@ 2017-03-16 19:08 ` Stefan Monnier
2017-03-16 20:52 ` Alex Kost
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2017-03-16 19:08 UTC (permalink / raw)
To: help-gnu-emacs
> '(lambda ()
Running for the Useless Use of Quote award?
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: setting line-length for mediawiki-mode?
2017-03-16 19:08 ` Stefan Monnier
@ 2017-03-16 20:52 ` Alex Kost
2017-03-16 21:20 ` hector
2017-03-17 19:45 ` Nathanael Schweers
0 siblings, 2 replies; 6+ messages in thread
From: Alex Kost @ 2017-03-16 20:52 UTC (permalink / raw)
To: hector; +Cc: help-gnu-emacs
Stefan Monnier (2017-03-16 15:08 -0400) wrote:
>> '(lambda ()
>
> Running for the Useless Use of Quote award?
To make it clear: Stefan wanted to say that there is no point to quote
lambda; see <https://www.emacswiki.org/emacs/QuotedLambda> for details.
I would also advise to avoid putting lambdas in hooks. The reason is:
what if you would want to remove it from hook? If you added a function
name to a hook, it would be much easier to remove it. For example:
(defun some-stuff-for-mediawiki ()
(toggle-truncate-lines 0)
(abbrev-mode 1)
(set-fill-column 65000)
(auto-fill-mode 0))
(add-hook 'mediawiki-mode-hook 'some-stuff-for-mediawiki)
Now if you want to remove this function from the hook, you can do it
simply by evaluating:
(remove-hook 'mediawiki-mode-hook 'some-stuff-for-mediawiki)
--
Alex
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: setting line-length for mediawiki-mode?
2017-03-16 20:52 ` Alex Kost
@ 2017-03-16 21:20 ` hector
2017-03-17 19:45 ` Nathanael Schweers
1 sibling, 0 replies; 6+ messages in thread
From: hector @ 2017-03-16 21:20 UTC (permalink / raw)
To: Alex Kost; +Cc: help-gnu-emacs
On Thu, Mar 16, 2017 at 11:52:36PM +0300, Alex Kost wrote:
> Stefan Monnier (2017-03-16 15:08 -0400) wrote:
>
> >> '(lambda ()
> >
> > Running for the Useless Use of Quote award?
>
> To make it clear: Stefan wanted to say that there is no point to quote
> lambda; see <https://www.emacswiki.org/emacs/QuotedLambda> for details.
Thanks for the explanation. That's what I thought.
Very cryptic though :-)
Blame it on the Emacs manual 23.2 (yes, I know). It's been fixed in
newer versions.
> I would also advise to avoid putting lambdas in hooks. The reason is:
> what if you would want to remove it from hook? If you added a function
> name to a hook, it would be much easier to remove it. For example:
>
> (defun some-stuff-for-mediawiki ()
> (toggle-truncate-lines 0)
> (abbrev-mode 1)
> (set-fill-column 65000)
> (auto-fill-mode 0))
>
> (add-hook 'mediawiki-mode-hook 'some-stuff-for-mediawiki)
>
> Now if you want to remove this function from the hook, you can do it
> simply by evaluating:
>
> (remove-hook 'mediawiki-mode-hook 'some-stuff-for-mediawiki)
Got it.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: setting line-length for mediawiki-mode?
2017-03-16 20:52 ` Alex Kost
2017-03-16 21:20 ` hector
@ 2017-03-17 19:45 ` Nathanael Schweers
1 sibling, 0 replies; 6+ messages in thread
From: Nathanael Schweers @ 2017-03-17 19:45 UTC (permalink / raw)
To: Alex Kost; +Cc: help-gnu-emacs, hector
Alex Kost <alezost@gmail.com> writes:
Just a small remark: If I recall correctly, it’s better to
function-quote function arguments, so this code:
> (add-hook 'mediawiki-mode-hook 'some-stuff-for-mediawiki)
should rather look like this:
(add-hook 'mediawiki-mode-hook #'some-stuff-for-mediawiki)
This has the benefit of adding some compiler warning in case it cannot
be known that the function will be defined.
If I’m not entirely mistaken, it might even be good for performance, as
the function value of the passed symbol (in the first form) has to be
looked up every time it’s called, while the second form gives the
function object directly. Take this last piece of “advice“ with a grain
of salt though.
In any case, #' is read syntax for function-quote, just as ' is read
syntax for quote.
-- Nathanael Schweers
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-03-17 19:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-16 16:51 setting line-length for mediawiki-mode? Sharon Kimble
2017-03-16 17:51 ` hector
2017-03-16 19:08 ` Stefan Monnier
2017-03-16 20:52 ` Alex Kost
2017-03-16 21:20 ` hector
2017-03-17 19:45 ` Nathanael Schweers
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.