In my org-mode file, I have a bunch of level 1 headings. I want to highlight some of them and demote them by one level to level 2. How do I do this? When I highlight the region and do M-S-right, I get This command is active only in special context like tables, headlines or items.
You want to use M-right rather than M-S-right.
Here, at least, a sort-of workaround solution: use regexp-replace to change "^*" into "". That should do the job, even if not in a pure Org way.
Related
In TeX-latex-mode under Emacs (26.1) using the reftex minor mode,
When pressing C-c (, the command reftex-label (found in reftex-mode-map, from reftex-ref.el) gives pretty good suggestions of label according to context for sections (with the default value of reftex-insert-label-flags).
When pressing C-c C-s, the command LaTeX-section (found in LaTeX-mode-map, defined in latex.el) offers to enter a label for the section, with no suggestion (other than a prefix based on the level of the section, which is useful but much less than the one based on the title section offered by reftex-label).
How can one configure LaTeX-section to make the same suggestions as reftex-label for sections?
The hook LaTeX-section-hook along with the variable LaTeX-section-label would seem the right candidate for that purpose, but the documentation states that
Some LaTeX packages (such as fancyref) look at the prefix to
generate some text around cross-references automatically. When using
those packages, you should not change this variable.
for one, I assume that reftex is one of such packages, and second, I was expecting to be able to give a function inside a hook, not a list of prefixes, I wonder if I misunderstood what a hook is?
I think that one would "just" need to get LaTeX-section to abstain from offering a label and to call the function reftex-label immediately after each LaTeX-section call, but if it is not LaTeX-section-hook, I do not know which one it could be?
Before starting programming something which could involve stuff as complicated as refactoring both latex.el and reftex-ref.el, I thought I would ask in case I was missing an easier solution!!!
On wider tables in org mode, it is hard to see the current line.
In emacs org mode table, is there a way to display different background for the current row, or alternate background for even/odd rows?
(I am not concerned with export, although if the even/odd alternate background would export that would be great as well)
Thanks
Not that I know of, but (when editing) you can use M-x hl-line-mode to clearly see the current row highlighted.
The package stripe-buffer provides stripe-table-mode which provides odd/even row highlighting for org tables. (It also gives you stripe-listify-buffer which provides similar row highlighting for any list-style buffer like dired, ibuffer, etc.)
The slrn newsreader has an attractive interface with different colours for the author, subject and date columns when browsing list of articles in a newsgroup. I am looking for the Emacs font/face variables for these fields in gnus, but have not been able to find them. The gnus manual for faces does not list the available faces and none of the faces list in Emacs (M-x customize-face gnus-... looks relevant. I am using gnus 5.13 in Emacs 23.2.1.
(This question is not related to displaying "faces" (icons/avatars) in Emacs or gnus.)
Solved: See my answer below.
I think they're scattered a bit in the gnus codebase. The faces used in the article buffer are probably in gnus-art.el, etc.
It sounds like your biggest problem is that there are specific faces that you can't find the symbol for. You can always do M-x describe-face to see what is under the cursor to solve that problem.
Also, (face-list) returns a list of all defined faces. You could scan that list looking for things that look like likely candidates for the particular faces you're interested in.
The format string for various elements in gnus can be customized by modifying the appropriate variable. The variable for the summary line is gnus-summary-format-line. I am not using the default value for this variable, but instead am using the value %U%R%z %(%&user-date; %-15,15f %* %B%s%)\n.
As described here, a new face can be applied to any (sub)section of a format line by bracketing the section with %1{ and %}, where the 1 in this example corresponds to gnus-face-1. gnus-face-1 in my installation defaults to "italics", so adding the following to my ~/.emacs file results in the author in the summary line appearing in italics:
(setq gnus-summary-line-format "%U%R%z %(%&user-date; %1{%-15,15f%} %* %B%s%)\n")
I go with M-x list-faces-display (which opens a new buffer with all the currently defined face variables fontified to the color that they're set to, in alphabetic order) when I want to see what faces I need to change to get a mode working.
Then I setq them, using either the format from color-theme or from the new emacs built-in theme format, depending on which version of emacs I'm in.
Is it possible to select a piece of text you're editing and change its color? I know it's possible to create a color theme that will color certain kinds of text (like for example coloring functions in a certain programming language), but is it possible to do a one time color change to a selected piece of text in a specific emacs document without creating a theme? thanks in advance.
A theme doesn't allow you to specify the color of arbitrary text in any case. It only describes a set of face to be used by font-lock.
To apply a face to an arbitrary piece of text, select the text, then M-: (add-text-properties (region-beginning) (region-end) '(face font-lock-warning-face))
See the faces section of the elisp manual on how to create a face.
Emacs also comes with the hi-lock package, which can highlight regexps or lines containing regexps. See manual
how about M-x highlight-phrase ?
I know six years is a pretty long time, but I stumbled across this question and, after a lot of research, I did not find anything nearly as objective as what I eventually dug out for myself.
To color say, the first 200 characters in your buffer, execute the command:
(put-text-property 1 200 'face (cons 'foreground-color "red"))
If you need help executing this command in emacs, here is one possibility among many:
Type ESC-x eval-expression.
Type or paste the above command in the mini-buffer after the prompt.
Press ENTER.
You might like to look at enriched-mode.
If you are in a buffer that isn't controlled by font-lock, you can use 'facemenu'.
For example, highlight a bit of text, then with the mouse, press C-mouse-2. You can then select a face (some combination of text properties with a name). You can also pick random forground or background colors.
If you Emacs is particularly old, I seem to remember something similar on M-g.
Try set-background-color, set-foreground-color, set-cursor-color.
Changes won't be saved with the document though.
Note:
When I try those functions, they don't set the region's color unless I go through the menus.
See http://www.emacswiki.org/emacs/HighlightTemporarily (and it need not be temporary).
You can "color" text by swiping it with the mouse, or matching it with a regexp, and several other ways. Library highlight.el, in particular, lets you "color" text in many ways.
Is there a way to tell org-mode to load only the first N lines of a long text file? I would like to keep the whole file open to be able to search through it, but have org-mode display on the first N lines of my file, which is where I edit new content.
If you have a structured outline in org-mode, you can set the global file visibility with the #+STARTUP markup, or the visibility of any heading with the VISIBILITY property, see Visibility Cycling for details. The benefit of using the built-in org-mode properties is that it's easy to have a file open up in exactly the state you want.
I have my journal file set up to accomplish something similar what I think you're asking for using these org-mode properties. The "Today" section is opened so I can see everything, but older archives are collapsed.
I'm not sure the title really fits the description?
I think you just want use buffer narrowing, which lets you hide everything outside of the specified region for as long as necessary.
You can manually narrow the buffer by marking the region and typing C-xnn
Widen the display back to the full buffer with C-xnw
I guess you could use an eval Local Variable to automate this to a pre-defined region, if you really wanted to.
There's also narrow-to-defun (C-xnd) and narrow-to-page (C-xnp). If you throw a page break into your org file (C-qC-l), the latter might prove handy.