missing complete candidate for c++-mode with company-mode - emacs

As the picture shows above, it has missed the operator=(const Name &other) candidate.
Confused!

Related

Getting reftex recomendations for labels when creating new sections

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!!!

Org-mode beamer - How to create a short title, author, date?

Is there any easy way in adding a short title, author, date, etc. in the .org file, without messing around with the generated .tex file?
My (in progress) Org Beamer refcard could help you.
See on https://github.com/fniessen/refcard-org-beamer, in particular the section "Creating a title page".
UPDATE -- Something like the following would do it?
#+BIND: org-latex-title-command "\\title{De leerplandoelstellingen}\n\\date[mei 2014]{9 mei 2014}\n\\maketitle"
(that's a way to fiddle with the title, but directly from the Org file...)
Yes you can define #+SHORT_TITLE but it involves editing 2 elisp files. You need to find your ox.el and ox-beamer.el files, mine are located in the ~/.emacs.d/elpa/org-20150330 directory. There are also some compiled files ox.elc and ox-beamer.elc. I recommend you create a backup of all these files before continuing.
In file ox.el go to line 118 and add the short_title line as shown below:
114│ (:section-numbers nil "num" org-export-with-section-numbers)
115│ (:select-tags "SELECT_TAGS" nil org-export-select-tags split)
116│ (:time-stamp-file nil "timestamp" org-export-time-stamp-file)
117│ (:title "TITLE" nil nil space)
118│ (:short_title "SHORT_TITLE" nil nil space) ;; Additional line
119│ (:with-archived-trees nil "arch" org-export-with-archived-trees)
120│ (:with-author nil "author" org-export-with-author)
121│ (:with-clocks nil "c" org-export-with-clocks)
122│ (:with-creator nil "creator" org-export-with-creator)
Save the file. Remove th ox.elc file (ensure you have a backup) and byte compile the file. This can be done from within emacs using M-x byte-compile-file and entering the file name, ensure it completes without error.
Then open file ox-beamer.el and make the following changes.
860│ ;; 7. Title
861│ (let ((short_title (plist-get info :short_title)))
862│ (format "\\title[%s]{%s}\n" short_title title))
Save, remove the old ox-beamer.elc and byte compile. Restart emacs and you can now use #+SHORT_TITLE: as you wish.
Your line numbers may be different but I've included the surrounding code so you should be able to find/replace easily.
I use this to achieve the same effect:
#+TITLE: Short title
#+BEAMER_HEADER: \subtitle{long title}
This requires that you make the two titles play well together, so it does not look silly.
Credit: Learnt about the BEAMER_HEADER thing from https://github.com/fniessen/refcard-org-beamer
I understand this is an old question. I got here while searching for a solution to the same problem. And I thought others in the same boat may benefit from a cleaner solution.
Including the following before/after #+TITLE: should do the job:
#+BEAMER_HEADER: \title[short title]{long title}
Note that it replaces whatever you set in the #TITLE: line. Of course, I'm not sure if this was a possibility at the time OP asked the question.

Netbeans: Auto-replace emtpy with empty

I'm doing a lot of php-programming in Netbeans. It occurs like at least once a day that I write emtpy instead of empty (dunno why). Costs me each time at least 15s to test, see and find the mistake and correcting it (and I'm really annoyed each time).
Is there an option to automatically replace every emtpy with empty or at least highlighting it (like with big fat flashy arrows? :P)
Couldn't find anything of the sort with a quick search.
Thanks for any suggestion!
P.S.: I want it to be like in Word, when you type the first two characters in CApital it will auto replace it by only the first letter Capital. Please see comments as well, before replying.
No a real solution but maybe an improvement of your situation:
You could (mis)use a code template for that: Tools / Options / Editor / Code Templates. Select your language and create a new abbreviation (empyt) and as "expanded text" you use "empty". Make sure to set "Expand Template on" to "Space".
Drawback is, that it only works if you are pressing space after typing "empty" or "empyt".

What does "SAVED and set. (mismatch)" (and in particular the "mismatch" part) mean in emacs customize?

I was just trying to customize some org-mode export settings in emacs, and so I did M-xcustomize-grouporg-export-html. This brought up by Customize buffer, and, among other things, I went about changing the org-export-html-postamble-format to something more to my liking.
Possibly relevant: During this process, I'd used a few C-o's to open new lines, so the value would look nice to me on the screen, and I could tell what I was doing. When satisfied, I clicked on the State button, and chose Save for Future Sessions. Because (I presume) of the C-o newlines, it then said:
CHANGED outside Customize; operating on it here may be unreliable. (mismatch)
So, I then chose Reset to Saved, which got rid of that, but replaced it with this:
SAVED and set. (mismatch)
OK, so... all is well... except... In both of those lines, what does (mismatch) mean? That there's a mismatch between what's saved in my emacs init file and what I'm looking at? That there's a mismatch between... Well, looking around further, I even see some customize entries that say:
STANDARD. (mismatch)
Standard and mismatch? (There are others which just say STANDARD., by the way.)
I want to understand what "mismatch" means. Any hints?
Thanks!
Addenda:
I just went digging a little in cus-edit.el, and found this in the comments:
;; 8. mismatch
;; The widget value is not valid member of the :type specified for the
;; option.
This helps, a little... does it just mean that org-mode's type specifier is wrong? Looking at that (in org-html.el), it specifies :type 'string, but in reality it seems to be a plist (even its default value is of the form '(("en" "[data here]")).) Is this just bad cleanliness on the part of org-mode? But then, even another variable in here says "mismatch", but seems logically to have a value that makes sense. The value is t (and I checked in my emacs init, and it's just the symbol t, no quotes or anything), and the type specifier for that is:
:type '(choice (const :tag "No postamble" nil)
(const :tag "Auto preamble" 'auto)
(const :tag "Default formatting string" t)
(string :tag "Custom formatting string")
(function :tag "Function (must return a string)")))
... which would seem to match that third line. No? Is '(choice ... not a valid value for :type?
It looks like two bugs:
a trivial one in org-html.el which declares :type 'string for that variable, even though the variable's value is not a string.
a bug in customize which says "changed outside customize" in this mismatched case, even though the mismatch actually came straight from customize and not outside of it.
Please report it with M-x report-emacs-bug.
Because (I presume) of the C-o newlines, it then said:
CHANGED outside Customize; operating on it here may be unreliable. (mismatch)
I've never looked into the details, but I would assume that "CHANGED outside Customize" almost certainly means that somewhere in your config the org-export-html-postamble-format variable is set directly in code. The text of the error certainly doesn't suggest it could be caused if the variable was only ever set via the customize interface.

Org-mode & Latex export: Any way to put short & long names in sectioning commands? Workarounds?

In standard Latex, one can use something like...
\section[short head]{A longer and more meaningful heading version for the section}
...that gives both a long and short version of a section (or other sectioning command) Thus, allowing for both meaningful sectioning 'titles' and, also, reasonable-looking running heads, TOCs, beamer navigation, etc..
Is there any way to easily achieve this in org mode? (That is without hard coding the sectioning commands in LATEX snippets and, thus, defeating most of the flexibility of changing sectioning levels and repurposing content for beamer, book, and article classes that is my reason for wanting to try orgmode, in first place?)
I tried a "workaround" that did not work. I tried editing the possible latex export classes by adding another class to org-export-latex-classes. This new class changes sectioning commands from \section{%s} to \section%s(EDIT-Fixed typo in slashes). Then I tested using [short]{longer version} in orgmode sections of the file. It worked, except it acted as if the longer version section heading was just "{" and "longer version" was body text! What is up with that?
Since version 8.0 the "org-export-latex-classes" strategy won't work anymore.
Instead, and dare I say much more elegantly, you can set the ALT_TITLE property for the heading.
See http://orgmode.org/manual/Table-of-contents.html.
The following org code:
* The Long Title of Section 1
:PROPERTIES:
:ALT_TITLE: Section 1
:END:
Lorem ipsum.
** The Long Title of Subsection 1-1
:PROPERTIES:
:ALT_TITLE: Subsection 1-1
:END:
Dolor sit amet.
will export to LaTeX as:
[...]
\section[Section 1]{The Long Title of Section 1}
\label{sec-1}
Lorem ipsum.
\subsection[Subsection 1-1]{The Long Title of Subsection 1-1}
\label{sec-1-1}
Dolor sit amet.
You had the right idea with creating your own LaTeX class. The problem lies with the way the templates are filled by the default org-fill-template function. I'm not so great with Lisp, but this this hack will do the trick. Add the following to your .emacs file:
(defun my-section (level text)
(let* ((in "") (out "")
(short-title (if (string-match "\\[.*\\]" text)
(substring text (match-beginning 0)
(match-end 0))
nil)))
(if short-title (setq text (substring text (match-end 0) -1)))
(setq in (org-fill-template
"\\section%S{%s}"
(list (cons "S" (or short-title ""))
(cons "s" (or text ""))))
out (copy-sequence "\\end{section}"))
(cons text (list in out in out))))
(add-to-list 'org-export-latex-classes
'("test"
"\\documentclass{article}"
my-section))
This declares a new latex class by adding a "test" class to the org-export-latex-classes. Here we declare, instead of the normal \\section{%s} stuff a function that takes two parameters --- the current level and the headline text --- and returns a modified cons cell. Some details of this information can be found in org-latex-export.el.
Above the adding to the list is where we actually define the function. This is honestly a hacky version, and I pulled a lot from the org-beamer-sectioning function in org-beamer.el file. This function basically searches the headline for anything that is like a LaTeX short label (i.e. [....]) removes it from the headline and sticks it before the actual section label. Right now this hack will only generate \section statements, no matter how deep the level - if you want something more intelligent like \chapter or \subsection or even unnumbered items, you'll need to do some more Lisping; again, see org-beamer.el for some help.
This bit of org-mode code
#+latex_class: test
* [short 1] this is 1 star
test
** this is a 2 star
test
*** [short 3] this is a 3 star
test
**** what happens
exports to LaTeX as (only relevant sections shown here):
\section[short 1]{ this is 1 star}
\label{sec-1}
test
\section{ this is a 2 star }
\label{sec-1-1}
test
\section[short 3]{ this is a 3 star}
\label{sec-1-1-1}
test
\section{ what happens }
\label{sec-1-1-1-1}
\end{section}
\end{section}
\end{section}
\end{section}
Although it's not a straight org-mode solution, it seems to work and can be a starting point for you. One of these days I might try to write it up properly and get it folded into the org-mode distribution.
It is possible to use the following commands in latex to define the text that should appear in the header to replace section names. But the TOC will still contain the original names.
\chaptermarks
\sectionmarks
\subsectionmarks
...
So, in org-mode you can write
* Long section title
#+LaTeX: \sectionmark{Short title}
edit: it actually doesn't work on the very page where the section name appears. On this one only, the full name is still put in the header.