Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#include<stack> 这个头文件的处理有一点问题。 #7

Open
tacmon opened this issue Aug 20, 2019 · 10 comments
Open

#include<stack> 这个头文件的处理有一点问题。 #7

tacmon opened this issue Aug 20, 2019 · 10 comments

Comments

@tacmon
Copy link

tacmon commented Aug 20, 2019

No description provided.

@tacmon
Copy link
Author

tacmon commented Aug 20, 2019

It can't be added effectively.

@ianyepan
Copy link

ianyepan commented May 20, 2020

Same issue. I'm also having trouble including <stack>

@syohex
Copy link
Contributor

syohex commented May 20, 2020

Add following configuration in your conifguration

(with-eval-after-load 'cpp-auto-include
  (add-to-list 'cpp-auto-include--header-regexp (list "stack" t t "\\bstack\\s-*<")))

Or apply following patch.

diff --git a/cpp-auto-include.el b/cpp-auto-include.el
index 7b11c69..d67e5f1 100644
--- a/cpp-auto-include.el
+++ b/cpp-auto-include.el
@@ -126,7 +126,8 @@
                                  (and (or "fixed" "hex")
                                       symbol-end)))))
     ("string" t t "\\bstring\\b")
-    ("utility" t t "\\b\\(?:pair\\s-*<\\|make_pair\\)")))
+    ("utility" t t "\\b\\(?:pair\\s-*<\\|make_pair\\)")
+    ("stack" t t "\\bstack\\s-*<")))
 
 (defun cpp-auto-include--include-line (header)
   (save-excursion

BTW this package provides very low level features, I suppose it is better to use more smart packages which support auto including header rather than this package.

@ianyepan
Copy link

Thanks for the workaround, it works for me now.

I suppose it is better to use more smart packages which support auto including header rather than this package.

Oh? Is there anything that you'd recommend at the moment?

@syohex
Copy link
Contributor

syohex commented May 20, 2020

Oh? Is there anything that you'd recommend at the moment?

Sorry I don't know and I'm no longer use Emacs. However clangd supports auto include feature so lsp-mode might support it.

@ianyepan
Copy link

@syohex Thanks, I have actually using lsp with clangd. I'll look into it then.

@ianyepan
Copy link

I have excellent news:
Turns out that someone loves this so much that he continues to maintain this project privately, and has now grown over 1500+ lines! https://github.com/elbeno/dotemacs/blob/master/.emacs.d/site-lisp/cpp-auto-include.el
@syohex If you wish, you can replace this repo's content with his 'fork', provided that you have access to commit and PR. Preferably after giving credits to the fork maintainer Ben.
Anyhow, I have mine set up like this now:

(use-package cpp-auto-include ; Copyright (C) 2015 by Syohei Yoshida / Ben Deane
  :bind (:map c++-mode-map ("C-c i" . cpp-auto-include/ensure-includes-for-file)))

@syohex
Copy link
Contributor

syohex commented May 20, 2020

I have no longer write permission of this repository and I cannot change this repository content.

@ianyepan
Copy link

No problem, I'll open a new issue asking the devs here to consider updating the code.

@tarsius
Copy link
Member

tarsius commented May 20, 2020

It would be create if @elbeno could maintain this officially. Interested?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants