Is there a way to turn off visual-line-mode within Emacs Org-mode tables?
I very much like how visual-line-mode works in Org-mode, except when it wraps wide tables, making them unreadable.
Maybe seven years ago, Carsten Dominik (Org-mode founder) asked the Emacs maintainers for line-by-line control of visual-line-mode, and he indicated that he got a positive response. Did that get implemented, and has anyone put it to use for Org-mode tables?
There is the phscroll which uses overlays around org-table to make this work.
(via)
Related
I am using org-mode within Emacs.
The problem is after issuing C-c > or C-c .
org-mode insert date like below,
(firstly it appears within the minibuffer, even the editing file is encoded with utf-8)
<2012-12-09 \326\334\310\325>
How to resolve this issue? My OS is Win7 32bit Chinese version.
Basically, I think the fonts emacs is using are not able to display the way the day is spelled in your language. I'd guess you lack some installed fonts, or emacs doesn't know where to find them, but I'm not sure how to fix this.
That being said, inserting such octal escapes into my emacs gives me ÖÜÈÕ, which I don't believe to be how days spell in many languages. The file might be encoded in utf-8, but what about the buffer ? What's the buffer-file-coding-system variable in that buffer (C-h v buffer-file-coding-system) ?
The variables calendar-day-name-array and org-time-stamp-custom-formats might be of interest, and I guess you could override how the timestamps appear right now with org-display-custom-times, that would probably be a workaround. See the manual for more about it.
At last, I have
(set-language-environment "UTF-8")
(prefer-coding-system 'utf-8)
in my config, functions you may want to investigate about.
I met the same problem to yours.
Through a long time searching online, I found (setq system-time-locale "C") work.
I tried to fix this problem in August, 2014.
My solution is adding the following code into your Emacs config file:
(set-locale-environment "zh_CN.utf-8")
Note that the time will be displayed in Chinese. Hope it helps.
For the last 3 years, my work required writing and editing configuration files in xml format. The content in the xml tags has evolved so much that now it has become kind of like a programming language. Unfortunately, emacs indents everything inside the tags at the same level. Something like this:
But it'd be wicked if I could get the content indented like the following:
I've read several threads related to custom indentation, but I still don't have any clue how to do it.
I've tried to create a custom major-mode, but doing that killed all the syntax colors and indentation rules. Ideally what I'd like to do is just modify the nxml mayor mode indentation rules? Still, I don't know where about this rules are.
Also it would be a bonus if I could color some key words, like 'if' or 'set'.
I know that what I'm asking is a big job, so I'm not asking for a definitive answer here. I'm just looking for some help to point me to the right direction.
Probably the best way to do it is writing a new major mode for the language inside the tags and then using a multiple major modes package which allows more than one major modes to be active in the same file, so the contained language can have its own major mode.
You might want to have a look at this example.
(defun nxml-extra-space-indent ()
(nxml-indent-line)
(when (zerop (current-indentation))
(indent-line-to 4)))
(setq indent-line-function 'nxml-extra-space-indent)
I indent according to an existing major mode, and then customize the indentation if the line matches certain criteria.
I think this is the easiest way to customize indentation, as you are starting from something existing, and you don't need to know how the indentation logic of a particular mode is implemented.
There are several questions on SO about how to get code folding in emacs, without having to add any special characters like "markers" in the comments for example. Someone said that there was "no perfect solution."
It seems that it could be done by parsing the source of the program being written and look for matching parenthesis or bracket, or to do it based on indentation. You could also use a combination of scripts that use different methods.
So why is it commonly accepted that there is no "perfect" and straightforward way to get code-folding in emac? Is there something in emacs or its architecture that makes it hard to program? If it were easy, after so many years of smart people using emacs you would think that someone would have wrote it.
You should play with Hideshow (hs-minor-mode) combined with fold-dwim.el. It does exactly what you suggested -- looks for matching braces/parens, and can be set up to fall back on the indentation.
There's a robust folding solution out there for most common languages, and if there isn't, all the folding packages are highly customizable. In fact, the only downside is the proliferation of folding methods (fold-dwim helps quite a bit with that); I used to think that because nobody could point me to a definitive solution, folding was hard or impossible — in fact, the opposite is true. You just have to experiment a little to see what works best for you.
I have used folding.el (e.g. to group stuff in my .emacs), outline-minor-mode, and now Hideshow. There's some chance that none of them would work exactly the way you want right out of the box (e.g. you might need to set up an outline regex, or define folding marks for folding.el), but it turns out to be easy. The default keybindings can be somewhat baroque, but this is remedied by fold-dwim and/or hideshow-org (highly recommended for Hideshow, cf the Emacswiki hideshow page; you can also mimic hideshow-org's behavior for other folding modes with some quick-and-dirty elisp and fold-dwim). Once you figure out your preferred setup, just turn it on automatically via hooks or buffer-local variables, and watch your code fold away :)
You should look into CEDET. It does code-folding just fine, and many other fancy features that you're probably looking for if you're switching from an IDE to Emacs.
http://cedet.sourceforge.net/
Specifically, look for `global-semantic-tag-folding-mode'
You don't need anything extra, just enable outline-minor-mode for file types you want to fold.
But in fact, there ARE various solutions for Emacs; I have listed some of them (those I have happened to come across) at http://en.wikipedia.org/w/index.php?title=Code_folding&oldid=375300945#cite_note-2.
Though, there are things I'm missing: in some cases, I'd like to combine several mechanisms: for example, for markdown, I'd like to use outline-based folding (for sections) and indentation-based folding (for quotations, code blocks etc.) -- in order not bother with implementing a complete parser for markdown.
Here they are:
Token-based folding in Emacs
Token-based folding in Emacs is impemented by the folding minor mode.
Indentation-based folding in Emacs
One can use the set-selective-display function in Emacs to hide lines based on the indentation level, as suggested in the Universal code folding note.
Syntax-dependent folding in Emacs
Syntax-dependent folding in Emacs is supported by:
the outline and allout modes
for special dedicated "outline"-syntaxes;
by the hideshow minor mode for some programming languages;
also,
by the semantic-tag-folding minor mode and the
senator-fold-tag command for
syntaxes supported by semantic,
as well as by doc-mode for JavaDoc or Doxygen comments,
by
TeX-fold-mode
sgml-fold-element command,
nxml-outln library
in the corresponding language-specific modes, and possibly in other modes for particular syntaxes.
Several folding mechanisms are unified by the
fold-dwim interface.
See also http://www.emacswiki.org/emacs/CategoryHideStuff.
Folding of user-selected regions in Emacs
Folding of user-selected regions in Emacs is implemented by the hide-region-hide command.
I have been using folding-mode for quite some time. With auto-insert template and abrevs it works quite well for me for for some nice bricks of code.
Being able to produce the buffer folded (for printing/emailing) has always been a desire of mine. Some of my folding tags are for secure / password hiding.
I know this is a bit old but for me origami.el works perfectly well out of the box.
Yes Finally code folding is there in emacs. Try yafolding present at melpa.org package library.
I use emacs to edit most of my answers for SO, and although I use longlines-mode (I have not upgraded to emacs 23 because of some critical bugs that don't look like being fixed any time soon), I can't find a way to get longlines-mode to respect the indentation used for Markdown. I would really like to fix this, but I want it for an ordinary buffer, not for org-mode (as already answered).
Does anybody have suggestions on how I can get longlines-mode to indent wrapped lines? I am definitely willing to try hacking the Emacs Lisp, although my Emacs Lisp is pretty rusty...
I just looked through the source code of longlines.el. There doesn't seem to be any hook there to have the wrapped lines indented. If you want to do this, you'll need to write a bit of elisp (and, more importantly, understand all of the functions for doing text-properties.)
I want to fully-justify latex code on EMACS so that my latex code will look better. For example, I remember my advisor sending me latex in fully justified way like this:
In ~\cite{Hummel2004}, authors described an approach for harvesting
software components from the Web. The basic idea is to use the Web as
the underlying repository, and to utilize standard search engines,
such as Google, as the means of discovering appropriate software
assets. Other researchers have crawled through Internet publicly
available CVS repositories to build their own source code search
engines (e.g., SPARS-J)~\cite{Matsushita2005}.
I suppose that his column-width is set to 70 columns.
Could someone give me a hint?
The standard fill.el package includes the command justify-current-line which is part of what you need. From the function help:
Do some kind of justification on this line.
Normally does full justification: adds spaces to the line to make it end at
the column given by `current-fill-column'.
Optional first argument how specifies alternate type of justification:
it can be `left', `right', `full', `center', or `none'.
If how is t, will justify however the `current-justification' function says to
And other posters have already given you the magicall invokation:
M-x set-justification
As a philosophical side note, the point of fixed-wdith text justification is to fake real typography on a inflexible output device. So applying it to LaTeX source seems a little odd to me. Moreover, I have been using the "one sentence to a line" approach to LaTeX documents for some months now, and find that it really does improves both the editability and the source-control behavior of LaTeX, so I would recommend against doing this.
If you select the region, and then press Ctrl-u M-x fill-region you get "full justification".
M-x set-justification-full
Use Refill mode afterwards to not have to run the command again after typing.
To get line wrap in the file itself (as opposed to something like longlines-mode that does not alter the structure of the file), I use auto-fill-mode, which automatically applies M-q (fill-paragraph) to each paragraph. For example, I use auto-fill-mode in mail-mode. You could do something similar with your LaTeX mode with a hook like this:
(add-hook 'TeX-mode-hook 'turn-on-auto-fill)
Assuming your TeX mode's hook is TeX-mode-hook.