{"action":"closed","issue":{"url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/10776","repository_url":"https://api.github.com/repos/syl20bnr/spacemacs","labels_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/10776/labels{/name}","comments_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/10776/comments","events_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/10776/events","html_url":"https://github.com/syl20bnr/spacemacs/issues/10776","id":327631236,"number":10776,"title":"Indentation issue c/c++ clang-format.","user":{"login":"SirJls","id":9994176,"avatar_url":"https://avatars1.githubusercontent.com/u/9994176?v=4","gravatar_id":"","url":"https://api.github.com/users/SirJls","html_url":"https://github.com/SirJls","followers_url":"https://api.github.com/users/SirJls/followers","following_url":"https://api.github.com/users/SirJls/following{/other_user}","gists_url":"https://api.github.com/users/SirJls/gists{/gist_id}","starred_url":"https://api.github.com/users/SirJls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirJls/subscriptions","organizations_url":"https://api.github.com/users/SirJls/orgs","repos_url":"https://api.github.com/users/SirJls/repos","events_url":"https://api.github.com/users/SirJls/events{/privacy}","received_events_url":"https://api.github.com/users/SirJls/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-05-30T08:44:25Z","updated_at":"2018-05-30T15:13:06Z","closed_at":"2018-05-30T15:13:05Z","author_association":"NONE","body":"I am scratching my head over this issue for some hours now, but I am not able to figure out why spacemacs does not properly ident my file with an 8 character indent.\r\n\r\nRunning `clang-format my-file-name` from the terminal does give me the correct results, but using one of the two following commands yields an improper indented region/buffer.\r\n\r\nI've taken a look at similar [problems](https://github.com/syl20bnr/spacemacs/issues/10080), but none seem to answer my question.\r\n\r\n`(setq c-basic-offset 8)` also seems to yield no wishful results.\r\n\r\nMaybe I am going over it wrong, but I would gladly like to get some suggestions and/or possible fix.\r\n\r\nI am currently using the upstream HEAD of the develop branch of spacemacs.\r\n`git rev-list HEAD | head -n1` = 8f82486154f828d3b805c5c349e41b82c801d2c8\r\n\r\nThe clang-format file is as follows (directly taken from the kernel tree):\r\n```\r\n---\r\nAccessModifierOffset: -4\r\nAlignAfterOpenBracket: Align\r\nAlignConsecutiveAssignments: false\r\nAlignConsecutiveDeclarations: false\r\n#AlignEscapedNewlines: Left # Unknown to clang-format-4.0\r\nAlignOperands: true\r\nAlignTrailingComments: false\r\nAllowAllParametersOfDeclarationOnNextLine: false\r\nAllowShortBlocksOnASingleLine: false\r\nAllowShortCaseLabelsOnASingleLine: false\r\nAllowShortFunctionsOnASingleLine: None\r\nAllowShortIfStatementsOnASingleLine: false\r\nAllowShortLoopsOnASingleLine: false\r\nAlwaysBreakAfterDefinitionReturnType: None\r\nAlwaysBreakAfterReturnType: None\r\nAlwaysBreakBeforeMultilineStrings: false\r\nAlwaysBreakTemplateDeclarations: false\r\nBinPackArguments: true\r\nBinPackParameters: true\r\nBraceWrapping:\r\n  AfterClass: false\r\n  AfterControlStatement: false\r\n  AfterEnum: false\r\n  AfterFunction: true\r\n  AfterNamespace: true\r\n  AfterObjCDeclaration: false\r\n  AfterStruct: false\r\n  AfterUnion: false\r\n  #AfterExternBlock: false # Unknown to clang-format-5.0\r\n  BeforeCatch: false\r\n  BeforeElse: false\r\n  IndentBraces: false\r\n  #SplitEmptyFunction: true # Unknown to clang-format-4.0\r\n  #SplitEmptyRecord: true # Unknown to clang-format-4.0\r\n  #SplitEmptyNamespace: true # Unknown to clang-format-4.0\r\nBreakBeforeBinaryOperators: None\r\nBreakBeforeBraces: Custom\r\n#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0\r\nBreakBeforeTernaryOperators: false\r\nBreakConstructorInitializersBeforeComma: false\r\n#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0\r\nBreakAfterJavaFieldAnnotations: false\r\nBreakStringLiterals: false\r\nColumnLimit: 80\r\nCommentPragmas: '^ IWYU pragma:'\r\n#CompactNamespaces: false # Unknown to clang-format-4.0\r\nConstructorInitializerAllOnOneLineOrOnePerLine: false\r\nConstructorInitializerIndentWidth: 8\r\nContinuationIndentWidth: 8\r\nCpp11BracedListStyle: false\r\nDerivePointerAlignment: false\r\nDisableFormat: false\r\nExperimentalAutoDetectBinPacking: false\r\n#FixNamespaceComments: false # Unknown to clang-format-4.0\r\n\r\n# Taken from:\r\n#   git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \\\r\n#   | sed \"s,^#define \\([^[:space:]]*for_each[^[:space:]]*\\)(.*$,  - '\\1',\" \\\r\n#   | sort | uniq\r\nForEachMacros:\r\n  - 'apei_estatus_for_each_section'\r\n  - 'ata_for_each_dev'\r\n  - 'ata_for_each_link'\r\n  - 'ax25_for_each'\r\n  - 'ax25_uid_for_each'\r\n  - 'bio_for_each_integrity_vec'\r\n  - '__bio_for_each_segment'\r\n  - 'bio_for_each_segment'\r\n  - 'bio_for_each_segment_all'\r\n  - 'bio_list_for_each'\r\n  - 'bip_for_each_vec'\r\n  - 'blkg_for_each_descendant_post'\r\n  - 'blkg_for_each_descendant_pre'\r\n  - 'blk_queue_for_each_rl'\r\n  - 'bond_for_each_slave'\r\n  - 'bond_for_each_slave_rcu'\r\n  - 'btree_for_each_safe128'\r\n  - 'btree_for_each_safe32'\r\n  - 'btree_for_each_safe64'\r\n  - 'btree_for_each_safel'\r\n  - 'card_for_each_dev'\r\n  - 'cgroup_taskset_for_each'\r\n  - 'cgroup_taskset_for_each_leader'\r\n  - 'cpufreq_for_each_entry'\r\n  - 'cpufreq_for_each_entry_idx'\r\n  - 'cpufreq_for_each_valid_entry'\r\n  - 'cpufreq_for_each_valid_entry_idx'\r\n  - 'css_for_each_child'\r\n  - 'css_for_each_descendant_post'\r\n  - 'css_for_each_descendant_pre'\r\n  - 'device_for_each_child_node'\r\n  - 'drm_atomic_crtc_for_each_plane'\r\n  - 'drm_atomic_crtc_state_for_each_plane'\r\n  - 'drm_atomic_crtc_state_for_each_plane_state'\r\n  - 'drm_for_each_connector_iter'\r\n  - 'drm_for_each_crtc'\r\n  - 'drm_for_each_encoder'\r\n  - 'drm_for_each_encoder_mask'\r\n  - 'drm_for_each_fb'\r\n  - 'drm_for_each_legacy_plane'\r\n  - 'drm_for_each_plane'\r\n  - 'drm_for_each_plane_mask'\r\n  - 'drm_mm_for_each_hole'\r\n  - 'drm_mm_for_each_node'\r\n  - 'drm_mm_for_each_node_in_range'\r\n  - 'drm_mm_for_each_node_safe'\r\n  - 'for_each_active_drhd_unit'\r\n  - 'for_each_active_iommu'\r\n  - 'for_each_available_child_of_node'\r\n  - 'for_each_bio'\r\n  - 'for_each_board_func_rsrc'\r\n  - 'for_each_bvec'\r\n  - 'for_each_child_of_node'\r\n  - 'for_each_clear_bit'\r\n  - 'for_each_clear_bit_from'\r\n  - 'for_each_cmsghdr'\r\n  - 'for_each_compatible_node'\r\n  - 'for_each_console'\r\n  - 'for_each_cpu'\r\n  - 'for_each_cpu_and'\r\n  - 'for_each_cpu_not'\r\n  - 'for_each_cpu_wrap'\r\n  - 'for_each_dev_addr'\r\n  - 'for_each_dma_cap_mask'\r\n  - 'for_each_drhd_unit'\r\n  - 'for_each_dss_dev'\r\n  - 'for_each_efi_memory_desc'\r\n  - 'for_each_efi_memory_desc_in_map'\r\n  - 'for_each_endpoint_of_node'\r\n  - 'for_each_evictable_lru'\r\n  - 'for_each_fib6_node_rt_rcu'\r\n  - 'for_each_fib6_walker_rt'\r\n  - 'for_each_free_mem_range'\r\n  - 'for_each_free_mem_range_reverse'\r\n  - 'for_each_func_rsrc'\r\n  - 'for_each_hstate'\r\n  - 'for_each_if'\r\n  - 'for_each_iommu'\r\n  - 'for_each_ip_tunnel_rcu'\r\n  - 'for_each_irq_nr'\r\n  - 'for_each_lru'\r\n  - 'for_each_matching_node'\r\n  - 'for_each_matching_node_and_match'\r\n  - 'for_each_memblock'\r\n  - 'for_each_memblock_type'\r\n  - 'for_each_memcg_cache_index'\r\n  - 'for_each_mem_pfn_range'\r\n  - 'for_each_mem_range'\r\n  - 'for_each_mem_range_rev'\r\n  - 'for_each_migratetype_order'\r\n  - 'for_each_msi_entry'\r\n  - 'for_each_net'\r\n  - 'for_each_netdev'\r\n  - 'for_each_netdev_continue'\r\n  - 'for_each_netdev_continue_rcu'\r\n  - 'for_each_netdev_feature'\r\n  - 'for_each_netdev_in_bond_rcu'\r\n  - 'for_each_netdev_rcu'\r\n  - 'for_each_netdev_reverse'\r\n  - 'for_each_netdev_safe'\r\n  - 'for_each_net_rcu'\r\n  - 'for_each_new_connector_in_state'\r\n  - 'for_each_new_crtc_in_state'\r\n  - 'for_each_new_plane_in_state'\r\n  - 'for_each_new_private_obj_in_state'\r\n  - 'for_each_node'\r\n  - 'for_each_node_by_name'\r\n  - 'for_each_node_by_type'\r\n  - 'for_each_node_mask'\r\n  - 'for_each_node_state'\r\n  - 'for_each_node_with_cpus'\r\n  - 'for_each_node_with_property'\r\n  - 'for_each_of_allnodes'\r\n  - 'for_each_of_allnodes_from'\r\n  - 'for_each_of_pci_range'\r\n  - 'for_each_old_connector_in_state'\r\n  - 'for_each_old_crtc_in_state'\r\n  - 'for_each_oldnew_connector_in_state'\r\n  - 'for_each_oldnew_crtc_in_state'\r\n  - 'for_each_oldnew_plane_in_state'\r\n  - 'for_each_oldnew_private_obj_in_state'\r\n  - 'for_each_old_plane_in_state'\r\n  - 'for_each_old_private_obj_in_state'\r\n  - 'for_each_online_cpu'\r\n  - 'for_each_online_node'\r\n  - 'for_each_online_pgdat'\r\n  - 'for_each_pci_bridge'\r\n  - 'for_each_pci_dev'\r\n  - 'for_each_pci_msi_entry'\r\n  - 'for_each_populated_zone'\r\n  - 'for_each_possible_cpu'\r\n  - 'for_each_present_cpu'\r\n  - 'for_each_prime_number'\r\n  - 'for_each_prime_number_from'\r\n  - 'for_each_process'\r\n  - 'for_each_process_thread'\r\n  - 'for_each_property_of_node'\r\n  - 'for_each_reserved_mem_region'\r\n  - 'for_each_resv_unavail_range'\r\n  - 'for_each_rtdcom'\r\n  - 'for_each_rtdcom_safe'\r\n  - 'for_each_set_bit'\r\n  - 'for_each_set_bit_from'\r\n  - 'for_each_sg'\r\n  - 'for_each_sg_page'\r\n  - '__for_each_thread'\r\n  - 'for_each_thread'\r\n  - 'for_each_zone'\r\n  - 'for_each_zone_zonelist'\r\n  - 'for_each_zone_zonelist_nodemask'\r\n  - 'fwnode_for_each_available_child_node'\r\n  - 'fwnode_for_each_child_node'\r\n  - 'fwnode_graph_for_each_endpoint'\r\n  - 'gadget_for_each_ep'\r\n  - 'hash_for_each'\r\n  - 'hash_for_each_possible'\r\n  - 'hash_for_each_possible_rcu'\r\n  - 'hash_for_each_possible_rcu_notrace'\r\n  - 'hash_for_each_possible_safe'\r\n  - 'hash_for_each_rcu'\r\n  - 'hash_for_each_safe'\r\n  - 'hctx_for_each_ctx'\r\n  - 'hlist_bl_for_each_entry'\r\n  - 'hlist_bl_for_each_entry_rcu'\r\n  - 'hlist_bl_for_each_entry_safe'\r\n  - 'hlist_for_each'\r\n  - 'hlist_for_each_entry'\r\n  - 'hlist_for_each_entry_continue'\r\n  - 'hlist_for_each_entry_continue_rcu'\r\n  - 'hlist_for_each_entry_continue_rcu_bh'\r\n  - 'hlist_for_each_entry_from'\r\n  - 'hlist_for_each_entry_from_rcu'\r\n  - 'hlist_for_each_entry_rcu'\r\n  - 'hlist_for_each_entry_rcu_bh'\r\n  - 'hlist_for_each_entry_rcu_notrace'\r\n  - 'hlist_for_each_entry_safe'\r\n  - '__hlist_for_each_rcu'\r\n  - 'hlist_for_each_safe'\r\n  - 'hlist_nulls_for_each_entry'\r\n  - 'hlist_nulls_for_each_entry_from'\r\n  - 'hlist_nulls_for_each_entry_rcu'\r\n  - 'hlist_nulls_for_each_entry_safe'\r\n  - 'ide_host_for_each_port'\r\n  - 'ide_port_for_each_dev'\r\n  - 'ide_port_for_each_present_dev'\r\n  - 'idr_for_each_entry'\r\n  - 'idr_for_each_entry_continue'\r\n  - 'idr_for_each_entry_ul'\r\n  - 'inet_bind_bucket_for_each'\r\n  - 'inet_lhash2_for_each_icsk_rcu'\r\n  - 'iov_for_each'\r\n  - 'key_for_each'\r\n  - 'key_for_each_safe'\r\n  - 'klp_for_each_func'\r\n  - 'klp_for_each_object'\r\n  - 'kvm_for_each_memslot'\r\n  - 'kvm_for_each_vcpu'\r\n  - 'list_for_each'\r\n  - 'list_for_each_entry'\r\n  - 'list_for_each_entry_continue'\r\n  - 'list_for_each_entry_continue_rcu'\r\n  - 'list_for_each_entry_continue_reverse'\r\n  - 'list_for_each_entry_from'\r\n  - 'list_for_each_entry_from_reverse'\r\n  - 'list_for_each_entry_lockless'\r\n  - 'list_for_each_entry_rcu'\r\n  - 'list_for_each_entry_reverse'\r\n  - 'list_for_each_entry_safe'\r\n  - 'list_for_each_entry_safe_continue'\r\n  - 'list_for_each_entry_safe_from'\r\n  - 'list_for_each_entry_safe_reverse'\r\n  - 'list_for_each_prev'\r\n  - 'list_for_each_prev_safe'\r\n  - 'list_for_each_safe'\r\n  - 'llist_for_each'\r\n  - 'llist_for_each_entry'\r\n  - 'llist_for_each_entry_safe'\r\n  - 'llist_for_each_safe'\r\n  - 'media_device_for_each_entity'\r\n  - 'media_device_for_each_intf'\r\n  - 'media_device_for_each_link'\r\n  - 'media_device_for_each_pad'\r\n  - 'netdev_for_each_lower_dev'\r\n  - 'netdev_for_each_lower_private'\r\n  - 'netdev_for_each_lower_private_rcu'\r\n  - 'netdev_for_each_mc_addr'\r\n  - 'netdev_for_each_uc_addr'\r\n  - 'netdev_for_each_upper_dev_rcu'\r\n  - 'netdev_hw_addr_list_for_each'\r\n  - 'nft_rule_for_each_expr'\r\n  - 'nla_for_each_attr'\r\n  - 'nla_for_each_nested'\r\n  - 'nlmsg_for_each_attr'\r\n  - 'nlmsg_for_each_msg'\r\n  - 'nr_neigh_for_each'\r\n  - 'nr_neigh_for_each_safe'\r\n  - 'nr_node_for_each'\r\n  - 'nr_node_for_each_safe'\r\n  - 'of_for_each_phandle'\r\n  - 'of_property_for_each_string'\r\n  - 'of_property_for_each_u32'\r\n  - 'pci_bus_for_each_resource'\r\n  - 'ping_portaddr_for_each_entry'\r\n  - 'plist_for_each'\r\n  - 'plist_for_each_continue'\r\n  - 'plist_for_each_entry'\r\n  - 'plist_for_each_entry_continue'\r\n  - 'plist_for_each_entry_safe'\r\n  - 'plist_for_each_safe'\r\n  - 'pnp_for_each_card'\r\n  - 'pnp_for_each_dev'\r\n  - 'protocol_for_each_card'\r\n  - 'protocol_for_each_dev'\r\n  - 'queue_for_each_hw_ctx'\r\n  - 'radix_tree_for_each_contig'\r\n  - 'radix_tree_for_each_slot'\r\n  - 'radix_tree_for_each_tagged'\r\n  - 'rbtree_postorder_for_each_entry_safe'\r\n  - 'resource_list_for_each_entry'\r\n  - 'resource_list_for_each_entry_safe'\r\n  - 'rhl_for_each_entry_rcu'\r\n  - 'rhl_for_each_rcu'\r\n  - 'rht_for_each'\r\n  - 'rht_for_each_continue'\r\n  - 'rht_for_each_entry'\r\n  - 'rht_for_each_entry_continue'\r\n  - 'rht_for_each_entry_rcu'\r\n  - 'rht_for_each_entry_rcu_continue'\r\n  - 'rht_for_each_entry_safe'\r\n  - 'rht_for_each_rcu'\r\n  - 'rht_for_each_rcu_continue'\r\n  - '__rq_for_each_bio'\r\n  - 'rq_for_each_segment'\r\n  - 'scsi_for_each_prot_sg'\r\n  - 'scsi_for_each_sg'\r\n  - 'sctp_for_each_hentry'\r\n  - 'sctp_skb_for_each'\r\n  - 'shdma_for_each_chan'\r\n  - '__shost_for_each_device'\r\n  - 'shost_for_each_device'\r\n  - 'sk_for_each'\r\n  - 'sk_for_each_bound'\r\n  - 'sk_for_each_entry_offset_rcu'\r\n  - 'sk_for_each_from'\r\n  - 'sk_for_each_rcu'\r\n  - 'sk_for_each_safe'\r\n  - 'sk_nulls_for_each'\r\n  - 'sk_nulls_for_each_from'\r\n  - 'sk_nulls_for_each_rcu'\r\n  - 'snd_pcm_group_for_each_entry'\r\n  - 'snd_soc_dapm_widget_for_each_path'\r\n  - 'snd_soc_dapm_widget_for_each_path_safe'\r\n  - 'snd_soc_dapm_widget_for_each_sink_path'\r\n  - 'snd_soc_dapm_widget_for_each_source_path'\r\n  - 'tb_property_for_each'\r\n  - 'udp_portaddr_for_each_entry'\r\n  - 'udp_portaddr_for_each_entry_rcu'\r\n  - 'usb_hub_for_each_child'\r\n  - 'v4l2_device_for_each_subdev'\r\n  - 'v4l2_m2m_for_each_dst_buf'\r\n  - 'v4l2_m2m_for_each_dst_buf_safe'\r\n  - 'v4l2_m2m_for_each_src_buf'\r\n  - 'v4l2_m2m_for_each_src_buf_safe'\r\n  - 'zorro_for_each_dev'\r\n\r\n#IncludeBlocks: Preserve # Unknown to clang-format-5.0\r\nIncludeCategories:\r\n  - Regex: '.*'\r\n    Priority: 1\r\nIncludeIsMainRegex: '(Test)?$'\r\nIndentCaseLabels: false\r\n#IndentPPDirectives: None # Unknown to clang-format-5.0\r\nIndentWidth: 8\r\nIndentWrappedFunctionNames: true\r\nJavaScriptQuotes: Leave\r\nJavaScriptWrapImports: true\r\nKeepEmptyLinesAtTheStartOfBlocks: false\r\nMacroBlockBegin: ''\r\nMacroBlockEnd: ''\r\nMaxEmptyLinesToKeep: 1\r\nNamespaceIndentation: Inner\r\n#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0\r\nObjCBlockIndentWidth: 8\r\nObjCSpaceAfterProperty: true\r\nObjCSpaceBeforeProtocolList: true\r\n\r\n# Taken from git's rules\r\n#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0\r\nPenaltyBreakBeforeFirstCallParameter: 30\r\nPenaltyBreakComment: 10\r\nPenaltyBreakFirstLessLess: 0\r\nPenaltyBreakString: 10\r\nPenaltyExcessCharacter: 100\r\nPenaltyReturnTypeOnItsOwnLine: 60\r\n\r\nPointerAlignment: Right\r\nReflowComments: false\r\nSortIncludes: false\r\n#SortUsingDeclarations: false # Unknown to clang-format-4.0\r\nSpaceAfterCStyleCast: false\r\nSpaceAfterTemplateKeyword: true\r\nSpaceBeforeAssignmentOperators: true\r\n#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0\r\n#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0\r\nSpaceBeforeParens: ControlStatements\r\n#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0\r\nSpaceInEmptyParentheses: false\r\nSpacesBeforeTrailingComments: 1\r\nSpacesInAngles: false\r\nSpacesInContainerLiterals: false\r\nSpacesInCStyleCastParentheses: false\r\nSpacesInParentheses: false\r\nSpacesInSquareBrackets: false\r\nStandard: Cpp03\r\nTabWidth: 8\r\nUseTab: Always\r\n...\r\n```\r\n"}}
{"actor":{"display_login":"SirJls"}}